CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

cstool/initapp.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 1998-2001 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_INITAPP_H__
00020 #define __CS_INITAPP_H__
00021 
00030 #include "cstypes.h"
00031 #include "csutil/array.h"
00032 #include "csutil/csstring.h"
00033 #include "csutil/scf.h"
00034 #include "iutil/evdefs.h"
00035 
00036 struct iObjectRegistry;
00037 struct iEvent;
00038 struct iEventHandler;
00039 struct iEventQueue;
00040 struct iPluginManager;
00041 struct iVirtualClock;
00042 struct iCommandLineParser;
00043 struct iConfigManager;
00044 struct iVFS;
00045 
00049 
00050 #define CS_REQUEST_PLUGIN(Name,Interface) Name, #Interface, \
00051   scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion()
00052 
00053 #define CS_REQUEST_END \
00054   0
00055 
00056 #define CS_REQUEST_VFS \
00057   CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS)
00058 
00059 #define CS_REQUEST_FONTSERVER \
00060   CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer)
00061 
00062 #define CS_REQUEST_IMAGELOADER \
00063   CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplex", iImageIO)
00064 
00065 #define CS_REQUEST_NULL3D \
00066   CS_REQUEST_PLUGIN("crystalspace.graphics3d.null",iGraphics3D)
00067 
00068 #define CS_REQUEST_SOFTWARE3D \
00069   CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D)
00070 
00071 #define CS_REQUEST_OPENGL3D \
00072   CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D)
00073 
00074 #define CS_REQUEST_ENGINE \
00075   CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine)
00076 
00077 #define CS_REQUEST_LEVELLOADER \
00078   CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader)
00079 
00080 #define CS_REQUEST_LEVELSAVER \
00081   CS_REQUEST_PLUGIN("crystalspace.level.saver", iSaver)
00082 
00083 #define CS_REQUEST_REPORTER \
00084   CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter)
00085 
00086 #define CS_REQUEST_REPORTERLISTENER \
00087   CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener)
00088 
00089 #define CS_REQUEST_CONSOLEOUT \
00090   CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput)
00091 
00096 typedef bool (*csEventHandlerFunc) (iEvent&);
00097 
00098 
00109 class csPluginRequest
00110 {
00111 private:
00112   csString class_name;
00113   csString interface_name;
00114   scfInterfaceID interface_id;
00115   int interface_version;
00116   void set(csPluginRequest const&);
00117 public:
00118   csPluginRequest(csString class_name, csString interface_name,
00119     scfInterfaceID interface_id, int interface_version);
00120   csPluginRequest(csPluginRequest const& r) { set(r); }
00121   csPluginRequest& operator=(csPluginRequest const& r) {set(r); return *this;}
00122   bool operator==(csPluginRequest const&) const;
00123   bool operator!=(csPluginRequest const& r) const { return !operator==(r); }
00124   csString GetClassName() const { return class_name; }
00125   csString GetInterfaceName() const { return interface_name; }
00126   scfInterfaceID GetInterfaceID() const { return interface_id; }
00127   int GetInterfaceVersion() const { return interface_version; }
00128 };
00129 
00130 
00136 class csInitializer
00137 {
00138 public:
00166   static iObjectRegistry* CreateEnvironment(int argc, char const* const argv[]);
00167 
00172   static bool InitializeSCF (int argc, char const* const argv[]);
00173 
00179   static iObjectRegistry* CreateObjectRegistry ();
00180 
00187   static iPluginManager* CreatePluginManager (iObjectRegistry*);
00188 
00195   static iEventQueue* CreateEventQueue (iObjectRegistry*);
00196 
00203   static iVirtualClock* CreateVirtualClock (iObjectRegistry*);
00204 
00210   static iCommandLineParser* CreateCommandLineParser (
00211     iObjectRegistry*, int argc, char const* const argv[]);
00212 
00218   static iConfigManager* CreateConfigManager (iObjectRegistry*);
00219 
00226   static bool CreateInputDrivers (iObjectRegistry*);
00227 
00237   static bool CreateStringSet (iObjectRegistry*);
00238 
00250   static bool SetupConfigManager (iObjectRegistry*, const char* configName,
00251     const char *ApplicationID = "CrystalSpace.Noname");
00252 
00264   static iVFS* SetupVFS(iObjectRegistry* objectReg, 
00265           const char* pluginID = "crystalspace.kernel.vfs");
00266 
00278   static bool RequestPlugins (iObjectRegistry*, ...);
00279 
00299   static bool RequestPlugins(iObjectRegistry*,csArray<csPluginRequest> const&);
00300 
00305   static bool OpenApplication (iObjectRegistry*);
00306 
00310   static void CloseApplication (iObjectRegistry*);
00311 
00320   static bool SetupEventHandler (
00321     iObjectRegistry*, iEventHandler*, unsigned int eventmask);
00322 
00329   static bool SetupEventHandler (
00330     iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask =
00331       CSMASK_Nothing          |
00332       CSMASK_Broadcast        |
00333       CSMASK_MouseUp          |
00334       CSMASK_MouseDown        |
00335       CSMASK_MouseMove        |
00336       CSMASK_Keyboard         |
00337       CSMASK_MouseClick       |
00338       CSMASK_MouseDoubleClick |
00339       CSMASK_JoystickMove     |
00340       CSMASK_JoystickDown     |
00341       CSMASK_JoystickUp);
00342 
00371   static void DestroyApplication (iObjectRegistry*);
00372 };
00373 
00376 #endif // __CS_INITAPP_H__

Generated for Crystal Space by doxygen 1.2.18