00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CSINITAPP_H__
00020 #define __CSINITAPP_H__
00021
00022 #include "cstypes.h"
00023 #include "iutil/evdefs.h"
00024
00025 struct iObjectRegistry;
00026 struct iEvent;
00027 struct iEventHandler;
00028 struct iEventQueue;
00029 struct iPluginManager;
00030 struct iVirtualClock;
00031 struct iCommandLineParser;
00032 struct iConfigManager;
00033
00034
00035 #define CS_REQUEST_PLUGIN(Name,Interface) \
00036 Name, #Interface, iSCF::SCF->GetInterfaceID (#Interface), VERSION_##Interface
00037 #define CS_REQUEST_END \
00038 NULL
00039 #define CS_REQUEST_VFS \
00040 CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS)
00041 #define CS_REQUEST_FONTSERVER \
00042 CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer)
00043 #define CS_REQUEST_IMAGELOADER \
00044 CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplex", iImageIO)
00045 #define CS_REQUEST_SOFTWARE3D \
00046 CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D)
00047 #define CS_REQUEST_OPENGL3D \
00048 CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D)
00049 #define CS_REQUEST_ENGINE \
00050 CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine)
00051 #define CS_REQUEST_LEVELLOADER \
00052 CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader)
00053 #define CS_REQUEST_REPORTER \
00054 CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter)
00055 #define CS_REQUEST_REPORTERLISTENER \
00056 CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener)
00057 #define CS_REQUEST_CONSOLEOUT \
00058 CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput)
00059
00063 typedef bool (*csEventHandlerFunc) (iEvent&);
00064
00070 class csInitializer
00071 {
00072 public:
00090 static iObjectRegistry* CreateEnvironment ();
00091
00096 static bool InitializeSCF ();
00097
00103 static iObjectRegistry* CreateObjectRegistry ();
00104
00111 static iPluginManager* CreatePluginManager (iObjectRegistry*);
00112
00119 static iEventQueue* CreateEventQueue (iObjectRegistry*);
00120
00127 static iVirtualClock* CreateVirtualClock (iObjectRegistry*);
00128
00134 static iCommandLineParser* CreateCommandLineParser (iObjectRegistry*);
00135
00141 static iConfigManager* CreateConfigManager (iObjectRegistry*);
00142
00149 static bool CreateInputDrivers (iObjectRegistry*);
00150
00155 static bool SetupCommandLineParser (
00156 iObjectRegistry*, int argc, const char* const argv[]);
00157
00164 static bool SetupConfigManager (iObjectRegistry*, const char* configName);
00165
00176 static bool RequestPlugins (iObjectRegistry*, ...);
00177
00182 static bool OpenApplication (iObjectRegistry*);
00183
00187 static void CloseApplication (iObjectRegistry*);
00188
00197 static bool SetupEventHandler (
00198 iObjectRegistry*, iEventHandler*, unsigned int eventmask);
00199
00206 static bool SetupEventHandler (
00207 iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask =
00208 CSMASK_Nothing |
00209 CSMASK_Broadcast |
00210 CSMASK_MouseUp |
00211 CSMASK_MouseDown |
00212 CSMASK_MouseMove |
00213 CSMASK_KeyDown |
00214 CSMASK_KeyUp |
00215 CSMASK_MouseClick |
00216 CSMASK_MouseDoubleClick |
00217 CSMASK_JoystickMove |
00218 CSMASK_JoystickDown |
00219 CSMASK_JoystickUp);
00220
00226 static void DestroyApplication (iObjectRegistry*);
00227 };
00228
00229 #endif // __CSINITAPP_H__