note on how to import contants
[sdlgit/SDL-Site.git] / pages / SDL.html-inc
1 <div class="pod">
2 <!-- INDEX START -->
3 <h3 id="TOP">Index</h3>
4
5 <ul><li><a href="#NAME">NAME</a>
6 <ul><li><a href="#CATEGORY">CATEGORY</a></li>
7 </ul>
8 </li>
9 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
10 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
11 <li><a href="#The_SDL_Perl_2009_Development_Team">The SDL Perl 2009 Development Team</a>
12 <ul><li><a href="#Documentation">Documentation</a></li>
13 <li><a href="#Perl_Development">Perl Development</a></li>
14 <li><a href="#Maintainance">Maintainance </a></li>
15 </ul>
16 </li>
17 <li><a href="#MacOSX_Experimental_Usage">MacOSX Experimental Usage</a>
18 <ul><li><a href="#Running_SDL_Perl_Scripts_in_MacOSX">Running SDL Perl Scripts in MacOSX</a></li>
19 </ul>
20 </li>
21 <li><a href="#Functions_exported_by_SDL_pm">Functions exported by SDL.pm</a>
22 <ul><li><a href="#init_flags">init(flags) </a></li>
23 <li><a href="#init_subsystem_flags">init_subsystem(flags)</a></li>
24 <li><a href="#quit_subsystem_flags">quit_subsystem(flags)</a></li>
25 <li><a href="#quit">quit</a></li>
26 <li><a href="#was_init_flags">was_init(flags)</a></li>
27 <li><a href="#get_error">get_error()</a></li>
28 <li><a href="#set_error_real_error_values">set_error_real(error, @values)  </a></li>
29 <li><a href="#error_code_need_to_be_coded">error(code) * need to be coded</a></li>
30 <li><a href="#clear_error">clear_error() </a></li>
31 <li><a href="#load_object">load_object()</a></li>
32 <li><a href="#load_function">load_function()</a></li>
33 <li><a href="#unload_object">unload_object()</a></li>
34 <li><a href="#VERSION">VERSION()</a></li>
35 <li><a href="#version">version()</a></li>
36 <li><a href="#linked_version">linked_version</a></li>
37 <li><a href="#get_error-2">get_error()</a></li>
38 <li><a href="#delay_ms">delay(ms)</a></li>
39 </ul>
40 </li>
41 <li><a href="#AUTHORS">AUTHORS</a>
42 </li>
43 </ul><hr />
44 <!-- INDEX END -->
45
46 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
47 <div id="NAME_CONTENT">
48 <p>SDL - Simple DirectMedia Layer for Perl</p>
49
50 </div>
51 <h2 id="CATEGORY">CATEGORY</h2>
52 <div id="CATEGORY_CONTENT">
53 <p>Core</p>
54
55 </div>
56 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
57 <div id="SYNOPSIS_CONTENT">
58 <pre>  use SDL;
59
60 </pre>
61
62 </div>
63 <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
64 <div id="DESCRIPTION_CONTENT">
65 <p>SDL_perl is a package of perl modules that provides both functional and object orient
66 interfaces to the Simple DirectMedia Layer for Perl 5.  This package does take some
67 liberties with the SDL API, and attempts to adhere to the spirit of both the SDL
68 and Perl.  This document describes the low-level functional SDL_perl API.  For the
69 object oriented programming interface please see the documentation provided on a
70 per class basis.</p>
71
72 </div>
73 <h1 id="The_SDL_Perl_2009_Development_Team">The SDL Perl 2009 Development Team</h1><p><a href="#TOP" class="toplink">Top</a></p>
74 <div id="The_SDL_Perl_2009_Development_Team_C">
75
76 </div>
77 <h2 id="Documentation">Documentation</h2>
78 <div id="Documentation_CONTENT">
79 <pre>   Nick: magnet
80
81 </pre>
82
83 </div>
84 <h2 id="Perl_Development">Perl Development</h2>
85 <div id="Perl_Development_CONTENT">
86 <pre>   Nick: Garu
87         Name: Breno G. de Oliveira
88
89         Nick: Dngor
90         Name: Rocco Caputo
91
92         Nick: nferraz
93         Name: Nelson Ferraz
94
95         Nick: acme
96         Name: Leon Brocard
97
98         Nick: FROGGS
99         Name: Tobias Leich
100
101 </pre>
102
103 </div>
104 <h2 id="Maintainance">Maintainance </h2>
105 <div id="Maintainance_CONTENT">
106 <pre>   Nick: kthakore
107         Name: Kartik Thakore
108
109 </pre>
110
111 </div>
112 <h1 id="MacOSX_Experimental_Usage">MacOSX Experimental Usage</h1><p><a href="#TOP" class="toplink">Top</a></p>
113 <div id="MacOSX_Experimental_Usage_CONTENT">
114 <p>Please get libsdl packages from Fink</p>
115 <pre>   perl Build.PL
116         perl Build test
117         perl Build bundle
118         perl Build install
119
120 </pre>
121
122 </div>
123 <h2 id="Running_SDL_Perl_Scripts_in_MacOSX">Running SDL Perl Scripts in MacOSX</h2>
124 <div id="Running_SDL_Perl_Scripts_in_MacOSX_C">
125 <p>First set the PERL5LIB environment variable to the dependencies of your script</p>
126 <pre>   %export PERL5LIB=$PERL5LIB:./lib
127
128 </pre>
129 <p>Use the SDLPerl executable made in the bundle and call your scripts</p>
130 <pre>   %SDLPerl.app/Contents/MacOS/SDLPerl yourScript.pl
131
132 </pre>
133
134 </div>
135 <h1 id="Functions_exported_by_SDL_pm">Functions exported by SDL.pm</h1><p><a href="#TOP" class="toplink">Top</a></p>
136 <div id="Functions_exported_by_SDL_pm_CONTENT">
137
138 </div>
139 <h2 id="init_flags">init(flags) </h2>
140 <div id="init_flags_CONTENT">
141 <p>As with the C language API, SDL_perl initializes the SDL environment through
142 the <code>SDL::init</code> subroutine. This routine takes a mode flag constructed through
143 the bitwise OR product of the SDL_INIT_* constants.</p>
144 <p>The constants are not exported by default. You can export them into your namespace by doing:</p>
145 <pre> use SDL ':all';
146
147 </pre>
148 <p>or access them directly:</p>
149 <pre> SDL::SDL_INIT_AUDIO;
150
151 </pre>
152 <dl>
153         <dt>*
154 SDL_INIT_AUDIO</dt>
155         <dt>*
156 SDL_INIT_VIDEO</dt>
157         <dt>*
158 SDL_INIT_CDROM</dt>
159         <dt>*
160 SDL_INIT_EVERYTHING</dt>
161         <dt>*
162 SDL_INIT_NOPARACHUTE</dt>
163         <dt>*
164 SDL_INIT_JOYSTICK</dt>
165         <dt>*
166 SDL_INIT_TIMER</dt>
167 </dl>
168 <p><code>SDL::Init</code> returns 0 on success, or -1 on error.</p>
169
170 </div>
171 <h2 id="init_subsystem_flags">init_subsystem(flags)</h2>
172 <div id="init_subsystem_flags_CONTENT">
173 <p>After SDL has been initialized with SDL::init you may initialize uninitialized subsystems with SDL::init_subsystem.
174 The flags parameter is the same as that used in SDL::init. </p>
175 <p>SDL::init_subsystem returns 0 on success, or -1 on error.</p>
176
177 </div>
178 <h2 id="quit_subsystem_flags">quit_subsystem(flags)</h2>
179 <div id="quit_subsystem_flags_CONTENT">
180 <p>SDL::quit_subsystem allows you to shut down a subsystem that has been previously initialized by SDL::init or SDL::init_subsystem.
181 The flags tells SDL::quit_subSystem which subsystems to shut down, it uses the same values that are passed to SDL::init. </p>
182 <p>SDL::quit_subsystem doesn't returns any value.</p>
183
184 </div>
185 <h2 id="quit">quit</h2>
186 <div id="quit_CONTENT">
187 <p>Shuts down all SDL subsystems, unloads the dynamically linked library and frees the allocated resources.</p>
188 <p><strong>Note</strong>: This will be called automatically when perl exits. You don't need to call this, except you want to initialize SDL after this again.</p>
189 <p>SDL::quit doesn't returns any value.</p>
190
191 </div>
192 <h2 id="was_init_flags">was_init(flags)</h2>
193 <div id="was_init_flags_CONTENT">
194 <p>SDL::was_init allows you to see which SDL subsytems have been initialized.
195 flags is a bitwise OR'd combination of the subsystems you wish to check (see SDL::init for a list of subsystem flags). 
196 If 'flags' is 0 or SDL_INIT_EVERYTHING, it returns a mask of all initialized subsystems (this does not include SDL_INIT_EVENTTHREAD or SDL_INIT_NOPARACHUTE).</p>
197
198
199
200
201
202 </div>
203 <h2 id="get_error">get_error()</h2>
204 <div id="get_error_CONTENT">
205 <p>The last error message set by the SDL library can be retrieved using the subroutine
206 <code>SDL::get_error</code>, which returns a scalar containing the text of the message if any.</p>
207
208 </div>
209 <h2 id="set_error_real_error_values">set_error_real(error, @values)  </h2>
210 <div id="set_error_real_error_values_CONTENT">
211 <p>SDL::get_error sets the SDL error to a printf style formatted string. 
212 it doesn't returns any values.</p>
213
214 </div>
215 <h2 id="error_code_need_to_be_coded">error(code) * need to be coded</h2>
216 <div id="error_code_need_to_be_coded_CONTENT">
217 <p>Sets the SDL error message to one of several predefined strings specified by code. </p>
218 <p>code can be :</p>
219 <dl>
220         <dt>SDL_errorcode</dt>
221         <dd>
222                 <p>The corresponding error string</p>
223         </dd>
224         <dt>SDL_ENOMEM</dt>
225         <dd>
226                 <p>Out of memory</p>
227         </dd>
228         <dt>SDL_EFREAD</dt>
229         <dd>
230                 <p>Error reading from datastream</p>
231         </dd>
232         <dt>SDL_EFWRITE</dt>
233         <dd>
234                 <p>Error writing to datastream</p>
235         </dd>
236         <dt>SDL_EFSEEK</dt>
237         <dd>
238                 <p>Error seeking in datastream</p>
239         </dd>
240         <dt>SDL_UNSUPPORTED</dt>
241         <dd>
242                 <p>Unknown SDL error</p>
243         </dd>
244         <dt>SDL_LASTERROR</dt>
245         <dd>
246                 <p>Unknown SDL error</p>
247         </dd>
248         <dt>any other value</dt>
249         <dd>
250                 <p>Unknown SDL error</p>
251         </dd>
252 </dl>
253 <p>Note 1: SDL_LASTERROR marks the highest numbered predefined error.
254 Note 2: SDL also defines SDL_OutOfMemory() and SDL_Unsupported() for internal use
255 which are equivalent to SDL_Error(SDL_ENOMEM) and SDL_Error(SDL_UNSUPPORTED) respectively. </p>
256 <p>SDL::Error doesn't returns any value.</p>
257
258
259
260
261
262 </div>
263 <h2 id="clear_error">clear_error() </h2>
264 <div id="clear_error_CONTENT">
265 <p>SDL::clear_error deletes all information about the last internal SDL error. Useful if the error has been handled by the program.
266 it doesn't returns any value.</p>
267
268 </div>
269 <h2 id="load_object">load_object()</h2>
270 <div id="load_object_CONTENT">
271 <p>Need to be coded.</p>
272
273 </div>
274 <h2 id="load_function">load_function()</h2>
275 <div id="load_function_CONTENT">
276 <p>Need to be coded.</p>
277
278 </div>
279 <h2 id="unload_object">unload_object()</h2>
280 <div id="unload_object_CONTENT">
281 <p>Need to be coded.</p>
282
283 </div>
284 <h2 id="VERSION">VERSION()</h2>
285 <div id="VERSION_CONTENT">
286 <p>Need to be coded. </p>
287
288 </div>
289 <h2 id="version">version()</h2>
290 <div id="version_CONTENT">
291 <p>Need to be coded.</p>
292
293 </div>
294 <h2 id="linked_version">linked_version</h2>
295 <div id="linked_version_CONTENT">
296 <p>Need to be coded.</p>
297
298 </div>
299 <h2 id="get_error-2">get_error()</h2>
300 <div id="get_error_CONTENT-2">
301 <p>The last error message set by the SDL library can be retrieved using the subroutine
302 <code>SDL::get_error</code>, which returns a scalar containing the text of the message if any.</p>
303
304 </div>
305 <h2 id="delay_ms">delay(ms)</h2>
306 <div id="delay_ms_CONTENT">
307 <p>This subroutine allows an application to delay further operations for atleast a
308 number of milliseconds provided as the argument.  The actual delay may be longer
309 than the specified depending on the underlying OS.</p>
310
311
312
313
314
315 </div>
316 <h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
317 <div id="AUTHORS_CONTENT">
318 <p>magnet, kthakore</p>
319
320
321
322
323
324 </div>
325 </div>