Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #include "GHOST_IEventConsumer.h" 00034 #include "STR_String.h" 00035 00036 #ifdef WIN32 00037 #include <wtypes.h> 00038 #endif 00039 00040 #include "KX_KetsjiEngine.h" 00041 00042 class KX_KetsjiEngine; 00043 class KX_ISceneConverter; 00044 class NG_LoopBackNetworkDeviceInterface; 00045 class RAS_IRasterizer; 00046 class GHOST_IEvent; 00047 class GHOST_ISystem; 00048 class GHOST_ITimerTask; 00049 class GHOST_IWindow; 00050 class GPC_MouseDevice; 00051 class GPC_RenderTools; 00052 class GPG_Canvas; 00053 class GPG_KeyboardDevice; 00054 class GPG_System; 00055 struct Main; 00056 struct Scene; 00057 00058 class GPG_Application : public GHOST_IEventConsumer 00059 { 00060 public: 00061 GPG_Application(GHOST_ISystem* system); 00062 ~GPG_Application(void); 00063 00064 bool SetGameEngineData(struct Main* maggie, struct Scene* scene, GlobalSettings* gs, int argc, char** argv); 00065 bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight, 00066 const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); 00067 bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0, bool useDesktop=false); 00068 bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); 00069 #ifdef WIN32 00070 bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); 00071 bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); 00072 #endif 00073 00074 virtual bool processEvent(GHOST_IEvent* event); 00075 int getExitRequested(void); 00076 const STR_String& getExitString(void); 00077 GlobalSettings* getGlobalSettings(void); 00078 bool StartGameEngine(int stereoMode); 00079 void StopGameEngine(); 00080 00081 protected: 00082 bool handleWheel(GHOST_IEvent* event); 00083 bool handleButton(GHOST_IEvent* event, bool isDown); 00084 bool handleCursorMove(GHOST_IEvent* event); 00085 bool handleKey(GHOST_IEvent* event, bool isDown); 00086 00090 bool initEngine(GHOST_IWindow* window, int stereoMode); 00091 00095 bool startEngine(void); 00096 00100 void stopEngine(void); 00101 00105 void exitEngine(void); 00106 short m_exitkey; 00107 00108 /* The game data */ 00109 STR_String m_startSceneName; 00110 struct Scene* m_startScene; 00111 struct Main* m_maggie; 00112 00113 /* Exit state. */ 00114 int m_exitRequested; 00115 STR_String m_exitString; 00116 GlobalSettings* m_globalSettings; 00117 00118 /* GHOST system abstraction. */ 00119 GHOST_ISystem* m_system; 00120 /* Main window. */ 00121 GHOST_IWindow* m_mainWindow; 00122 /* Timer to advance frames. */ 00123 GHOST_ITimerTask* m_frameTimer; 00124 /* The cursor shape displayed. */ 00125 GHOST_TStandardCursor m_cursor; 00126 00128 bool m_engineInitialized; 00130 bool m_engineRunning; 00132 bool m_isEmbedded; 00133 00135 KX_KetsjiEngine* m_ketsjiengine; 00137 GPG_System* m_kxsystem; 00139 GPG_KeyboardDevice* m_keyboard; 00141 GPC_MouseDevice* m_mouse; 00143 GPG_Canvas* m_canvas; 00145 GPC_RenderTools* m_rendertools; 00147 RAS_IRasterizer* m_rasterizer; 00149 KX_ISceneConverter* m_sceneconverter; 00151 NG_LoopBackNetworkDeviceInterface* m_networkdevice; 00152 00153 bool m_blendermat; 00154 bool m_blenderglslmat; 00155 00156 /* 00157 * GameLogic.globalDict as a string so that loading new blend files can use the same dict. 00158 * Do this because python starts/stops when loading blend files. 00159 */ 00160 char* m_pyGlobalDictString; 00161 int m_pyGlobalDictString_Length; 00162 00163 /* argc and argv need to be passed on to python */ 00164 int m_argc; 00165 char** m_argv; 00166 }; 00167