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
00045
00046 #define CS_REQUEST_PLUGIN(Name,Interface) \
00047 Name, #Interface, iSCF::SCF->GetInterfaceID(#Interface), Interface##_VERSION
00048
00049 #define CS_REQUEST_END \
00050 NULL
00051
00052 #define CS_REQUEST_VFS \
00053 CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS)
00054
00055 #define CS_REQUEST_FONTSERVER \
00056 CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer)
00057
00058 #define CS_REQUEST_IMAGELOADER \
00059 CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplex", iImageIO)
00060
00061 #define CS_REQUEST_NULL3D \
00062 CS_REQUEST_PLUGIN("crystalspace.graphics3d.null",iGraphics3D)
00063
00064 #define CS_REQUEST_SOFTWARE3D \
00065 CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D)
00066
00067 #define CS_REQUEST_OPENGL3D \
00068 CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D)
00069
00070 #define CS_REQUEST_ENGINE \
00071 CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine)
00072
00073 #define CS_REQUEST_LEVELLOADER \
00074 CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader)
00075
00076 #define CS_REQUEST_LEVELSAVER \
00077 CS_REQUEST_PLUGIN("crystalspace.level.saver", iSaver)
00078
00079 #define CS_REQUEST_REPORTER \
00080 CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter)
00081
00082 #define CS_REQUEST_REPORTERLISTENER \
00083 CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener)
00084
00085 #define CS_REQUEST_CONSOLEOUT \
00086 CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput)
00087
00092 typedef bool (*csEventHandlerFunc) (iEvent&);
00093
00099 class csInitializer
00100 {
00101 public:
00119 static iObjectRegistry* CreateEnvironment(int argc, char const* const argv[]);
00120
00125 static bool InitializeSCF ();
00126
00132 static iObjectRegistry* CreateObjectRegistry ();
00133
00140 static iPluginManager* CreatePluginManager (iObjectRegistry*);
00141
00148 static iEventQueue* CreateEventQueue (iObjectRegistry*);
00149
00156 static iVirtualClock* CreateVirtualClock (iObjectRegistry*);
00157
00163 static iCommandLineParser* CreateCommandLineParser (
00164 iObjectRegistry*, int argc, char const* const argv[]);
00165
00171 static iConfigManager* CreateConfigManager (iObjectRegistry*);
00172
00179 static bool CreateInputDrivers (iObjectRegistry*);
00180
00189 static bool SetupConfigManager (iObjectRegistry*, const char* configName,
00190 const char *ApplicationID = "Noname");
00191
00202 static bool RequestPlugins (iObjectRegistry*, ...);
00203
00208 static bool OpenApplication (iObjectRegistry*);
00209
00213 static void CloseApplication (iObjectRegistry*);
00214
00223 static bool SetupEventHandler (
00224 iObjectRegistry*, iEventHandler*, unsigned int eventmask);
00225
00232 static bool SetupEventHandler (
00233 iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask =
00234 CSMASK_Nothing |
00235 CSMASK_Broadcast |
00236 CSMASK_MouseUp |
00237 CSMASK_MouseDown |
00238 CSMASK_MouseMove |
00239 CSMASK_KeyDown |
00240 CSMASK_KeyUp |
00241 CSMASK_MouseClick |
00242 CSMASK_MouseDoubleClick |
00243 CSMASK_JoystickMove |
00244 CSMASK_JoystickDown |
00245 CSMASK_JoystickUp);
00246
00252 static void DestroyApplication (iObjectRegistry*);
00253 };
00254
00257 #endif // __CS_INITAPP_H__