added GL attributes
[sdlgit/SDL-Site.git] / pages / SDL.html-inc
CommitLineData
162a0989 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
bfdd9c2e 5<ul><li><a href="#NAME">NAME</a>
6<ul><li><a href="#CATEGORY">CATEGORY</a></li>
7</ul>
8</li>
162a0989 9<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
10<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
162a0989 11<li><a href="#Functions_exported_by_SDL_pm">Functions exported by SDL.pm</a>
12<ul><li><a href="#init_flags">init(flags) </a></li>
13<li><a href="#init_subsystem_flags">init_subsystem(flags)</a></li>
14<li><a href="#quit_subsystem_flags">quit_subsystem(flags)</a></li>
15<li><a href="#quit">quit</a></li>
16<li><a href="#was_init_flags">was_init(flags)</a></li>
17<li><a href="#get_error">get_error()</a></li>
9b105a17 18<li><a href="#set_error_real_error_values">set_error_real(error, @values)</a></li>
19<li><a href="#clear_error">clear_error()</a></li>
162a0989 20<li><a href="#version">version()</a></li>
21<li><a href="#linked_version">linked_version</a></li>
22<li><a href="#get_error-2">get_error()</a></li>
ecabf8b7 23<li><a href="#delay_ms">delay(ms)</a></li>
162a0989 24</ul>
25</li>
096d8dc8 26<li><a href="#AUTHORS">AUTHORS</a>
ecabf8b7 27</li>
162a0989 28</ul><hr />
29<!-- INDEX END -->
30
31<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
32<div id="NAME_CONTENT">
879e3e79 33<p>SDL - Simple DirectMedia Layer for Perl</p>
162a0989 34
35</div>
bfdd9c2e 36<h2 id="CATEGORY">CATEGORY</h2>
37<div id="CATEGORY_CONTENT">
38<p>Core</p>
39
40</div>
162a0989 41<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
42<div id="SYNOPSIS_CONTENT">
a17227e6 43<pre> use SDL ':all';
162a0989 44
45</pre>
46
47</div>
48<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
49<div id="DESCRIPTION_CONTENT">
50<p>SDL_perl is a package of perl modules that provides both functional and object orient
51interfaces to the Simple DirectMedia Layer for Perl 5. This package does take some
52liberties with the SDL API, and attempts to adhere to the spirit of both the SDL
53and Perl. This document describes the low-level functional SDL_perl API. For the
54object oriented programming interface please see the documentation provided on a
55per class basis.</p>
56
57</div>
162a0989 58<h1 id="Functions_exported_by_SDL_pm">Functions exported by SDL.pm</h1><p><a href="#TOP" class="toplink">Top</a></p>
59<div id="Functions_exported_by_SDL_pm_CONTENT">
60
61</div>
62<h2 id="init_flags">init(flags) </h2>
63<div id="init_flags_CONTENT">
64<p>As with the C language API, SDL_perl initializes the SDL environment through
30652763 65the <code>SDL::init</code> subroutine. This routine takes a mode flag constructed through
66the bitwise OR product of the SDL_INIT_* constants.</p>
67<p>The constants are not exported by default. You can export them into your namespace by doing:</p>
68<pre> use SDL ':all';
69
70</pre>
71<p>or access them directly:</p>
72<pre> SDL::SDL_INIT_AUDIO;
73
74</pre>
9b105a17 75<p>or by choosing the export tags below:</p>
76<p>Export tag: ':init'</p>
162a0989 77<dl>
78 <dt>*
30652763 79SDL_INIT_AUDIO</dt>
162a0989 80 <dt>*
30652763 81SDL_INIT_VIDEO</dt>
162a0989 82 <dt>*
30652763 83SDL_INIT_CDROM</dt>
162a0989 84 <dt>*
30652763 85SDL_INIT_EVERYTHING</dt>
162a0989 86 <dt>*
30652763 87SDL_INIT_NOPARACHUTE</dt>
162a0989 88 <dt>*
30652763 89SDL_INIT_JOYSTICK</dt>
162a0989 90 <dt>*
30652763 91SDL_INIT_TIMER</dt>
162a0989 92</dl>
93<p><code>SDL::Init</code> returns 0 on success, or -1 on error.</p>
94
95</div>
96<h2 id="init_subsystem_flags">init_subsystem(flags)</h2>
97<div id="init_subsystem_flags_CONTENT">
98<p>After SDL has been initialized with SDL::init you may initialize uninitialized subsystems with SDL::init_subsystem.
99The flags parameter is the same as that used in SDL::init. </p>
100<p>SDL::init_subsystem returns 0 on success, or -1 on error.</p>
101
102</div>
103<h2 id="quit_subsystem_flags">quit_subsystem(flags)</h2>
104<div id="quit_subsystem_flags_CONTENT">
105<p>SDL::quit_subsystem allows you to shut down a subsystem that has been previously initialized by SDL::init or SDL::init_subsystem.
106The flags tells SDL::quit_subSystem which subsystems to shut down, it uses the same values that are passed to SDL::init. </p>
107<p>SDL::quit_subsystem doesn't returns any value.</p>
108
109</div>
110<h2 id="quit">quit</h2>
111<div id="quit_CONTENT">
90d38009 112<p>Shuts down all SDL subsystems, unloads the dynamically linked library and frees the allocated resources.</p>
113<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>
162a0989 114<p>SDL::quit doesn't returns any value.</p>
115
116</div>
117<h2 id="was_init_flags">was_init(flags)</h2>
118<div id="was_init_flags_CONTENT">
119<p>SDL::was_init allows you to see which SDL subsytems have been initialized.
120flags is a bitwise OR'd combination of the subsystems you wish to check (see SDL::init for a list of subsystem flags).
121If '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>
122
162a0989 123</div>
124<h2 id="get_error">get_error()</h2>
125<div id="get_error_CONTENT">
126<p>The last error message set by the SDL library can be retrieved using the subroutine
127<code>SDL::get_error</code>, which returns a scalar containing the text of the message if any.</p>
128
129</div>
9b105a17 130<h2 id="set_error_real_error_values">set_error_real(error, @values)</h2>
096d8dc8 131<div id="set_error_real_error_values_CONTENT">
9b105a17 132<p>SDL::set_error_real sets the SDL error to a printf style formatted string.
162a0989 133it doesn't returns any values.</p>
134
135</div>
9b105a17 136<h2 id="clear_error">clear_error()</h2>
096d8dc8 137<div id="clear_error_CONTENT">
9b105a17 138<p>SDL::clear_error deletes all information about the last SDL error. Useful if the error has been handled by the program.
162a0989 139it doesn't returns any value.</p>
140
141</div>
9b105a17 142<h2 id="version">version()</h2>
143<div id="version_CONTENT">
144<pre> my $version = SDL::version();
162a0989 145
9b105a17 146</pre>
147<p>Returns an SDL::Version object of the of the SDL library at compile time.</p>
148<p>Example:</p>
149<pre> use SDL;
150 use SDL::Version;
151
152 my $v = SDL::version();
153 printf(&quot;got version: %d.%d.%d\n&quot;, $v-&gt;major, $v-&gt;minor, $v-&gt;patch);
162a0989 154
162a0989 155
162a0989 156
9b105a17 157
158</pre>
162a0989 159
160</div>
161<h2 id="linked_version">linked_version</h2>
162<div id="linked_version_CONTENT">
9b105a17 163<pre> my $linked_version = SDL::linked_version();
164
165</pre>
166<p>Returns an SDL::Version object of the currently loaded SDL library.</p>
167<p>Example:</p>
168<pre> use SDL;
169 use SDL::Version;
170
171 my $v = SDL::linked_version();
172 printf(&quot;got version: %d.%d.%d\n&quot;, $v-&gt;major, $v-&gt;minor, $v-&gt;patch);
173
174</pre>
162a0989 175
176</div>
177<h2 id="get_error-2">get_error()</h2>
178<div id="get_error_CONTENT-2">
179<p>The last error message set by the SDL library can be retrieved using the subroutine
180<code>SDL::get_error</code>, which returns a scalar containing the text of the message if any.</p>
181
182</div>
183<h2 id="delay_ms">delay(ms)</h2>
184<div id="delay_ms_CONTENT">
9b105a17 185<pre> SDL::delay(1000);
186
187</pre>
162a0989 188<p>This subroutine allows an application to delay further operations for atleast a
189number of milliseconds provided as the argument. The actual delay may be longer
190than the specified depending on the underlying OS.</p>
191
ecabf8b7 192</div>
096d8dc8 193<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
194<div id="AUTHORS_CONTENT">
9b105a17 195<p>magnet, kthakore
196</p>
162a0989 197
198</div>
199</div>