In file include/cssys/common/system.h:

## class csSystemDriver

> This is the interface to operating system

## Inheritance:

### Public Fields

IConfig* cfg_engine
  Interface for the engine configuration values.
csColOption* com_options
  List of all options for all COM modules.
csConsole* Console
  System console
static int debug_level
  Debugging level (0 = no debug, 1 = normal debug, 2 = verbose debug)
static bool DemoReady
  true if demo console is ready
int Depth
  the bits-per-pixel of the display.
csEventQueue* EventQueue
  Program event queue
static bool ExitLoop
  Same as Shutdown but set manually by windowing system
int FrameHeight
  the height of this frame
int FrameWidth
  the width of this frame
bool FullScreen
  whether this device is full-screen or not.
bool IsFocused
  true if CrystalSpace visual is active (focused)
csKeyboardDriver* Keyboard
  Keyboard driver
csMouseDriver* Mouse
  Mouse driver
IGraphics2D* piG2D
  2D Graphics context
IGraphics3D* piG3D
  3D Graphics context
IGraphicsInfo* piGI
  Graphics info context
INetworkDriver* piNetDrv
  Network driver
INetworkManager* piNetMan
  Network manager
ISoundRender* piSound
  Sound render
static bool Shutdown
  Set to non-zero to exit csSystemDriver::Loop()

### Public Methods

virtual void Close()
  Close the system
csSystemDriver()
  Initialize system-dependent data
static void debugprintf(bool flush, const char* str, ...)
  Print a string into debug.txt
static FILE* fopen(const char* filename, const char* mode)
  Open a file
virtual void Help()
  This is a function that prints the commandline help text
virtual bool InitGraphics()
  Initialize 3D Graphics context object
virtual bool Initialize(int argc, char *argv[], IConfig* cfg_engine)
  This is usually called right after object creation
virtual bool InitKeyboard()
  Initialize Keyboard object
virtual bool InitMouse()
  Initialize Mouse object
virtual bool InitNetwork()
  Initialize Network system
virtual bool InitSound()
  Initialize Sound system
virtual void Loop()
  System loop
virtual void NextFrame(long elapsed_time, long current_time)
  SysSystemDriver::Loop should call this method once per frame
virtual bool Open(char *Title)
  Open the graphics context (with optional title on titlebar), mouse and keyboard
bool ParseCmdLine(int argc, char* argv[])
  This is a system-independent function used to parse a commandline
bool ParseCmdLineDriver(int argc, char* argv[])
  This version is supposed to be called first and will search all driver options on the commandline
static void Printf(int mode, const char* str, ...)
  General printf routine
static void printf_init()
  Printf version that works on all systems
virtual void SetSystemDefaults()
  System dependent function to set all system defaults (like the default resolution, if SHM is used or not (only for X), and so on
virtual void Sleep(int )
  Sleep for given number of 1/1000 seconds (very inacurate)
static long Time()
  Return time in milliseconds (if not supported by a system just return the time in seconds multiplied by 1000)
virtual ~csSystemDriver()
  Deinitialize system-dependent parts

### Protected Methods

virtual void Alert(const char* msg)
  Show an alert
csColOption* CollectOptions(IConfig* config, csColOption* already_collected)
  Collect all options for a IConfig interface
virtual void DemoWrite(const char* msg)
  Write a message on the display in demo mode (used by Printf with mode MSG_INITIALIZATION)
void do_focus(int enable)
  System-dependent code should call this to emit 'focus changed' events
void Help(IConfig* piConf)
  Print help for an IConfig interface
virtual bool ParseArg(int argc, char* argv[], int& i)
  This is a system-dependent function which eats a single command-line option (like -help,
virtual bool ParseArgDriver(int argc, char* argv[], int& i)
  This is a system-dependent function which eats a single command-line option for drivers
void SetMode(const char* mode)
  This is a system independent function that just initilizes FRAME_WIDTH and FRAME_HEIGHT from the given mode string
virtual void Warn(const char* msg)
  Show a warning

## Documentation

> This is the interface to operating system.

> This driver takes care of all system-dependent parts such as video hardware and input hardware. Note that system-dependent source code should NOT write implementations for methods of csSystemDriver (they are already implemented in system.cpp), but inherit a new class from csSystemDriver, overriding desired methods. Note that some methods it is required to override, otherwise program simply will not compile (they are marked as abstract).

`ISoundRender* piSound`
  Sound render

`csEventQueue* EventQueue`
  Program event queue

`INetworkDriver* piNetDrv`
  Network driver

`INetworkManager* piNetMan`
  Network manager

`IGraphics3D* piG3D`
  3D Graphics context

`IGraphics2D* piG2D`
  2D Graphics context

`IGraphicsInfo* piGI`
  Graphics info context

`int FrameWidth`
  the width of this frame

`int FrameHeight`
  the height of this frame

`bool FullScreen`
  whether this device is full-screen or not.

`int Depth`
  the bits-per-pixel of the display.

`csKeyboardDriver* Keyboard`
  Keyboard driver

`csMouseDriver* Mouse`
  Mouse driver

`static bool Shutdown`
  Set to non-zero to exit csSystemDriver::Loop()

`static bool ExitLoop`
  Same as Shutdown but set manually by windowing system

`csConsole* Console`
  System console

`IConfig* cfg_engine`
  Interface for the engine configuration values.

`static int debug_level`
  Debugging level (0 = no debug, 1 = normal debug, 2 = verbose debug)

`static bool DemoReady`
  true if demo console is ready

`bool IsFocused`
  true if CrystalSpace visual is active (focused)

`csColOption* com_options`
  List of all options for all COM modules.

`csSystemDriver()`
  Initialize system-dependent data

`virtual ~csSystemDriver()`
  Deinitialize system-dependent parts

`virtual bool Initialize(int argc, char *argv[], IConfig* cfg_engine)`
  This is usually called right after object creation. 'cfg_engine' is an instance of IConfig for the engine settings.

`virtual bool InitGraphics()`
  Initialize 3D Graphics context object

`virtual bool InitKeyboard()`
  Initialize Keyboard object

`virtual bool InitMouse()`
  Initialize Mouse object

`virtual bool InitSound()`
  Initialize Sound system

`virtual bool InitNetwork()`
  Initialize Network system

`virtual bool Open(char *Title)`
  Open the graphics context (with optional title on titlebar), mouse and keyboard

`virtual void Close()`
  Close the system

`virtual void Loop()`
  System loop. This should be called last since it returns only on program exit

`virtual void NextFrame(long elapsed_time, long current_time)`
  SysSystemDriver::Loop should call this method once per frame. 'elapsed_time' is the time elapsed since the previous call to NextFrame. 'current_time' is a global time counter. The time is expressed in milliseconds.

`virtual void Sleep(int )`
  Sleep for given number of 1/1000 seconds (very inacurate)

`virtual void SetSystemDefaults()`
  System dependent function to set all system defaults (like the default resolution, if SHM is used or not (only for X), and so on...).

  This routine can also make use of the config file to get the defaults from there (so instead of having to specify -mode 640x480 everytime you can set this in the config file and this routine should read that).

`bool ParseCmdLine(int argc, char* argv[])`
  This is a system-independent function used to parse a commandline. It will iterate all command-line arguments through system-dependent ParsArg() method.

`bool ParseCmdLineDriver(int argc, char* argv[])`
  This version is supposed to be called first and will search all driver options on the commandline. This allows the system to open the drivers first and only then start parsing the rest of the options.

`virtual void Help()`
  This is a function that prints the commandline help text. If system has system-dependent switches, it should override this method and type its own text (possibly invoking csSystemDriver::Help() first).

`static long Time()`
  Return time in milliseconds (if not supported by a system just return the time in seconds multiplied by 1000). Default implementation is in 'def_sys'.

`static void Printf(int mode, const char* str, ...)`
  General printf routine. This routine should eventually replace all other variants of printf that exist in Crystal Space. 'mode' is any of the MSG_... fields as defined above.

`static void debugprintf(bool flush, const char* str, ...)`
  Print a string into debug.txt

`static void printf_init()`
  Printf version that works on all systems. Default implementation is in 'def_sys'.

`static FILE* fopen(const char* filename, const char* mode)`
  Open a file. This function first translates the directory separator ('/' is used here) to whatever the system uses and after that passes control to 'fopen'. Default implementation of first function is in 'def_sys'.

`virtual bool ParseArg(int argc, char* argv[], int& i)`
  This is a system-dependent function which eats a single command-line option (like -help, ...). If system-dependent part does not recognize the option, it should pass it to its parent class method. Return false if error detected.

`virtual bool ParseArgDriver(int argc, char* argv[], int& i)`
  This is a system-dependent function which eats a single command-line option for drivers

`void Help(IConfig* piConf)`
  Print help for an IConfig interface

`csColOption* CollectOptions(IConfig* config, csColOption* already_collected)`
  Collect all options for a IConfig interface

`virtual void Alert(const char* msg)`
  Show an alert. This function is called by csPrintf and should show an alert in case of an error. The default implementation writes the message in debug.txt and on standard output.

`virtual void Warn(const char* msg)`
  Show a warning. This function is called by csPrintf and should show an alert in case of a warning. The default implementation writes a message in debug.txt and on standard output.

`virtual void DemoWrite(const char* msg)`
  Write a message on the display in demo mode (used by Printf with mode MSG_INITIALIZATION). The default implementation just uses the console.

`void SetMode(const char* mode)`
  This is a system independent function that just initilizes FRAME_WIDTH and FRAME_HEIGHT from the given mode string

`void do_focus(int enable)`
  System-dependent code should call this to emit 'focus changed' events. Initially system assumes that CrystalSpace window is active.

Direct child classes:
  SysSystemDriver
  SysSystemDriver
  SysSystemDriver
  SysSystemDriver
  SysSystemDriver
  SysSystemDriver

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de