00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CS_INITAPP_H__
00020 #define __CS_INITAPP_H__
00021
00030 #include "cstypes.h"
00031 #include "iutil/evdefs.h"
00032
00033 struct iObjectRegistry;
00034 struct iEvent;
00035 struct iEventHandler;
00036 struct iEventQueue;
00037 struct iPluginManager;
00038 struct iVirtualClock;
00039 struct iCommandLineParser;
00040 struct iConfigManager;
00041 struct iVFS;
00042
00046
00047 #define CS_REQUEST_PLUGIN(Name,Interface) \
00048 Name, #Interface, iSCF::SCF->GetInterfaceID(#Interface), Interface##_VERSION
00049
00050 #define CS_REQUEST_END \
00051 0
00052
00053 #define CS_REQUEST_VFS \
00054 CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS)
00055
00056 #define CS_REQUEST_FONTSERVER \
00057 CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer)
00058
00059 #define CS_REQUEST_IMAGELOADER \
00060 CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplex", iImageIO)
00061
00062 #define CS_REQUEST_NULL3D \
00063 CS_REQUEST_PLUGIN("crystalspace.graphics3d.null",iGraphics3D)
00064
00065 #define CS_REQUEST_SOFTWARE3D \
00066 CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D)
00067
00068 #define CS_REQUEST_OPENGL3D \
00069 CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D)
00070
00071 #define CS_REQUEST_ENGINE \
00072 CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine)
00073
00074 #define CS_REQUEST_LEVELLOADER \
00075 CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader)
00076
00077 #define CS_REQUEST_LEVELSAVER \
00078 CS_REQUEST_PLUGIN("crystalspace.level.saver", iSaver)
00079
00080 #define CS_REQUEST_REPORTER \
00081 CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter)
00082
00083 #define CS_REQUEST_REPORTERLISTENER \
00084 CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener)
00085
00086 #define CS_REQUEST_CONSOLEOUT \
00087 CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput)
00088
00093 typedef bool (*csEventHandlerFunc) (iEvent&);
00094
00100 class csInitializer
00101 {
00102 public:
00129 static iObjectRegistry* CreateEnvironment(int argc, char const* const argv[]);
00130
00135 static bool InitializeSCF (int argc, const char* const argv[]);
00136
00142 static iObjectRegistry* CreateObjectRegistry ();
00143
00150 static iPluginManager* CreatePluginManager (iObjectRegistry*);
00151
00158 static iEventQueue* CreateEventQueue (iObjectRegistry*);
00159
00166 static iVirtualClock* CreateVirtualClock (iObjectRegistry*);
00167
00173 static iCommandLineParser* CreateCommandLineParser (
00174 iObjectRegistry*, int argc, char const* const argv[]);
00175
00181 static iConfigManager* CreateConfigManager (iObjectRegistry*);
00182
00189 static bool CreateInputDrivers (iObjectRegistry*);
00190
00202 static bool SetupConfigManager (iObjectRegistry*, const char* configName,
00203 const char *ApplicationID = "CrystalSpace.Noname");
00204
00216 static iVFS* SetupVFS(iObjectRegistry* objectReg,
00217 const char* pluginID = "crystalspace.kernel.vfs");
00218
00229 static bool RequestPlugins (iObjectRegistry*, ...);
00230
00235 static bool OpenApplication (iObjectRegistry*);
00236
00240 static void CloseApplication (iObjectRegistry*);
00241
00250 static bool SetupEventHandler (
00251 iObjectRegistry*, iEventHandler*, unsigned int eventmask);
00252
00259 static bool SetupEventHandler (
00260 iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask =
00261 CSMASK_Nothing |
00262 CSMASK_Broadcast |
00263 CSMASK_MouseUp |
00264 CSMASK_MouseDown |
00265 CSMASK_MouseMove |
00266 CSMASK_KeyDown |
00267 CSMASK_KeyUp |
00268 CSMASK_MouseClick |
00269 CSMASK_MouseDoubleClick |
00270 CSMASK_JoystickMove |
00271 CSMASK_JoystickDown |
00272 CSMASK_JoystickUp);
00273
00279 static void DestroyApplication (iObjectRegistry*);
00280 };
00281
00284 #endif // __CS_INITAPP_H__