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 "csextern.h"
00031 
00032 #include "cstypes.h"
00033 #include "csutil/array.h"
00034 #include "csutil/csstring.h"
00035 #include "csutil/scf.h"
00036 #include "iengine/engine.h"
00037 #include "igraphic/imageio.h"
00038 #include "imap/loader.h"
00039 #include "imap/saver.h"
00040 #include "iutil/evdefs.h"
00041 #include "iutil/vfs.h"
00042 #include "ivaria/conout.h"
00043 #include "ivaria/reporter.h"
00044 #include "ivaria/stdrep.h"
00045 #include "ivideo/graph3d.h"
00046 #include "ivideo/fontserv.h"
00047 
00048 struct iObjectRegistry;
00049 struct iEvent;
00050 struct iEventHandler;
00051 struct iEventQueue;
00052 struct iPluginManager;
00053 struct iVirtualClock;
00054 struct iCommandLineParser;
00055 struct iConfigManager;
00056 
00060 
00061 #define CS_REQUEST_PLUGIN(Name,Interface) Name, #Interface, \
00062   scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion()
00063 
00064 // !!! NOTE !!!
00065 // When editing this list, you *must* ensure that initapp.h #include the
00066 // appropriate header for each SCF interface mentioned by a CS_REQUEST_PLUGIN()
00067 // invocation. This is necessary to guarantee that the interface-specialized
00068 // version of scfInterface<> is seen by clients rather than the non-specialized
00069 // template.
00070 
00072 #define CS_REQUEST_END \
00073   0
00074 
00075 #define CS_REQUEST_VFS \
00076   CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS)
00077 
00078 #define CS_REQUEST_FONTSERVER \
00079   CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer)
00080 
00081 #define CS_REQUEST_IMAGELOADER \
00082   CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplex", iImageIO)
00083 
00084 #define CS_REQUEST_NULL3D \
00085   CS_REQUEST_PLUGIN("crystalspace.graphics3d.null",iGraphics3D)
00086 
00087 #define CS_REQUEST_SOFTWARE3D \
00088   CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D)
00089 
00090 #define CS_REQUEST_OPENGL3D \
00091   CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D)
00092 
00093 #define CS_REQUEST_ENGINE \
00094   CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine)
00095 
00096 #define CS_REQUEST_LEVELLOADER \
00097   CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader)
00098 
00099 #define CS_REQUEST_LEVELSAVER \
00100   CS_REQUEST_PLUGIN("crystalspace.level.saver", iSaver)
00101 
00102 #define CS_REQUEST_REPORTER \
00103   CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter)
00104 
00105 #define CS_REQUEST_REPORTERLISTENER \
00106   CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener)
00107 
00108 #define CS_REQUEST_CONSOLEOUT \
00109   CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput)
00110 
00115 typedef bool (*csEventHandlerFunc) (iEvent&);
00116 
00117 
00128 class CS_CSTOOL_EXPORT csPluginRequest
00129 {
00130 private:
00131   csString class_name;
00132   csString interface_name;
00133   scfInterfaceID interface_id;
00134   int interface_version;
00135   void set(csPluginRequest const&);
00136 public:
00137   csPluginRequest(csString class_name, csString interface_name,
00138     scfInterfaceID interface_id, int interface_version);
00139   csPluginRequest(csPluginRequest const& r) { set(r); }
00140   csPluginRequest& operator=(csPluginRequest const& r) {set(r); return *this;}
00141   bool operator==(csPluginRequest const&) const;
00142   bool operator!=(csPluginRequest const& r) const { return !operator==(r); }
00143   csString GetClassName() const { return class_name; }
00144   csString GetInterfaceName() const { return interface_name; }
00145   scfInterfaceID GetInterfaceID() const { return interface_id; }
00146   int GetInterfaceVersion() const { return interface_version; }
00147 };
00148 
00149 
00155 class CS_CSTOOL_EXPORT csInitializer
00156 {
00157 public:
00185   static iObjectRegistry* CreateEnvironment(int argc, char const* const argv[]);
00186 
00191   static bool InitializeSCF (int argc, char const* const argv[]);
00192 
00198   static iObjectRegistry* CreateObjectRegistry ();
00199 
00206   static iPluginManager* CreatePluginManager (iObjectRegistry*);
00207 
00214   static iEventQueue* CreateEventQueue (iObjectRegistry*);
00215 
00222   static iVirtualClock* CreateVirtualClock (iObjectRegistry*);
00223 
00229   static iCommandLineParser* CreateCommandLineParser (
00230     iObjectRegistry*, int argc, char const* const argv[]);
00231 
00237   static iConfigManager* CreateConfigManager (iObjectRegistry*);
00238 
00245   static bool CreateInputDrivers (iObjectRegistry*);
00246 
00256   static bool CreateStringSet (iObjectRegistry*);
00257 
00269   static bool SetupConfigManager (iObjectRegistry*, const char* configName,
00270     const char *ApplicationID = "CrystalSpace.Noname");
00271 
00283   static iVFS* SetupVFS(iObjectRegistry* objectReg, 
00284           const char* pluginID = "crystalspace.kernel.vfs");
00285 
00297   static bool RequestPlugins (iObjectRegistry*, ...);
00298 
00318   static bool RequestPlugins(iObjectRegistry*,csArray<csPluginRequest> const&);
00319 
00324   static bool OpenApplication (iObjectRegistry*);
00325 
00329   static void CloseApplication (iObjectRegistry*);
00330 
00339   static bool SetupEventHandler (
00340     iObjectRegistry*, iEventHandler*, unsigned int eventmask);
00341 
00348   static bool SetupEventHandler (
00349     iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask =
00350       CSMASK_Nothing          |
00351       CSMASK_Broadcast        |
00352       CSMASK_MouseUp          |
00353       CSMASK_MouseDown        |
00354       CSMASK_MouseMove        |
00355       CSMASK_Keyboard         |
00356       CSMASK_MouseClick       |
00357       CSMASK_MouseDoubleClick |
00358       CSMASK_JoystickMove     |
00359       CSMASK_JoystickDown     |
00360       CSMASK_JoystickUp);
00361 
00390   static void DestroyApplication (iObjectRegistry*);
00391 };
00392 
00395 #endif // __CS_INITAPP_H__

Generated for Crystal Space by doxygen 1.2.18