Mercurial > sdl-ios-xcode
annotate docs/html/guidebasicsinit.html @ 4215:d83830711a5b SDL-1.2
Fixed bug #615
Scott McCreary 2008-08-21 10:48:14 PDT
This patch adds support for Haiku.
http://ports.haiku-files.org/browser/haikuports/trunk/media-libs/libsdl/SDL-1.2.13-haiku.diff
Haiku is an open-source recreation of BeOS. It has better POSIX compliance
than beOS did, and other improved features, which in some cases causes us to
have to "undo" previous BeOS workarounds.
Here's our port log entry for it, showing the steps to force the changes into
configure and Makefile:
http://ports.haiku-files.org/wiki/media-libs/libsdl/1.2.13/1
Note that this was only tried on 1.2.13 stable so far.
Haiku is using a newer config.guess / config.sub that doesn't yet seem to be in
the released libtool, so we are having to copy it in for now.
http://haiku-files.org/files/optional-packages/
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 21 Sep 2009 09:18:42 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Initializing SDL</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="The Basics" | |
14 HREF="guidethebasics.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="The Basics" | |
17 HREF="guidethebasics.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Graphics and Video" | |
20 HREF="guidevideo.html"></HEAD | |
21 ><BODY | |
22 CLASS="SECT1" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="guidethebasics.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 >Chapter 1. The Basics</TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="guidevideo.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><DIV | |
72 CLASS="SECT1" | |
73 ><H1 | |
74 CLASS="SECT1" | |
75 ><A | |
76 NAME="GUIDEBASICSINIT" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
77 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
78 >Initializing SDL</H1 |
0 | 79 ><P |
80 >SDL is composed of eight subsystems - Audio, CDROM, Event Handling, File I/O, Joystick Handling, Threading, Timers and Video. Before you can use any of these subsystems they must be initialized by calling <A | |
81 HREF="sdlinit.html" | |
82 ><TT | |
83 CLASS="FUNCTION" | |
84 >SDL_Init</TT | |
85 ></A | |
86 > (or <A | |
87 HREF="sdlinitsubsystem.html" | |
88 ><TT | |
89 CLASS="FUNCTION" | |
90 >SDL_InitSubSystem</TT | |
91 ></A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
92 >). <TT |
0 | 93 CLASS="FUNCTION" |
94 >SDL_Init</TT | |
95 > must be called before any other SDL function. It automatically initializes the Event Handling, File I/O and Threading subsystems and it takes a parameter specifying which other subsystems to initialize. So, to initialize the default subsystems and the Video subsystems you would call: | |
96 <PRE | |
97 CLASS="PROGRAMLISTING" | |
98 > SDL_Init ( SDL_INIT_VIDEO );</PRE | |
99 > | |
100 To initialize the default subsystems, the Video subsystem and the Timers subsystem you would call: | |
101 <PRE | |
102 CLASS="PROGRAMLISTING" | |
103 > SDL_Init ( SDL_INIT_VIDEO | SDL_INIT_TIMER );</PRE | |
104 ></P | |
105 ><P | |
106 ><TT | |
107 CLASS="FUNCTION" | |
108 >SDL_Init</TT | |
109 > is complemented by <A | |
110 HREF="sdlquit.html" | |
111 ><TT | |
112 CLASS="FUNCTION" | |
113 >SDL_Quit</TT | |
114 ></A | |
115 > (and <A | |
116 HREF="sdlquitsubsystem.html" | |
117 ><TT | |
118 CLASS="FUNCTION" | |
119 >SDL_QuitSubSystem</TT | |
120 ></A | |
121 >). <TT | |
122 CLASS="FUNCTION" | |
123 >SDL_Quit</TT | |
124 > shuts down all subsystems, including the default ones. It should always be called before a SDL application exits.</P | |
125 ><P | |
126 >With <TT | |
127 CLASS="FUNCTION" | |
128 >SDL_Init</TT | |
129 > and <TT | |
130 CLASS="FUNCTION" | |
131 >SDL_Quit</TT | |
132 > firmly embedded in your programmers toolkit you can write your first and most basic SDL application. However, we must be prepare to handle errors. Many SDL functions return a value and indicates whether the function has succeeded or failed, <TT | |
133 CLASS="FUNCTION" | |
134 >SDL_Init</TT | |
135 >, for instance, returns -1 if it could not initialize a subsystem. SDL provides a useful facility that allows you to determine exactly what the problem was, every time an error occurs within SDL an error message is stored which can be retrieved using <TT | |
136 CLASS="FUNCTION" | |
137 >SDL_GetError</TT | |
138 >. Use this often, you can never know too much about an error.</P | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
139 ><DIV |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
140 CLASS="EXAMPLE" |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
141 ><A |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
142 NAME="AEN60" |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
143 ></A |
0 | 144 ><P |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
145 ><B |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
146 >Example 1-1. Initializing SDL</B |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
147 ></P |
0 | 148 ><PRE |
149 CLASS="PROGRAMLISTING" | |
150 >#include "SDL.h" /* All SDL App's need this */ | |
151 #include <stdio.h> | |
152 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
153 int main(int argc, char *argv[]) { |
0 | 154 |
155 printf("Initializing SDL.\n"); | |
156 | |
157 /* Initialize defaults, Video and Audio */ | |
158 if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) { | |
159 printf("Could not initialize SDL: %s.\n", SDL_GetError()); | |
160 exit(-1); | |
161 } | |
162 | |
163 printf("SDL initialized.\n"); | |
164 | |
165 printf("Quiting SDL.\n"); | |
166 | |
167 /* Shutdown all subsystems */ | |
168 SDL_Quit(); | |
169 | |
170 printf("Quiting....\n"); | |
171 | |
172 exit(0); | |
173 } </PRE | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
174 ></DIV |
0 | 175 ></DIV |
176 ><DIV | |
177 CLASS="NAVFOOTER" | |
178 ><HR | |
179 ALIGN="LEFT" | |
180 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
181 SUMMARY="Footer navigation table" |
0 | 182 WIDTH="100%" |
183 BORDER="0" | |
184 CELLPADDING="0" | |
185 CELLSPACING="0" | |
186 ><TR | |
187 ><TD | |
188 WIDTH="33%" | |
189 ALIGN="left" | |
190 VALIGN="top" | |
191 ><A | |
192 HREF="guidethebasics.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
193 ACCESSKEY="P" |
0 | 194 >Prev</A |
195 ></TD | |
196 ><TD | |
197 WIDTH="34%" | |
198 ALIGN="center" | |
199 VALIGN="top" | |
200 ><A | |
201 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
202 ACCESSKEY="H" |
0 | 203 >Home</A |
204 ></TD | |
205 ><TD | |
206 WIDTH="33%" | |
207 ALIGN="right" | |
208 VALIGN="top" | |
209 ><A | |
210 HREF="guidevideo.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
211 ACCESSKEY="N" |
0 | 212 >Next</A |
213 ></TD | |
214 ></TR | |
215 ><TR | |
216 ><TD | |
217 WIDTH="33%" | |
218 ALIGN="left" | |
219 VALIGN="top" | |
220 >The Basics</TD | |
221 ><TD | |
222 WIDTH="34%" | |
223 ALIGN="center" | |
224 VALIGN="top" | |
225 ><A | |
226 HREF="guidethebasics.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
227 ACCESSKEY="U" |
0 | 228 >Up</A |
229 ></TD | |
230 ><TD | |
231 WIDTH="33%" | |
232 ALIGN="right" | |
233 VALIGN="top" | |
234 >Graphics and Video</TD | |
235 ></TR | |
236 ></TABLE | |
237 ></DIV | |
238 ></BODY | |
239 ></HTML | |
240 > |