Mercurial > sdl-ios-xcode
annotate Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyController.h @ 2318:0c653886cce7
HandleEvent() returns done each time it is called. If done was set to 0 the program should quit, but because done is not checked until *all* events are handled a
following event can reset done to 1 and prevent the program from terminating when told to. I fixed the while loop that handles events to check for the state of done
after handling each event. That could leave some events unhandled when the program exits, but it ensures that the program will exit.
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Wed, 20 Feb 2008 23:27:33 +0000 |
parents | 4d2d0548f5b2 |
children |
rev | line source |
---|---|
2207
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 // |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 // MyController.h |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 // SDL Custom Cocoa App |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 // |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 // Created by Darrell Walisser on Fri Jul 18 2003. |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 // Copyright (c) 2003 __MyCompanyName__. All rights reserved. |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 // |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 #import <Cocoa/Cocoa.h> |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 #import "SDL.h" |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 |
2220
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
12 extern id gController; // instance of this class from nib |
2207
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 |
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 // Declare SDL_QuartzWindowDelegate (defined in SDL.framework) |
2220
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
15 @interface SDL_QuartzWindowDelegate : NSObject |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
16 @end |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
17 |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
18 @interface MyController : NSObject |
2215 | 19 { |
2207
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 // Interface Builder Outlets |
2220
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
21 IBOutlet id _framesPerSecond; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
22 IBOutlet id _numSprites; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
23 IBOutlet id _window; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
24 IBOutlet id _view; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
25 |
2207
d63e9f5944ae
Unpacked project archives to get individual file history in subversion
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 // Private instance variables |
2220
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
27 int _nSprites; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
28 int _max_speed; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
29 int _doFlip; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
30 Uint8* _mem; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
31 |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
32 SDL_Surface* _screen; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
33 SDL_Surface* _sprite; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
34 SDL_Rect* _sprite_rects; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
35 SDL_Rect* _positions; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
36 SDL_Rect* _velocities; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
37 int _sprites_visible; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
38 Uint16 _sprite_w, _sprite_h; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
39 |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
40 int _mouse_x, _mouse_y; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
41 } |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
42 // Interface Builder Actions |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
43 - (IBAction)changeNumberOfSprites:(id)sender; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
44 - (IBAction)selectUpdateMode:(id)sender; |
4d2d0548f5b2
Don't run indent on the Xcode templates
Sam Lantinga <slouken@libsdl.org>
parents:
2215
diff
changeset
|
45 @end |
2213 | 46 |