|
Blender
V2.59
|
00001 /* 00002 * $Id: GPG_Application.h 36470 2011-05-04 01:50:17Z dfelinto $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00035 #include "GHOST_IEventConsumer.h" 00036 #include "STR_String.h" 00037 00038 #ifdef WIN32 00039 #include <wtypes.h> 00040 #endif 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, 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); 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 bool StartGameEngine(int stereoMode); 00078 void StopGameEngine(); 00079 00080 protected: 00081 bool handleWheel(GHOST_IEvent* event); 00082 bool handleButton(GHOST_IEvent* event, bool isDown); 00083 bool handleCursorMove(GHOST_IEvent* event); 00084 bool handleKey(GHOST_IEvent* event, bool isDown); 00085 00089 bool initEngine(GHOST_IWindow* window, int stereoMode); 00090 00094 bool startEngine(void); 00095 00099 void stopEngine(void); 00100 00104 void exitEngine(void); 00105 00106 /* The game data */ 00107 STR_String m_startSceneName; 00108 struct Scene* m_startScene; 00109 struct Main* m_maggie; 00110 00111 /* Exit state. */ 00112 int m_exitRequested; 00113 STR_String m_exitString; 00114 /* GHOST system abstraction. */ 00115 GHOST_ISystem* m_system; 00116 /* Main window. */ 00117 GHOST_IWindow* m_mainWindow; 00118 /* Timer to advance frames. */ 00119 GHOST_ITimerTask* m_frameTimer; 00120 /* The cursor shape displayed. */ 00121 GHOST_TStandardCursor m_cursor; 00122 00124 bool m_engineInitialized; 00126 bool m_engineRunning; 00128 bool m_isEmbedded; 00129 00131 KX_KetsjiEngine* m_ketsjiengine; 00133 GPG_System* m_kxsystem; 00135 GPG_KeyboardDevice* m_keyboard; 00137 GPC_MouseDevice* m_mouse; 00139 GPG_Canvas* m_canvas; 00141 GPC_RenderTools* m_rendertools; 00143 RAS_IRasterizer* m_rasterizer; 00145 KX_ISceneConverter* m_sceneconverter; 00147 NG_LoopBackNetworkDeviceInterface* m_networkdevice; 00148 00149 bool m_blendermat; 00150 bool m_blenderglslmat; 00151 00152 /* 00153 * GameLogic.globalDict as a string so that loading new blend files can use the same dict. 00154 * Do this because python starts/stops when loading blend files. 00155 */ 00156 char* m_pyGlobalDictString; 00157 int m_pyGlobalDictString_Length; 00158 00159 /* argc and argv need to be passed on to python */ 00160 int m_argc; 00161 char** m_argv; 00162 }; 00163