KeosWin32PlatformDll.cpp

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 
00022 #include "KeosWin32Timer.h"
00023 #include "KeosWin32ConfigDialog.h"
00024 #include "KeosWin32ErrorDialog.h"
00025 
00026 namespace Keos
00027 {
00028   // Creates a Timer using default implementation
00029   extern "C" void createTimer(CTimer** ppTimer)
00030   {
00031     *ppTimer = new CWin32Timer();
00032     (*ppTimer)->Reset();
00033   }
00034 
00035   // Destroy a Timer
00036   extern "C" void destroyTimer(CTimer* pTimer)
00037   {
00038     delete pTimer;
00039   }
00040 
00041   // Retrieves an instance of a config dialog
00042   extern "C" void createPlatformConfigDialog(IConfigDialog** ppDlg)
00043   {
00044     HINSTANCE hInst = GetModuleHandle(KEOS_PLATFORM_LIB);
00045     *ppDlg = new CWin32ConfigDialog(hInst);
00046   }
00047 
00048   // Destroy a IConfigDialog
00049   extern "C" void destroyPlatformConfigDialog(IConfigDialog* pDlg)
00050   {
00051     delete pDlg;
00052   }
00053 
00054   // Retrieves an instance of a error dialog
00055   extern "C" void createPlatformErrorDialog(IErrorDialog** ppDlg)
00056   {
00057     HINSTANCE hInst = GetModuleHandle(KEOS_PLATFORM_LIB);
00058     *ppDlg = new CWin32ErrorDialog(hInst);
00059   }
00060 
00061   // Destroy a IErrorDialog
00062   extern "C" void destroyPlatformErrorDialog(IErrorDialog* pDlg)
00063   {
00064     delete pDlg;
00065   }
00066 
00067   // Get the list of video modes (640x480, 800x600, ...)
00068   extern "C" void getVideoModeList(StringVector* pList)
00069   {
00070     DEVMODE DevMode;
00071     DevMode.dmSize = sizeof(DEVMODE);
00072     for (DWORD i = 0; EnumDisplaySettings(NULL, i, &DevMode); ++i)
00073     {
00074       if (DevMode.dmBitsPerPel < 16 || DevMode.dmPelsHeight < 480)
00075         continue;
00076       char szBuf[14];
00077       snprintf(szBuf, 14, "%dx%d", DevMode.dmPelsWidth, DevMode.dmPelsHeight);
00078 
00079       if  ( find( pList->begin( ), pList->end( ), szBuf ) == pList->end( ) )
00080         pList->push_back(szBuf);
00081     }
00082   }
00083 
00084 } // namespace Keos

Generated on Fri Mar 9 14:29:03 2007 for Keos by  doxygen 1.5.1-p1