Mercurial > sdl-ios-xcode
annotate docs/html/sdljoyballevent.html @ 4324:1496aa09e41e SDL-1.2
Steven Noonan to sdl
While trying to build the SDLMain.m included with SDL 1.2.14, with
#define SDL_USE_NIB_FILE 1:
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:
In function '-[SDLMain fixMenu:withAppName:]':
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:122:
warning: 'sizeToFit' is deprecated (declared at
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenu.h:281)
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:
In function 'main':
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376:
warning: 'poseAsClass:' is deprecated (declared at
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127)
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376:
error: 'poseAsClass:' is unavailable (declared at
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127)
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:377:
warning: passing argument 2 of 'NSApplicationMain' from incompatible
pointer type
Eric Wing to Sam
I don't have time today to look at this in detail, but the problem is definitely the poseAsClass: method.
This was deprecated in Obj-C 2.0 and not retained in 64-bit.
I've never used this method and it has always been limited to esoteric uses. I think this is why Apple wanted to dump it (among complicating some other things they do). I have read about others getting bit by this when migrating. Long story short, there really isn't a migration path for this method. The question that then must be asked is why are we using it (what does it accomplish), and then figure out the 'proper' way of accomplishing that.
Glancing at SDLMain.m, it's not obvious to me why it is there or what it is really accomplishing. My only speculation is that NSApplicationMain hardcodes something to look for NSApplication and a subclass (SDLApplication) fails for some reason (assuming that the original coder did this for good reason).
Three thoughts come to mind.
1) The Info.plist has properties to control things related to the startup class and nib.
NSPrincipalClass, NSMainNibFile
Maybe principle class needs to be SDLApplication and we can delete the poseAs
2) I was told that 10.6 introduced new APIs to make programatic NIB wrangling and avoidance easier. Unfortunately, I don't know the specifics.
3) Instead of subclassing NSApplication in SDLMain.m, maybe we can just add a category. It looks like the following is the only thing that is done (quick glance):
@interface SDLApplication : NSApplication
@end
@implementation SDLApplication
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
So instead, we change this to: (warning written in mail and untested)
@interface NSApplication (SDLApplication)
- (void) terminate:(id)sender;
@end
@implementation NSApplication (SDLApplication)
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
Then everywhere SDLApplication is used, we change it to NSApplication (and remove the poseAsClass line).
Perhaps you could ask the bug reporter to try this solution (#3).
And if that fails, maybe try #1.
-Eric
Steven Noonan to Sam
The suggested change (diff below) seems to work fine.
- Steven
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 12 Oct 2009 21:07:12 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_JoyBallEvent</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="SDL Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_JoyHatEvent" | |
17 HREF="sdljoyhatevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_ResizeEvent" | |
20 HREF="sdlresizeevent.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="sdljoyhatevent.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="sdlresizeevent.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="SDLJOYBALLEVENT" | |
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_JoyBallEvent</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="AEN4396" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_JoyBallEvent -- Joystick trackball motion event structure</DIV | |
84 ><DIV | |
85 CLASS="REFSECT1" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN4399" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 type; | |
95 Uint8 which; | |
96 Uint8 ball; | |
97 Sint16 xrel, yrel; | |
98 } SDL_JoyBallEvent;</PRE | |
99 ></DIV | |
100 ><DIV | |
101 CLASS="REFSECT1" | |
102 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
103 NAME="AEN4402" |
0 | 104 ></A |
105 ><H2 | |
106 >Structure Data</H2 | |
107 ><DIV | |
108 CLASS="INFORMALTABLE" | |
109 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
110 NAME="AEN4404" |
0 | 111 ></A |
112 ><P | |
113 ></P | |
114 ><TABLE | |
115 BORDER="0" | |
116 CLASS="CALSTABLE" | |
117 ><TBODY | |
118 ><TR | |
119 ><TD | |
120 ALIGN="LEFT" | |
121 VALIGN="TOP" | |
122 ><TT | |
123 CLASS="STRUCTFIELD" | |
124 ><I | |
125 >type</I | |
126 ></TT | |
127 ></TD | |
128 ><TD | |
129 ALIGN="LEFT" | |
130 VALIGN="TOP" | |
131 ><TT | |
132 CLASS="LITERAL" | |
133 >SDL_JOYBALLMOTION</TT | |
134 ></TD | |
135 ></TR | |
136 ><TR | |
137 ><TD | |
138 ALIGN="LEFT" | |
139 VALIGN="TOP" | |
140 ><TT | |
141 CLASS="STRUCTFIELD" | |
142 ><I | |
143 >which</I | |
144 ></TT | |
145 ></TD | |
146 ><TD | |
147 ALIGN="LEFT" | |
148 VALIGN="TOP" | |
149 >Joystick device index</TD | |
150 ></TR | |
151 ><TR | |
152 ><TD | |
153 ALIGN="LEFT" | |
154 VALIGN="TOP" | |
155 ><TT | |
156 CLASS="STRUCTFIELD" | |
157 ><I | |
158 >ball</I | |
159 ></TT | |
160 ></TD | |
161 ><TD | |
162 ALIGN="LEFT" | |
163 VALIGN="TOP" | |
164 >Joystick trackball index</TD | |
165 ></TR | |
166 ><TR | |
167 ><TD | |
168 ALIGN="LEFT" | |
169 VALIGN="TOP" | |
170 ><TT | |
171 CLASS="STRUCTFIELD" | |
172 ><I | |
173 >xrel</I | |
174 ></TT | |
175 >, <TT | |
176 CLASS="STRUCTFIELD" | |
177 ><I | |
178 >yrel</I | |
179 ></TT | |
180 ></TD | |
181 ><TD | |
182 ALIGN="LEFT" | |
183 VALIGN="TOP" | |
184 >The relative motion in the X/Y direction</TD | |
185 ></TR | |
186 ></TBODY | |
187 ></TABLE | |
188 ><P | |
189 ></P | |
190 ></DIV | |
191 ></DIV | |
192 ><DIV | |
193 CLASS="REFSECT1" | |
194 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
195 NAME="AEN4425" |
0 | 196 ></A |
197 ><H2 | |
198 >Description</H2 | |
199 ><P | |
200 ><SPAN | |
201 CLASS="STRUCTNAME" | |
202 >SDL_JoyBallEvent</SPAN | |
203 > is a member of the <A | |
204 HREF="sdlevent.html" | |
205 ><SPAN | |
206 CLASS="STRUCTNAME" | |
207 >SDL_Event</SPAN | |
208 ></A | |
209 > union and is used when an event of type <TT | |
210 CLASS="LITERAL" | |
211 >SDL_JOYBALLMOTION</TT | |
212 > is reported.</P | |
213 ><P | |
214 >A <TT | |
215 CLASS="LITERAL" | |
216 >SDL_JOYBALLMOTION</TT | |
217 > event occurs when a user moves a trackball on the joystick. The field <TT | |
218 CLASS="STRUCTFIELD" | |
219 ><I | |
220 >which</I | |
221 ></TT | |
222 > is the index of the joystick that reported the event and <TT | |
223 CLASS="STRUCTFIELD" | |
224 ><I | |
225 >ball</I | |
226 ></TT | |
227 > is the index of the trackball (for a more detailed explaination see the <A | |
228 HREF="joystick.html" | |
229 >Joystick section</A | |
230 >). Trackballs only return relative motion, this is the change in position on the ball since it was last polled (last cycle of the event loop) and it is stored in <TT | |
231 CLASS="STRUCTFIELD" | |
232 ><I | |
233 >xrel</I | |
234 ></TT | |
235 > and <TT | |
236 CLASS="STRUCTFIELD" | |
237 ><I | |
238 >yrel</I | |
239 ></TT | |
240 >.</P | |
241 ></DIV | |
242 ><DIV | |
243 CLASS="REFSECT1" | |
244 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
245 NAME="AEN4439" |
0 | 246 ></A |
247 ><H2 | |
248 >See Also</H2 | |
249 ><P | |
250 ><A | |
251 HREF="sdlevent.html" | |
252 ><SPAN | |
253 CLASS="STRUCTNAME" | |
254 >SDL_Event</SPAN | |
255 ></A | |
256 >, | |
257 <A | |
258 HREF="joystick.html" | |
259 >Joystick Functions</A | |
260 >, | |
261 <A | |
262 HREF="sdljoystickeventstate.html" | |
263 ><TT | |
264 CLASS="FUNCTION" | |
265 >SDL_JoystickEventState</TT | |
266 ></A | |
267 >, | |
268 <A | |
269 HREF="sdljoystickgetball.html" | |
270 ><TT | |
271 CLASS="FUNCTION" | |
272 >SDL_JoystickGetBall</TT | |
273 ></A | |
274 ></P | |
275 ></DIV | |
276 ><DIV | |
277 CLASS="NAVFOOTER" | |
278 ><HR | |
279 ALIGN="LEFT" | |
280 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
281 SUMMARY="Footer navigation table" |
0 | 282 WIDTH="100%" |
283 BORDER="0" | |
284 CELLPADDING="0" | |
285 CELLSPACING="0" | |
286 ><TR | |
287 ><TD | |
288 WIDTH="33%" | |
289 ALIGN="left" | |
290 VALIGN="top" | |
291 ><A | |
292 HREF="sdljoyhatevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
293 ACCESSKEY="P" |
0 | 294 >Prev</A |
295 ></TD | |
296 ><TD | |
297 WIDTH="34%" | |
298 ALIGN="center" | |
299 VALIGN="top" | |
300 ><A | |
301 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
302 ACCESSKEY="H" |
0 | 303 >Home</A |
304 ></TD | |
305 ><TD | |
306 WIDTH="33%" | |
307 ALIGN="right" | |
308 VALIGN="top" | |
309 ><A | |
310 HREF="sdlresizeevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
311 ACCESSKEY="N" |
0 | 312 >Next</A |
313 ></TD | |
314 ></TR | |
315 ><TR | |
316 ><TD | |
317 WIDTH="33%" | |
318 ALIGN="left" | |
319 VALIGN="top" | |
320 >SDL_JoyHatEvent</TD | |
321 ><TD | |
322 WIDTH="34%" | |
323 ALIGN="center" | |
324 VALIGN="top" | |
325 ><A | |
326 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
327 ACCESSKEY="U" |
0 | 328 >Up</A |
329 ></TD | |
330 ><TD | |
331 WIDTH="33%" | |
332 ALIGN="right" | |
333 VALIGN="top" | |
334 >SDL_ResizeEvent</TD | |
335 ></TR | |
336 ></TABLE | |
337 ></DIV | |
338 ></BODY | |
339 ></HTML | |
340 > |