ray 0.0.1 → 0.1.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. data/.gemtest +0 -0
  2. data/.yardopts +4 -0
  3. data/README.md +17 -21
  4. data/Rakefile +18 -139
  5. data/VERSION +1 -1
  6. data/ext/audio.cpp +723 -0
  7. data/ext/{color.c → color.cpp} +25 -13
  8. data/ext/drawable.cpp +91 -0
  9. data/ext/event.cpp +460 -0
  10. data/ext/extconf.rb +5 -104
  11. data/ext/font.cpp +190 -0
  12. data/ext/image.cpp +733 -0
  13. data/ext/input.cpp +74 -0
  14. data/ext/ray.cpp +168 -0
  15. data/ext/ray.hpp +356 -0
  16. data/ext/{rect.c → rect.cpp} +51 -37
  17. data/ext/shader.cpp +169 -0
  18. data/ext/shape.cpp +409 -0
  19. data/ext/sprite.cpp +306 -0
  20. data/ext/text.cpp +181 -0
  21. data/ext/vector.cpp +215 -0
  22. data/guide.md +619 -0
  23. data/lib/ray/audio.rb +0 -41
  24. data/lib/ray/color.rb +32 -10
  25. data/lib/ray/drawable.rb +16 -0
  26. data/lib/ray/dsl/event_listener.rb +25 -2
  27. data/lib/ray/dsl/event_runner.rb +33 -5
  28. data/lib/ray/dsl/event_translator.rb +66 -30
  29. data/lib/ray/dsl/handler.rb +3 -2
  30. data/lib/ray/dsl/matcher.rb +58 -14
  31. data/lib/ray/font.rb +38 -96
  32. data/lib/ray/font_set.rb +8 -8
  33. data/lib/ray/game.rb +87 -66
  34. data/lib/ray/helper.rb +105 -10
  35. data/lib/ray/image.rb +150 -24
  36. data/lib/ray/image_set.rb +3 -1
  37. data/lib/ray/input.rb +10 -0
  38. data/lib/ray/music_set.rb +5 -3
  39. data/lib/ray/ray.rb +21 -9
  40. data/lib/ray/rect.rb +48 -7
  41. data/lib/ray/rmagick.rb +41 -0
  42. data/lib/ray/scene.rb +99 -43
  43. data/lib/ray/scene_list.rb +67 -0
  44. data/lib/ray/shape.rb +132 -0
  45. data/lib/ray/sound_set.rb +4 -2
  46. data/lib/ray/sprite.rb +49 -111
  47. data/lib/ray/text.rb +101 -0
  48. data/lib/ray/text_helper.rb +37 -0
  49. data/lib/ray/turtle.rb +215 -0
  50. data/lib/ray/vector.rb +226 -0
  51. data/samples/audio/spacial.rb +44 -0
  52. data/samples/hello_world/hello.rb +9 -13
  53. data/samples/hello_world/hello_dsl.rb +8 -12
  54. data/samples/hello_world/text.rb +15 -0
  55. data/samples/opengl/binding.rb +38 -0
  56. data/samples/opengl/image.rb +32 -0
  57. data/samples/opengl/opengl.rb +34 -0
  58. data/samples/opengl/shader.rb +42 -0
  59. data/samples/pong/pong.rb +14 -10
  60. data/samples/run_scene.rb +53 -0
  61. data/samples/shaders/scene.rb +40 -0
  62. data/samples/shaders/shaders.rb +42 -0
  63. data/samples/shaders/shape.rb +34 -0
  64. data/samples/sokoban/sokoban.rb +18 -18
  65. data/samples/test/actual_scene.rb +41 -0
  66. data/samples/test/scene_riot.rb +39 -0
  67. data/samples/test/scene_spec.rb +32 -0
  68. data/samples/test/scene_test_unit.rb +25 -0
  69. data/samples/turtle/byzantium.rb +45 -0
  70. data/samples/turtle/hilbert.rb +48 -0
  71. data/samples/turtle/koch.rb +55 -0
  72. data/samples/turtle/mandala.rb +61 -0
  73. data/samples/turtle/tree.rb +57 -0
  74. data/test/audio_test.rb +69 -0
  75. data/test/color_test.rb +77 -0
  76. data/test/drawable_test.rb +19 -0
  77. data/test/dsl_test.rb +93 -0
  78. data/test/font_test.rb +57 -0
  79. data/test/helpers.rb +94 -0
  80. data/test/image_test.rb +82 -0
  81. data/test/ray_test.rb +25 -0
  82. data/test/rect_test.rb +121 -0
  83. data/{spec → test}/res/VeraMono.ttf +0 -0
  84. data/{spec → test}/res/aqua.bmp +0 -0
  85. data/{spec → test}/res/aqua.png +0 -0
  86. data/{spec → test}/res/aqua2.bmp +0 -0
  87. data/{spec → test}/res/not_a_jpeg.jpeg +0 -0
  88. data/{spec → test}/res/pop.wav +0 -0
  89. data/test/resource_set_test.rb +99 -0
  90. data/test/run_all.rb +7 -0
  91. data/test/shape_test.rb +101 -0
  92. data/test/sprite_test.rb +89 -0
  93. data/test/text_test.rb +78 -0
  94. data/test/turtle_test.rb +176 -0
  95. data/test/vector_test.rb +111 -0
  96. data/yard_ext.rb +0 -28
  97. metadata +95 -139
  98. data/.gitignore +0 -23
  99. data/.gitmodules +0 -3
  100. data/.rspec +0 -3
  101. data/ext/audio.c +0 -473
  102. data/ext/event.c +0 -557
  103. data/ext/font.c +0 -287
  104. data/ext/image.c +0 -933
  105. data/ext/joystick.c +0 -145
  106. data/ext/ray.c +0 -489
  107. data/ext/ray.h +0 -245
  108. data/ext/ray_osx.m +0 -161
  109. data/lib/ray/joystick.rb +0 -30
  110. data/psp/SDL_psp_main.c +0 -84
  111. data/psp/bigdecimal/README +0 -60
  112. data/psp/bigdecimal/bigdecimal.c +0 -4697
  113. data/psp/bigdecimal/bigdecimal.h +0 -216
  114. data/psp/bigdecimal/lib/bigdecimal/jacobian.rb +0 -85
  115. data/psp/bigdecimal/lib/bigdecimal/ludcmp.rb +0 -84
  116. data/psp/bigdecimal/lib/bigdecimal/math.rb +0 -235
  117. data/psp/bigdecimal/lib/bigdecimal/newton.rb +0 -77
  118. data/psp/bigdecimal/lib/bigdecimal/util.rb +0 -65
  119. data/psp/digest/bubblebabble/bubblebabble.c +0 -142
  120. data/psp/digest/defs.h +0 -20
  121. data/psp/digest/digest.c +0 -643
  122. data/psp/digest/digest.h +0 -32
  123. data/psp/digest/lib/digest.rb +0 -50
  124. data/psp/digest/lib/md5.rb +0 -27
  125. data/psp/digest/lib/sha1.rb +0 -27
  126. data/psp/digest/md5/md5.c +0 -420
  127. data/psp/digest/md5/md5.h +0 -80
  128. data/psp/digest/md5/md5init.c +0 -40
  129. data/psp/digest/rmd160/rmd160.c +0 -457
  130. data/psp/digest/rmd160/rmd160.h +0 -56
  131. data/psp/digest/rmd160/rmd160init.c +0 -40
  132. data/psp/digest/sha1/sha1.c +0 -269
  133. data/psp/digest/sha1/sha1.h +0 -39
  134. data/psp/digest/sha1/sha1init.c +0 -40
  135. data/psp/digest/sha2/lib/sha2.rb +0 -73
  136. data/psp/digest/sha2/sha2.c +0 -919
  137. data/psp/digest/sha2/sha2.h +0 -109
  138. data/psp/digest/sha2/sha2init.c +0 -52
  139. data/psp/enumerator/enumerator.c +0 -298
  140. data/psp/etc/etc.c +0 -559
  141. data/psp/ext.c +0 -289
  142. data/psp/fcntl/fcntl.c +0 -187
  143. data/psp/lib/rbconfig.rb +0 -178
  144. data/psp/nkf/lib/kconv.rb +0 -367
  145. data/psp/nkf/nkf-utf8/config.h +0 -88
  146. data/psp/nkf/nkf-utf8/nkf.c +0 -6040
  147. data/psp/nkf/nkf-utf8/utf8tbl.c +0 -8500
  148. data/psp/nkf/nkf-utf8/utf8tbl.h +0 -34
  149. data/psp/nkf/nkf.c +0 -654
  150. data/psp/socket/addrinfo.h +0 -173
  151. data/psp/socket/getaddrinfo.c +0 -676
  152. data/psp/socket/getnameinfo.c +0 -270
  153. data/psp/socket/pspsocket.c +0 -71
  154. data/psp/socket/pspsocket.h +0 -28
  155. data/psp/socket/socket.c +0 -4662
  156. data/psp/socket/sockport.h +0 -76
  157. data/psp/stringio/stringio.c +0 -1306
  158. data/psp/strscan/strscan.c +0 -1320
  159. data/psp/syck/bytecode.c +0 -1166
  160. data/psp/syck/emitter.c +0 -1242
  161. data/psp/syck/gram.c +0 -1894
  162. data/psp/syck/gram.h +0 -79
  163. data/psp/syck/handler.c +0 -174
  164. data/psp/syck/implicit.c +0 -2990
  165. data/psp/syck/node.c +0 -408
  166. data/psp/syck/rubyext.c +0 -2367
  167. data/psp/syck/syck.c +0 -504
  168. data/psp/syck/syck.h +0 -456
  169. data/psp/syck/token.c +0 -2725
  170. data/psp/syck/yaml2byte.c +0 -257
  171. data/psp/syck/yamlbyte.h +0 -170
  172. data/psp/thread/thread.c +0 -1175
  173. data/psp/zlib/zlib.c +0 -3547
  174. data/script.rb +0 -10
  175. data/spec/ray/audio_spec.rb +0 -146
  176. data/spec/ray/color_spec.rb +0 -57
  177. data/spec/ray/event_spec.rb +0 -80
  178. data/spec/ray/font_spec.rb +0 -93
  179. data/spec/ray/image_set_spec.rb +0 -48
  180. data/spec/ray/image_spec.rb +0 -162
  181. data/spec/ray/joystick_spec.rb +0 -21
  182. data/spec/ray/matcher_spec.rb +0 -50
  183. data/spec/ray/ray_spec.rb +0 -88
  184. data/spec/ray/rect_spec.rb +0 -154
  185. data/spec/ray/resource_set_spec.rb +0 -105
  186. data/spec/ray/sprite_spec.rb +0 -163
  187. data/spec/spec.opts +0 -4
  188. data/spec/spec_helper.rb +0 -8
data/ext/ray.h DELETED
@@ -1,245 +0,0 @@
1
- #ifndef RAY_H_
2
- #define RAY_H_
3
-
4
- #ifndef PSP
5
- # include "ruby.h"
6
- #else
7
- # include <ruby/ruby.h>
8
- #endif
9
-
10
- #if defined(HAVE_SDL_H)
11
- # include <SDL.h>
12
- #else
13
- # include <SDL/SDL.h>
14
- #endif
15
-
16
- #ifdef PSP
17
- # include <pspkernel.h>
18
- # include <pspdebug.h>
19
- # include <pspctrl.h>
20
- #endif
21
-
22
- #if defined(HAVE_SDL_IMAGE_H)
23
- # if !defined(HAVE_SDL_IMAGE)
24
- # define HAVE_SDL_IMAGE
25
- # endif
26
- # include <SDL_image.h>
27
- #else
28
- # if defined(HAVE_SDL_SDL_IMAGE_H)
29
- # if !defined(HAVE_SDL_IMAGE)
30
- # define HAVE_SDL_IMAGE
31
- # endif
32
- # include <SDL/SDL_image.h>
33
- # endif
34
- #endif
35
-
36
- #if defined(HAVE_SDL_ROTOZOOM_H)
37
- # if !defined(HAVE_SDL_GFX)
38
- # define HAVE_SDL_GFX
39
- # endif
40
- # include <SDL_gfxPrimitives.h>
41
- # include <SDL_rotozoom.h>
42
- # include <SDL_imageFilter.h>
43
- #else
44
- # if defined(HAVE_SDL_SDL_ROTOZOOM_H)
45
- # if !defined(HAVE_SDL_GFX)
46
- # define HAVE_SDL_GFX
47
- # endif
48
- # include <SDL/SDL_gfxPrimitives.h>
49
- # include <SDL/SDL_rotozoom.h>
50
- # include <SDL/SDL_imageFilter.h>
51
- # endif
52
- #endif
53
-
54
- #if defined(HAVE_SDL_TTF_H)
55
- # if !defined(HAVE_SDL_TTF)
56
- # define HAVE_SDL_TTF
57
- # endif
58
- # include <SDL_ttf.h>
59
- #else
60
- # if defined(HAVE_SDL_SDL_TTF_H)
61
- # if !defined(HAVE_SDL_TTF)
62
- # define HAVE_SDL_TTF
63
- # endif
64
- # include <SDL/SDL_ttf.h>
65
- # endif
66
- #endif
67
-
68
- #if defined(HAVE_SDL_MIXER_H)
69
- # if !defined(HAVE_SDL_MIXER)
70
- # define HAVE_SDL_MIXER
71
- # endif
72
- # include <SDL_mixer.h>
73
- #else
74
- # if defined(HAVE_SDL_SDL_MIXER_H)
75
- # if !defined(HAVE_SDL_MIXER)
76
- # define HAVE_SDL_MIXER
77
- # endif
78
- # include <SDL/SDL_mixer.h>
79
- # endif
80
- #endif
81
-
82
- #ifdef __cplusplus
83
- extern "C" {
84
- #if 0
85
- }
86
- #endif
87
- #endif
88
-
89
- /* Classes and modules */
90
- extern VALUE ray_mRay;
91
-
92
- extern VALUE ray_cImage;
93
- extern VALUE ray_cColor;
94
- extern VALUE ray_cRect;
95
- extern VALUE ray_cEvent;
96
-
97
- #ifdef HAVE_SDL_TTF
98
- extern VALUE ray_cFont;
99
- #endif
100
-
101
- #ifdef HAVE_SDL_MIXER
102
- extern VALUE ray_mAudio;
103
- extern VALUE ray_cSound;
104
- extern VALUE ray_cMusic;
105
- #endif
106
-
107
- #ifdef PSP
108
- extern VALUE ray_eTimeoutError;
109
- extern VALUE ray_mWlan;
110
- #endif
111
-
112
- /* Macros for Ruby's C API */
113
-
114
- #define RAY_IS_A(obj, klass) (RTEST(rb_obj_is_kind_of(obj, klass)))
115
-
116
- #define RAY_OBJ_CLASSNAME(obj) (rb_class2name(rb_class_of(obj)))
117
-
118
- #define RAY_SYM(string) (ID2SYM(rb_intern(string)))
119
- #define RAY_METH(string) (rb_intern(string))
120
-
121
- /* Data types */
122
-
123
- typedef struct {
124
- int width;
125
- int height;
126
-
127
- int bpp;
128
-
129
- uint32_t flags;
130
- } ray_video_mode;
131
-
132
- typedef struct {
133
- SDL_Surface *surface;
134
- int must_free; /* Should we call SDL_FreeSurface? */
135
- } ray_image;
136
-
137
- typedef struct {
138
- uint8_t r, g, b, a;
139
- } ray_color;
140
-
141
- typedef SDL_Rect ray_rect;
142
-
143
- typedef struct {
144
- SDL_Joystick *joystick;
145
- } ray_joystick;
146
-
147
- #ifdef HAVE_SDL_TTF
148
- typedef struct {
149
- TTF_Font *font;
150
- } ray_font;
151
- #endif
152
-
153
- #ifdef HAVE_SDL_MIXER
154
- typedef struct {
155
- Mix_Chunk *sound;
156
- } ray_sound;
157
-
158
- typedef struct {
159
- Mix_Music *music;
160
- } ray_music;
161
- #endif
162
-
163
- /* Convertion functions */
164
-
165
- /** Converts a surface into a ruby object (won't free it) */
166
- VALUE ray_create_image(SDL_Surface *surface);
167
-
168
- /** Converts a surface into a ruby object (will free it) */
169
- VALUE ray_create_gc_image(SDL_Surface *surface);
170
-
171
- /** Converts a color into a ruby object */
172
- VALUE ray_col2rb(ray_color color);
173
-
174
- /** Converts a rect into a ruby object */
175
- VALUE ray_rect2rb(ray_rect rect);
176
-
177
- /** Converts a ruby object into a color */
178
- ray_color ray_rb2col(VALUE object);
179
-
180
- /** Parses a hash to create a video mode */
181
- ray_video_mode ray_parse_video_mode(VALUE hash);
182
-
183
- /** Converts a ruby object into an image*/
184
- ray_image *ray_rb2image(VALUE object);
185
-
186
- /** Converts a ruby object into a color */
187
- SDL_Surface *ray_rb2surface(VALUE object);
188
-
189
- /** Converts a ruby object into a rect */
190
- ray_rect ray_rb2rect(VALUE object);
191
-
192
- /**
193
- Converts a ruby object into a rect even if it's not an intance
194
- of Ray::Rect.
195
- */
196
- ray_rect ray_convert_to_rect(VALUE obj);
197
-
198
- /** Converts a ruby object into an event */
199
- SDL_Event *ray_rb2event(VALUE object);
200
-
201
- /** Converts a ruby object into a joystick */
202
- SDL_Joystick *ray_rb2joystick(VALUE object);
203
-
204
- #ifdef HAVE_SDL_TTF
205
- /** Converts a ruby object into a font */
206
- TTF_Font *ray_rb2font(VALUE object);
207
- #endif
208
-
209
- #ifdef HAVE_SDL_MIXER
210
- /** Converts a ruby object into a sound chunk */
211
- Mix_Chunk *ray_rb2chunk(VALUE object);
212
-
213
- /** Converts a ruby object into a music */
214
- Mix_Music *ray_rb2music(VALUE object);
215
- #endif
216
-
217
- /* Initializers */
218
-
219
- void Init_ray_ext();
220
- void Init_ray_image();
221
- void Init_ray_color();
222
- void Init_ray_rect();
223
- void Init_ray_event();
224
- void Init_ray_joystick();
225
-
226
- #ifdef HAVE_SDL_TTF
227
- void Init_ray_font();
228
- #endif
229
-
230
- #ifdef HAVE_SDL_MIXER
231
- void Init_ray_audio();
232
- #endif
233
-
234
- #ifdef PSP
235
- void Init_ray_psp();
236
- #endif
237
-
238
- #ifdef __cplusplus
239
- #if 0
240
- {
241
- #endif
242
- }
243
- #endif
244
-
245
- #endif
@@ -1,161 +0,0 @@
1
- #ifdef HAVE_SDL_H
2
- # include <SDL.h>
3
- #else
4
- # include <SDL/SDL.h>
5
- #endif
6
-
7
- #include <Cocoa/Cocoa.h>
8
-
9
- struct CPSProcessSerNum {
10
- UInt32 lo;
11
- UInt32 hi;
12
- };
13
-
14
- typedef struct CPSProcessSerNum CPSProcessSerNum;
15
-
16
- extern OSErr CPSGetCurrentProcess(CPSProcessSerNum *psn);
17
- extern OSErr CPSEnableForegroundOperation(CPSProcessSerNum *psn,
18
- UInt32 _arg2,
19
- UInt32 _arg3,
20
- UInt32 _arg4,
21
- UInt32 _arg5);
22
- extern OSErr CPSSetFrontProcess(CPSProcessSerNum *psn);
23
- extern OSErr CPSSetProcessName(CPSProcessSerNum *psn, const char *processname);
24
-
25
- static NSAutoreleasePool *ray_pool = nil;
26
-
27
- @interface NSApplication (SDL_Missing_Methods)
28
- - (void)setAppleMenu:(NSMenu *)menu;
29
- @end
30
-
31
- @interface RayApplication : NSApplication
32
- @end
33
-
34
- @implementation RayApplication
35
- - (void)terminate:(id)sender {
36
- SDL_Event event;
37
- event.type = SDL_QUIT;
38
- SDL_PushEvent(&event);
39
- }
40
- @end
41
-
42
- NSString *ray_osx_appname() {
43
- const NSDictionary *dict;
44
- NSString *appName = 0;
45
-
46
- dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
47
- if (dict)
48
- appName = [dict objectForKey: @"CFBundleName"];
49
-
50
- if ([appName length] == 0)
51
- appName = [[NSProcessInfo processInfo] processName];
52
-
53
- return appName;
54
- }
55
-
56
- void ray_osx_setup_application_menu() {
57
- NSMenu *appleMenu;
58
- NSMenuItem *menuItem;
59
- NSString *title;
60
- NSString *appName;
61
-
62
- appName = ray_osx_appname();
63
- appleMenu = [[NSMenu alloc] initWithTitle:@""];
64
-
65
- /* Add menu items */
66
- title = [@"About " stringByAppendingString:appName];
67
- [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:)
68
- keyEquivalent:@""];
69
-
70
- [appleMenu addItem:[NSMenuItem separatorItem]];
71
-
72
- title = [@"Hide " stringByAppendingString:appName];
73
- [appleMenu addItemWithTitle:title action:@selector(hide:)
74
- keyEquivalent:@"h"];
75
-
76
- menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others"
77
- action:@selector(hideOtherApplications:)
78
- keyEquivalent:@"h"];
79
- [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
80
-
81
- [appleMenu addItemWithTitle:@"Show All"
82
- action:@selector(unhideAllApplications:)
83
- keyEquivalent:@""];
84
-
85
- [appleMenu addItem:[NSMenuItem separatorItem]];
86
-
87
- title = [@"Quit " stringByAppendingString:appName];
88
- [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
89
-
90
- /* Put menu into the menubar */
91
- menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
92
- [menuItem setSubmenu:appleMenu];
93
- [[NSApp mainMenu] addItem:menuItem];
94
-
95
- /* Tell the application object that this is now the application menu */
96
- [NSApp setAppleMenu:appleMenu];
97
-
98
- /* Finally give up our references to the objects */
99
- [appleMenu release];
100
- [menuItem release];
101
- }
102
-
103
- void ray_osx_setup_window_menu() {
104
- NSMenu *windowMenu;
105
- NSMenuItem *windowMenuItem;
106
- NSMenuItem *menuItem;
107
-
108
- windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
109
-
110
- /* "Minimize" item */
111
- menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize"
112
- action:@selector(performMiniaturize:)
113
- keyEquivalent:@"m"];
114
- [windowMenu addItem:menuItem];
115
- [menuItem release];
116
-
117
- /* Put menu into the menubar */
118
- windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil
119
- keyEquivalent:@""];
120
- [windowMenuItem setSubmenu:windowMenu];
121
- [[NSApp mainMenu] addItem:windowMenuItem];
122
-
123
- /* Tell the application object that this is now the window menu */
124
- [NSApp setWindowsMenu:windowMenu];
125
-
126
- /* Finally give up our references to the objects */
127
- [windowMenu release];
128
- [windowMenuItem release];
129
- }
130
-
131
- void ray_osx_init() {
132
- if (ray_pool)
133
- return;
134
-
135
- ray_pool = [[NSAutoreleasePool alloc] init];
136
-
137
- [RayApplication sharedApplication];
138
-
139
- [NSApp setMainMenu:[[[NSMenu alloc] init] autorelease]];
140
- ray_osx_setup_application_menu();
141
- ray_osx_setup_window_menu();
142
-
143
- CPSProcessSerNum psn;
144
-
145
- CPSGetCurrentProcess(&psn);
146
- NSString *nameNSString = ray_osx_appname();
147
- const char *nameString = [nameNSString UTF8String];
148
- CPSSetProcessName(&psn, nameString);
149
-
150
- CPSEnableForegroundOperation(&psn, 0x03, 0x3C, 0x2C, 0x1103);
151
- CPSSetFrontProcess(&psn);
152
-
153
- [NSApp finishLaunching];
154
- [NSApp updateWindows];
155
- [NSApp activateIgnoringOtherApps:true];
156
- }
157
-
158
- void ray_osx_close() {
159
- [ray_pool drain];
160
- ray_pool = nil;
161
- }
@@ -1,30 +0,0 @@
1
- module Ray
2
- class Joystick
3
- @@joysticks = Hash.new { |h, k| h[k] = new(k) }
4
-
5
- class << self
6
- # @return [Ray::Joystick] an opened joystick
7
- def [](id)
8
- joy = @@joysticks[id]
9
- joy.open if joy.closed?
10
- joy
11
- end
12
-
13
- # Enumerates through all the joysitcks.
14
- #
15
- # @yield [joystick]
16
- # @yieldparam [Ray::Joystick] joystick
17
- def each
18
- return Enumerator.new(self, :each) unless block_given?
19
-
20
- (0...count).each do |i|
21
- yield self[i]
22
- end
23
-
24
- self
25
- end
26
-
27
- include Enumerable
28
- end
29
- end
30
- end
@@ -1,84 +0,0 @@
1
- /*
2
- SDL - Simple DirectMedia Layer
3
- Copyright (C) 1997-2004 Sam Lantinga
4
-
5
- This library is free software; you can redistribute it and/or
6
- modify it under the terms of the GNU Library General Public
7
- License as published by the Free Software Foundation; either
8
- version 2 of the License, or (at your option) any later version.
9
-
10
- This library is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- Library General Public License for more details.
14
-
15
- You should have received a copy of the GNU Library General Public
16
- License along with this library; if not, write to the Free
17
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
-
19
- Sam Lantinga
20
- slouken@libsdl.org
21
- */
22
-
23
- /*
24
- PSP port contributed by:
25
- Marcus R. Brown <mrbrown@ocgnet.org>
26
- Jim Paris <jim@jtan.com>
27
- Matthew H <matthewh@webone.com.au>
28
- */
29
-
30
- #include <SDL/SDL_main.h>
31
-
32
- #include <pspkernel.h>
33
- #include <pspdebug.h>
34
- #include <pspsdk.h>
35
- #include <pspthreadman.h>
36
- #include <stdlib.h>
37
- #include <stdio.h>
38
-
39
- /* If application's main() is redefined as SDL_main, and libSDLmain is
40
- linked, then this file will create the standard exit callback,
41
- define the PSP_MODULE_INFO macro, and exit back to the browser when
42
- the program is finished.
43
-
44
- You can still override other parameters in your own code if you
45
- desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR,
46
- PSP_MAIN_THREAD_STACK_SIZE, etc.
47
- */
48
-
49
- extern int SDL_main(int argc, char *argv[]);
50
-
51
- PSP_MODULE_INFO("ray", 0, 1, 1);
52
-
53
- int sdl_psp_exit_callback(int arg1, int arg2, void *common) {
54
- exit(0);
55
- return 0;
56
- }
57
-
58
- int sdl_psp_callback_thread(SceSize args, void *argp) {
59
- int cbid;
60
- cbid = sceKernelCreateCallback("Exit Callback",
61
- sdl_psp_exit_callback, NULL);
62
- sceKernelRegisterExitCallback(cbid);
63
- sceKernelSleepThreadCB();
64
- return 0;
65
- }
66
-
67
- int sdl_psp_setup_callbacks(void) {
68
- int thid = 0;
69
- thid = sceKernelCreateThread("update_thread",
70
- sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
71
- if(thid >= 0)
72
- sceKernelStartThread(thid, 0, 0);
73
- return thid;
74
- }
75
-
76
- int main(int argc, char *argv[]) {
77
- pspDebugScreenInit();
78
- sdl_psp_setup_callbacks();
79
-
80
- /* Register sceKernelExitGame() to be called when we exit */
81
- atexit(sceKernelExitGame);
82
-
83
- return SDL_main(argc, argv);
84
- }