rubygame 2.2.0-i586-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/CREDITS +60 -0
  2. data/LICENSE +504 -0
  3. data/NEWS +201 -0
  4. data/README +139 -0
  5. data/ROADMAP +43 -0
  6. data/Rakefile +409 -0
  7. data/doc/extended_readme.rdoc +49 -0
  8. data/doc/getting_started.rdoc +47 -0
  9. data/doc/macosx_install.rdoc +70 -0
  10. data/doc/windows_install.rdoc +123 -0
  11. data/ext/rubygame/MANIFEST +25 -0
  12. data/ext/rubygame/rubygame_core.so +0 -0
  13. data/ext/rubygame/rubygame_event.c +644 -0
  14. data/ext/rubygame/rubygame_event.h +48 -0
  15. data/ext/rubygame/rubygame_event.o +0 -0
  16. data/ext/rubygame/rubygame_gfx.c +942 -0
  17. data/ext/rubygame/rubygame_gfx.h +101 -0
  18. data/ext/rubygame/rubygame_gfx.o +0 -0
  19. data/ext/rubygame/rubygame_gfx.so +0 -0
  20. data/ext/rubygame/rubygame_gl.c +154 -0
  21. data/ext/rubygame/rubygame_gl.h +32 -0
  22. data/ext/rubygame/rubygame_gl.o +0 -0
  23. data/ext/rubygame/rubygame_image.c +108 -0
  24. data/ext/rubygame/rubygame_image.h +41 -0
  25. data/ext/rubygame/rubygame_image.o +0 -0
  26. data/ext/rubygame/rubygame_image.so +0 -0
  27. data/ext/rubygame/rubygame_joystick.c +247 -0
  28. data/ext/rubygame/rubygame_joystick.h +41 -0
  29. data/ext/rubygame/rubygame_joystick.o +0 -0
  30. data/ext/rubygame/rubygame_main.c +155 -0
  31. data/ext/rubygame/rubygame_main.h +33 -0
  32. data/ext/rubygame/rubygame_main.o +0 -0
  33. data/ext/rubygame/rubygame_mixer.c +764 -0
  34. data/ext/rubygame/rubygame_mixer.h +62 -0
  35. data/ext/rubygame/rubygame_mixer.o +0 -0
  36. data/ext/rubygame/rubygame_mixer.so +0 -0
  37. data/ext/rubygame/rubygame_screen.c +448 -0
  38. data/ext/rubygame/rubygame_screen.h +43 -0
  39. data/ext/rubygame/rubygame_screen.o +0 -0
  40. data/ext/rubygame/rubygame_shared.c +209 -0
  41. data/ext/rubygame/rubygame_shared.h +60 -0
  42. data/ext/rubygame/rubygame_shared.o +0 -0
  43. data/ext/rubygame/rubygame_surface.c +1147 -0
  44. data/ext/rubygame/rubygame_surface.h +62 -0
  45. data/ext/rubygame/rubygame_surface.o +0 -0
  46. data/ext/rubygame/rubygame_time.c +183 -0
  47. data/ext/rubygame/rubygame_time.h +32 -0
  48. data/ext/rubygame/rubygame_time.o +0 -0
  49. data/ext/rubygame/rubygame_ttf.c +599 -0
  50. data/ext/rubygame/rubygame_ttf.h +69 -0
  51. data/ext/rubygame/rubygame_ttf.o +0 -0
  52. data/ext/rubygame/rubygame_ttf.so +0 -0
  53. data/lib/rubygame/MANIFEST +12 -0
  54. data/lib/rubygame/clock.rb +128 -0
  55. data/lib/rubygame/color/models/base.rb +106 -0
  56. data/lib/rubygame/color/models/hsl.rb +153 -0
  57. data/lib/rubygame/color/models/hsv.rb +149 -0
  58. data/lib/rubygame/color/models/rgb.rb +78 -0
  59. data/lib/rubygame/color/palettes/css.rb +49 -0
  60. data/lib/rubygame/color/palettes/palette.rb +100 -0
  61. data/lib/rubygame/color/palettes/x11.rb +177 -0
  62. data/lib/rubygame/color.rb +79 -0
  63. data/lib/rubygame/constants.rb +238 -0
  64. data/lib/rubygame/event.rb +313 -0
  65. data/lib/rubygame/ftor.rb +370 -0
  66. data/lib/rubygame/hotspot.rb +265 -0
  67. data/lib/rubygame/keyconstants.rb +237 -0
  68. data/lib/rubygame/mediabag.rb +94 -0
  69. data/lib/rubygame/queue.rb +288 -0
  70. data/lib/rubygame/rect.rb +612 -0
  71. data/lib/rubygame/sfont.rb +223 -0
  72. data/lib/rubygame/sprite.rb +511 -0
  73. data/lib/rubygame.rb +41 -0
  74. data/samples/FreeSans.ttf +0 -0
  75. data/samples/GPL.txt +340 -0
  76. data/samples/README +40 -0
  77. data/samples/chimp.bmp +0 -0
  78. data/samples/chimp.rb +313 -0
  79. data/samples/demo_gl.rb +151 -0
  80. data/samples/demo_gl_tex.rb +197 -0
  81. data/samples/demo_music.rb +75 -0
  82. data/samples/demo_rubygame.rb +284 -0
  83. data/samples/demo_sfont.rb +52 -0
  84. data/samples/demo_ttf.rb +193 -0
  85. data/samples/demo_utf8.rb +53 -0
  86. data/samples/fist.bmp +0 -0
  87. data/samples/load_and_blit.rb +22 -0
  88. data/samples/panda.png +0 -0
  89. data/samples/punch.wav +0 -0
  90. data/samples/ruby.png +0 -0
  91. data/samples/song.ogg +0 -0
  92. data/samples/term16.png +0 -0
  93. data/samples/whiff.wav +0 -0
  94. metadata +152 -0
@@ -0,0 +1,62 @@
1
+ /*
2
+ * rubygame -- ruby library to make game programming fun.
3
+ * Copyright (C) 2004-2007 John Croisant
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 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
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ */
20
+
21
+
22
+ #ifndef _RUBYGAME_SURFACE_H
23
+ #define _RUBYGAME_SURFACE_H
24
+
25
+ extern void Rubygame_Init_Surface();
26
+
27
+ extern VALUE rbgm_surface_new(int, VALUE*, VALUE);
28
+
29
+ extern VALUE rbgm_surface_get_w(VALUE);
30
+ extern VALUE rbgm_surface_get_h(VALUE);
31
+ extern VALUE rbgm_surface_get_size(VALUE);
32
+
33
+ extern VALUE rbgm_surface_get_depth(VALUE);
34
+ extern VALUE rbgm_surface_get_flags(VALUE);
35
+ extern VALUE rbgm_surface_get_masks(VALUE);
36
+
37
+ extern VALUE rbgm_surface_get_alpha(VALUE);
38
+ extern VALUE rbgm_surface_set_alpha(int, VALUE*, VALUE);
39
+
40
+ extern VALUE rbgm_surface_get_colorkey(VALUE);
41
+ extern VALUE rbgm_surface_set_colorkey(int, VALUE*, VALUE);
42
+
43
+ extern VALUE rbgm_surface_blit(int, VALUE*, VALUE);
44
+
45
+ extern VALUE rbgm_surface_fill(int, VALUE*, VALUE);
46
+
47
+ extern VALUE rbgm_surface_getat(int, VALUE*, VALUE);
48
+
49
+ extern VALUE rbgm_surface_pixels(VALUE);
50
+
51
+ extern VALUE rbgm_surface_get_cliprect(VALUE);
52
+ extern VALUE rbgm_surface_set_cliprect(VALUE, VALUE);
53
+
54
+ extern VALUE rbgm_surface_convert(int, VALUE*, VALUE);
55
+ extern VALUE rbgm_surface_displayformat(VALUE);
56
+ extern VALUE rbgm_surface_displayformatalpha(VALUE);
57
+
58
+ extern VALUE rbgm_image_savebmp(VALUE, VALUE);
59
+
60
+ extern VALUE rbgm_transform_flip(VALUE, VALUE, VALUE);
61
+
62
+ #endif
Binary file
@@ -0,0 +1,183 @@
1
+ /*
2
+ * Functions for getting the time since initialization and delaying execution
3
+ * for a specified amounts of time.
4
+ *
5
+ * --
6
+ *
7
+ * Rubygame -- Ruby code and bindings to SDL to facilitate game creation
8
+ * Copyright (C) 2004-2007 John Croisant
9
+ *
10
+ * This library is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU Lesser General Public
12
+ * License as published by the Free Software Foundation; either
13
+ * version 2.1 of the License, or (at your option) any later version.
14
+ *
15
+ * This library is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * Lesser General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU Lesser General Public
21
+ * License along with this library; if not, write to the Free Software
22
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
+ *
24
+ * ++
25
+ */
26
+
27
+ #include "rubygame_shared.h"
28
+ #include "rubygame_time.h"
29
+
30
+ void Rubygame_Init_Time();
31
+
32
+ VALUE cClock;
33
+
34
+ VALUE rbgm_time_wait(VALUE, VALUE);
35
+ VALUE rbgm_time_delay(int, VALUE*, VALUE);
36
+ VALUE rbgm_time_getticks(VALUE);
37
+
38
+
39
+ /* NOTICE: if you change this value "officially", don't forget to update the
40
+ * documentation for rbgm_time_delay!!
41
+ */
42
+ #define WORST_CLOCK_ACCURACY 12
43
+
44
+
45
+ /*
46
+ * call-seq:
47
+ * wait( time ) -> Integer
48
+ *
49
+ * time:: how many milliseconds to wait.
50
+ *
51
+ * Wait approximately the given time (the accuracy depends upon processor
52
+ * scheduling, but 10ms is common). Returns the actual delay time, in
53
+ * milliseconds. This method is less CPU-intensive than #delay, but is
54
+ * slightly less accurate.
55
+ *
56
+ * The Rubygame timer system will be initialized when you call this function,
57
+ * if it has not been already.
58
+ *
59
+ */
60
+ VALUE rbgm_time_wait(VALUE module, VALUE milliseconds)
61
+ {
62
+ Uint32 start, delay;
63
+
64
+ if(!SDL_WasInit(SDL_INIT_TIMER))
65
+ if(SDL_InitSubSystem(SDL_INIT_TIMER))
66
+ rb_raise(eSDLError,"Could not initialize timer system: %s",\
67
+ SDL_GetError());
68
+
69
+ delay = NUM2UINT(milliseconds);
70
+ start = SDL_GetTicks();
71
+ SDL_Delay(delay);
72
+ return INT2NUM(SDL_GetTicks() - start);
73
+ }
74
+
75
+ /*--
76
+ * From pygame code, with a few modifications:
77
+ * - takes 'accuracy' argument
78
+ * - ruby syntax for raising exceptions
79
+ *++
80
+ */
81
+ static int accurate_delay(int ticks,int accuracy)
82
+ {
83
+ int funcstart, delay;
84
+ if(ticks <= 0)
85
+ return 0;
86
+
87
+ if(!SDL_WasInit(SDL_INIT_TIMER))
88
+ {
89
+ if(SDL_InitSubSystem(SDL_INIT_TIMER))
90
+ {
91
+ rb_raise(eSDLError,"Could not initialize timer system: %s",\
92
+ SDL_GetError());
93
+ }
94
+ }
95
+
96
+ funcstart = SDL_GetTicks();
97
+ if(ticks >= accuracy)
98
+ {
99
+ delay = (ticks - 2) - (ticks % accuracy);
100
+ if(delay >= accuracy)
101
+ {
102
+ SDL_Delay(delay);
103
+ }
104
+ }
105
+ do{
106
+ delay = ticks - (SDL_GetTicks() - funcstart);
107
+ }while(delay > 0);
108
+
109
+ return SDL_GetTicks() - funcstart;
110
+ }
111
+
112
+ /*
113
+ * call-seq:
114
+ * delay( time, gran=12 ) -> Integer
115
+ *
116
+ * time:: how many milliseconds to delay.
117
+ * gran:: the granularity (in milliseconds) to assume for the system. A
118
+ * smaller value should use less CPU time, but if it's lower than the
119
+ * actual system granularity, this function might wait too long. The
120
+ * default, 12 ms, has a fairly low risk of over-waiting for many
121
+ * systems.
122
+
123
+ * Use the CPU to more accurately wait for the given period. Returns the
124
+ * actual delay time, in milliseconds. This function is more accurate than
125
+ * #wait, but is also somewhat more CPU-intensive.
126
+ *
127
+ * The Rubygame timer system will be initialized when you call this function,
128
+ * if it has not been already.
129
+ *
130
+ */
131
+ VALUE rbgm_time_delay(int argc, VALUE *argv, VALUE module)
132
+ {
133
+ int ticks, goal, accuracy;
134
+ VALUE vtime, vgran;
135
+
136
+ rb_scan_args(argc,argv,"11", &vtime, &vgran);
137
+
138
+ goal = NUM2INT(vtime);
139
+ if(goal < 0)
140
+ goal = 0;
141
+
142
+ if( RTEST(vgran) )
143
+ accuracy = NUM2INT(vgran);
144
+ else
145
+ accuracy = WORST_CLOCK_ACCURACY;
146
+
147
+ ticks = accurate_delay(goal,accuracy);
148
+
149
+ return INT2NUM(ticks);
150
+ }
151
+
152
+ /*
153
+ * call-seq:
154
+ * runtime -> Integer
155
+ *
156
+ * Return the number of milliseconds since the Rubygame timer system
157
+ * was initialized.
158
+ *
159
+ * The Rubygame timer system will be initialized when you call this function,
160
+ * if it has not been already.
161
+ */
162
+ VALUE rbgm_time_getticks( VALUE module )
163
+ {
164
+ if(!SDL_WasInit(SDL_INIT_TIMER))
165
+ if(SDL_InitSubSystem(SDL_INIT_TIMER))
166
+ rb_raise(eSDLError,"Could not initialize timer system: %s",\
167
+ SDL_GetError());
168
+ return INT2NUM(SDL_GetTicks());
169
+ }
170
+
171
+ void Rubygame_Init_Time()
172
+ {
173
+ #if 0
174
+ mRubygame = rb_define_module("Rubygame");
175
+ #endif
176
+
177
+ /* Clock class */
178
+ cClock = rb_define_class_under(mRubygame,"Clock",rb_cObject);
179
+ /* Clock class methods */
180
+ rb_define_singleton_method(cClock,"wait",rbgm_time_wait,1);
181
+ rb_define_singleton_method(cClock,"delay",rbgm_time_delay,-1);
182
+ rb_define_singleton_method(cClock,"runtime",rbgm_time_getticks,0);
183
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
+ * Copyright (C) 2004-2007 John Croisant
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 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
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ *
19
+ */
20
+
21
+ #ifndef _RUBYGAME_TIME_H
22
+ #define _RUBYGAME_TIME_H
23
+
24
+ extern void Rubygame_Init_Time();
25
+
26
+ extern VALUE cClock;
27
+
28
+ extern VALUE rbgm_time_wait(VALUE, VALUE);
29
+ extern VALUE rbgm_time_delay(int, VALUE*, VALUE);
30
+ extern VALUE rbgm_time_getticks(VALUE);
31
+
32
+ #endif
Binary file