4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
28 * GHOST Blender Player application declaration file.
31 #include "GHOST_IEventConsumer.h"
32 #include "STR_String.h"
38 class KX_KetsjiEngine;
39 class KX_ISceneConverter;
40 class NG_LoopBackNetworkDeviceInterface;
41 class SND_IAudioDevice;
42 class RAS_IRasterizer;
45 class GHOST_ITimerTask;
47 class GPC_MouseDevice;
48 class GPC_RenderTools;
50 class GPG_KeyboardDevice;
55 class GPG_Application : public GHOST_IEventConsumer
58 GPG_Application(GHOST_ISystem* system);
59 ~GPG_Application(void);
61 bool SetGameEngineData(struct Main* maggie, struct Scene* scene);
62 bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight,
63 const bool stereoVisual, const int stereoMode);
64 bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
65 bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode);
67 bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
68 bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode);
71 virtual bool processEvent(GHOST_IEvent* event);
72 int getExitRequested(void);
73 const STR_String& getExitString(void);
74 bool StartGameEngine(int stereoMode);
75 void StopGameEngine();
78 bool handleWheel(GHOST_IEvent* event);
79 bool handleButton(GHOST_IEvent* event, bool isDown);
80 bool handleCursorMove(GHOST_IEvent* event);
81 bool handleKey(GHOST_IEvent* event, bool isDown);
84 * Initializes the game engine.
86 bool initEngine(GHOST_IWindow* window, int stereoMode);
89 * Starts the game engine.
91 bool startEngine(void);
94 * Stop the game engine.
96 void stopEngine(void);
99 * Shuts the game engine down.
101 void exitEngine(void);
104 STR_String m_startSceneName;
105 struct Scene* m_startScene;
106 struct Main* m_maggie;
110 STR_String m_exitString;
111 /* GHOST system abstraction. */
112 GHOST_ISystem* m_system;
114 GHOST_IWindow* m_mainWindow;
115 /* Timer to advance frames. */
116 GHOST_ITimerTask* m_frameTimer;
117 /* The cursor shape displayed. */
118 GHOST_TStandardCursor m_cursor;
120 /** Engine construction state. */
121 bool m_engineInitialized;
123 bool m_engineRunning;
124 /** Running on embedded window */
127 /** the gameengine itself */
128 KX_KetsjiEngine* m_ketsjiengine;
129 /** The game engine's system abstraction. */
130 GPG_System* m_kxsystem;
131 /** The game engine's keyboard abstraction. */
132 GPG_KeyboardDevice* m_keyboard;
133 /** The game engine's mouse abstraction. */
134 GPC_MouseDevice* m_mouse;
135 /** The game engine's canvas abstraction. */
136 GPG_Canvas* m_canvas;
137 /** The game engine's platform dependent render tools. */
138 GPC_RenderTools* m_rendertools;
139 /** the rasterizer */
140 RAS_IRasterizer* m_rasterizer;
141 /** Converts Blender data files. */
142 KX_ISceneConverter* m_sceneconverter;
143 /** Network interface. */
144 NG_LoopBackNetworkDeviceInterface* m_networkdevice;
146 SND_IAudioDevice* m_audiodevice;
149 bool m_blenderglslmat;
152 * GameLogic.globalDict as a string so that loading new blend files can use the same dict.
153 * Do this because python starts/stops when loading blend files.
155 char* m_pyGlobalDictString;
156 int m_pyGlobalDictString_Length;