Mercurial > sdl-ios-xcode
annotate docs/html/sdlcdstatus.html @ 883:50f5a29c6a17
Date: Sat, 10 Apr 2004 02:25:33 -0400
From: Glenn Maynard
To: sdl@libsdl.org
Subject: [SDL] SDL_SetVideoMode() failing and not setting an error (patch)
Running an OpenGL SDL application off 1.2.7, at SDL_InitSubSystem(SDL_INIT_VIDEO) time:
Warning: Unable to initialize AAlib mouseUsing AAlib driver: Slang driver 1.0 (slang)
SDL_SetVideoMode then fails; SDL_GetError() returns "".
The installation problem is straightforward: X (the higher priority
driver) isn't running, so SDL is falling back on aalib. However,
no error is being set when aalib fails to initialize. This also
happens with the svgalib driver.
SDL_video.c line ~653 sets mode to NULL, since aalib didn't return an
OpenGL surface. Line ~711 ("failed setting a video mode") returns NULL.
The attached patch sets an error. It's a horrible, useless error
message--it should really say eg. "aalib does not support OpenGL"; this
should probably be done earlier in the individual drivers, too.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 11 Apr 2004 19:54:40 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CDStatus</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="CD-ROM" | |
14 HREF="cdrom.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_CDOpen" | |
17 HREF="sdlcdopen.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_CDPlay" | |
20 HREF="sdlcdplay.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
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="sdlcdopen.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 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlcdplay.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 ><H1 | |
72 ><A | |
73 NAME="SDLCDSTATUS" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_CDStatus</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN7308" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CDStatus -- Returns the current status of the given drive.</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN7311" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN7312" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >CDstatus <B | |
106 CLASS="FSFUNC" | |
107 >SDL_CDStatus</B | |
108 ></CODE | |
109 >(SDL_CD *cdrom);</CODE | |
110 ></P | |
111 ><PRE | |
112 CLASS="FUNCSYNOPSISINFO" | |
113 >/* Given a status, returns true if there's a disk in the drive */ | |
114 #define CD_INDRIVE(status) ((int)status > 0)</PRE | |
115 ><P | |
116 ></P | |
117 ></DIV | |
118 ></DIV | |
119 ><DIV | |
120 CLASS="REFSECT1" | |
121 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
122 NAME="AEN7319" |
0 | 123 ></A |
124 ><H2 | |
125 >Description</H2 | |
126 ><P | |
127 >This function returns the current status of the given drive. Status is described like so: | |
128 <PRE | |
129 CLASS="PROGRAMLISTING" | |
130 >typedef enum { | |
131 CD_TRAYEMPTY, | |
132 CD_STOPPED, | |
133 CD_PLAYING, | |
134 CD_PAUSED, | |
135 CD_ERROR = -1 | |
136 } CDstatus;</PRE | |
137 ></P | |
138 ><P | |
139 >If the drive has a CD in it, the table of contents of the CD and current | |
140 play position of the CD will be stored in the SDL_CD structure.</P | |
141 ><P | |
142 >The macro <TT | |
143 CLASS="LITERAL" | |
144 >CD_INDRIVE</TT | |
145 > is provided for convenience, | |
146 and given a status returns true if there's a disk in the drive.</P | |
147 ><DIV | |
148 CLASS="NOTE" | |
149 ><BLOCKQUOTE | |
150 CLASS="NOTE" | |
151 ><P | |
152 ><B | |
153 >Note: </B | |
154 ><TT | |
155 CLASS="FUNCTION" | |
156 >SDL_CDStatus</TT | |
157 > also updates the <A | |
158 HREF="sdlcd.html" | |
159 ><SPAN | |
160 CLASS="STRUCTNAME" | |
161 >SDL_CD</SPAN | |
162 ></A | |
163 > structure passed to it.</P | |
164 ></BLOCKQUOTE | |
165 ></DIV | |
166 ></DIV | |
167 ><DIV | |
168 CLASS="REFSECT1" | |
169 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
170 NAME="AEN7331" |
0 | 171 ></A |
172 ><H2 | |
173 >Example</H2 | |
174 ><PRE | |
175 CLASS="PROGRAMLISTING" | |
176 >int playTrack(int track) | |
177 { | |
178 int playing = 0; | |
179 | |
180 if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { | |
181 /* clamp to the actual number of tracks on the CD */ | |
182 if (track >= cdrom->numtracks) { | |
183 track = cdrom->numtracks-1; | |
184 } | |
185 | |
186 if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) { | |
187 playing = 1; | |
188 } | |
189 } | |
190 return playing; | |
191 }</PRE | |
192 ></DIV | |
193 ><DIV | |
194 CLASS="REFSECT1" | |
195 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
196 NAME="AEN7334" |
0 | 197 ></A |
198 ><H2 | |
199 >See Also</H2 | |
200 ><P | |
201 ><A | |
202 HREF="sdlcd.html" | |
203 ><TT | |
204 CLASS="FUNCTION" | |
205 >SDL_CD</TT | |
206 ></A | |
207 ></P | |
208 ></DIV | |
209 ><DIV | |
210 CLASS="NAVFOOTER" | |
211 ><HR | |
212 ALIGN="LEFT" | |
213 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
214 SUMMARY="Footer navigation table" |
0 | 215 WIDTH="100%" |
216 BORDER="0" | |
217 CELLPADDING="0" | |
218 CELLSPACING="0" | |
219 ><TR | |
220 ><TD | |
221 WIDTH="33%" | |
222 ALIGN="left" | |
223 VALIGN="top" | |
224 ><A | |
225 HREF="sdlcdopen.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
226 ACCESSKEY="P" |
0 | 227 >Prev</A |
228 ></TD | |
229 ><TD | |
230 WIDTH="34%" | |
231 ALIGN="center" | |
232 VALIGN="top" | |
233 ><A | |
234 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
235 ACCESSKEY="H" |
0 | 236 >Home</A |
237 ></TD | |
238 ><TD | |
239 WIDTH="33%" | |
240 ALIGN="right" | |
241 VALIGN="top" | |
242 ><A | |
243 HREF="sdlcdplay.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
244 ACCESSKEY="N" |
0 | 245 >Next</A |
246 ></TD | |
247 ></TR | |
248 ><TR | |
249 ><TD | |
250 WIDTH="33%" | |
251 ALIGN="left" | |
252 VALIGN="top" | |
253 >SDL_CDOpen</TD | |
254 ><TD | |
255 WIDTH="34%" | |
256 ALIGN="center" | |
257 VALIGN="top" | |
258 ><A | |
259 HREF="cdrom.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
260 ACCESSKEY="U" |
0 | 261 >Up</A |
262 ></TD | |
263 ><TD | |
264 WIDTH="33%" | |
265 ALIGN="right" | |
266 VALIGN="top" | |
267 >SDL_CDPlay</TD | |
268 ></TR | |
269 ></TABLE | |
270 ></DIV | |
271 ></BODY | |
272 ></HTML | |
273 > |