File: cs_130.html

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (184 lines) | stat: -rw-r--r-- 6,916 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!-- 
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
 
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: csSys</TITLE>

<META NAME="description" CONTENT="Crystal Space: csSys">
<META NAME="keywords" CONTENT="Crystal Space: csSys">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">

</HEAD>

<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC292"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_129.html#SEC291"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_131.html#SEC294"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_159.html#SEC338"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H2> 6.2 System Library (<CODE>csSys</CODE>) </H2>
<!--docid::SEC292::-->
<P>

The system library is the basic module in every Crystal Space application. It
contains one main class, the <EM>system driver</EM>. This driver helps in
several ways:
</P><P>

WARNING! The system library is currently being eliminated. Soon the
information here will be outdated (and then rewritten).
</P><P>

<UL>
<LI>
It handles the main system-specific operations, like loading dynamic libraries
for SCF (see section <A HREF="cs_134.html#SEC297">6.4 Shared Class Facility (SCF)</A>).  So using it will make most of your application
system-independent.
<P>

<LI>
It tries to find global installations of the Crystal Space run-time libraries.
<P>

<LI>
It provides the input drivers, so you can access mouse, keyboard and
joystick.
<P>

<LI>
It loads and initializes the plug-ins (using SCF) and sends them their
private and broadcast events.
<P>

<LI>
It keeps a log file and provides functions for printing debugging messages,
warnings, and errors.
<P>

<LI>
It keeps track of the application's configuration file and automatically reads
all options required by the system or any plug-in.
<P>

<LI>
It processes the command-line parameters and also allows plug-in modules to
react to the parameters.
<P>

<LI>
It calls additional startup and shutdown functions of some basic plug-in
modules, called the <EM>drivers</EM>.
<P>

<LI>
All these methods are <EM>virtual</EM> methods, so you can override them.
</UL>
<P>

<A NAME="SEC293"></A>
<H3> How to Use the System Driver </H3>
<!--docid::SEC293::-->
<P>

The system driver is explicitly designed to be a superclass for your own system
driver class.  In particular, the <CODE>NextFrame()</CODE> and <CODE>HandleEvent()</CODE>
methods are generally overridden by most applications.
</P><P>

The system driver class is named `<SAMP>SysSystemDriver</SAMP>'. This class contains
all system-specific functions. It is, itself, a subclass of
`<SAMP>csSystemDriver</SAMP>', which contains the system-independent stuff.
</P><P>

A typical application would perform the following steps:
</P><P>

<UL>
<LI>
Create an instance of its subclass of `<SAMP>SysSystemDriver</SAMP>'.
<P>

<LI>
Call <CODE>System-&#62;Initialize()</CODE>. This will process the command-line, load
and initialize the plug-in modules and open the main configuration file.
<P>

<LI>
Load all application-specific data. You can, of course, load additional stuff
later, but if an error occurs (e.g. an important file is missing), the user
does not have to wait until complete start-up to see this error.
<P>

<LI>
Call <CODE>System-&#62;Open()</CODE>.  This will <EM>open</EM> the plug-in modules.  The
exact meaning of this operation is specific to each plug-in.  For instance, a
graphics-related module might change the graphics mode; a sound-related module
might enable sound output; and an input-related module might enable keyboard
processing.
<P>

Any events triggered by these drivers will be sent to your application via the
<CODE>HandleEvent()</CODE> function. If you override this function, you must still
call the old function.
</P><P>

<LI>
Call <CODE>System-&#62;Loop()</CODE>.  This function will only return when your program
exits the main event loop.  Of course you can control when this happens, and
you can restart the loop later, but for most applications exiting the main loop
means exiting the application.
<P>

Once you have entered this loop, the system driver will call the
<CODE>NextFrame()</CODE> method every frame. This happens at irregular time steps,
so you should use the <CODE>GetElapsedTime()</CODE> function to see how much time
has passed.
</P><P>

<LI>
Close and delete the system driver. You don't have to call
<CODE>System-&#62;Close()</CODE> explicitly, as this will be done automatically when
you delete the object.
</UL>
<A NAME="csUtil"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_129.html#SEC291"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_131.html#SEC294"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_159.html#SEC338"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>  
<FONT SIZE="-1">
This document was generated

using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>

</BODY>
</HTML>