rubygame 2.4.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygame
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Croisant
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-08 00:00:00 -06:00
12
+ date: 2009-04-27 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,6 +22,7 @@ extensions:
22
22
  extra_rdoc_files:
23
23
  - doc/windows_install.rdoc
24
24
  - doc/macosx_install.rdoc
25
+ - doc/managing_framerate.rdoc
25
26
  - doc/getting_started.rdoc
26
27
  - doc/extended_readme.rdoc
27
28
  - README
@@ -58,6 +59,7 @@ files:
58
59
  - lib/rubygame/hotspot.rb
59
60
  - lib/rubygame/sfont.rb
60
61
  - lib/rubygame/queue.rb
62
+ - lib/rubygame/shared.rb
61
63
  - lib/rubygame/event_hook.rb
62
64
  - lib/rubygame/event_handler.rb
63
65
  - lib/rubygame/events
@@ -65,12 +67,14 @@ files:
65
67
  - lib/rubygame/events/joystick_events.rb
66
68
  - lib/rubygame/events/misc_events.rb
67
69
  - lib/rubygame/events/mouse_events.rb
70
+ - lib/rubygame/events/clock_events.rb
68
71
  - ext/rubygame
69
72
  - ext/rubygame/rubygame_event.h
70
73
  - ext/rubygame/rubygame_mixer.c
71
74
  - ext/rubygame/rubygame_ttf.h
72
75
  - ext/rubygame/rubygame_main.c
73
76
  - ext/rubygame/rubygame_joystick.h
77
+ - ext/rubygame/rubygame_clock.h
74
78
  - ext/rubygame/rubygame_music.h
75
79
  - ext/rubygame/rubygame_gfx.h
76
80
  - ext/rubygame/rubygame_shared.c
@@ -80,14 +84,13 @@ files:
80
84
  - ext/rubygame/rubygame_event2.c
81
85
  - ext/rubygame/rubygame_sound.c
82
86
  - ext/rubygame/rubygame_shared.h
83
- - ext/rubygame/rubygame_time.c
84
87
  - ext/rubygame/rubygame_image.h
85
88
  - ext/rubygame/rubygame_surface.h
86
89
  - ext/rubygame/rubygame_screen.h
87
90
  - ext/rubygame/rubygame_event2.h
88
- - ext/rubygame/rubygame_time.h
89
91
  - ext/rubygame/rubygame_joystick.c
90
92
  - ext/rubygame/rubygame_sound.h
93
+ - ext/rubygame/rubygame_clock.c
91
94
  - ext/rubygame/rubygame_surface.c
92
95
  - ext/rubygame/rubygame_main.h
93
96
  - ext/rubygame/rubygame_gfx.c
@@ -96,12 +99,15 @@ files:
96
99
  - ext/rubygame/rubygame_gl.c
97
100
  - ext/rubygame/rubygame_mixer.h
98
101
  - ext/rubygame/rubygame_image.c
102
+ - ext/body
103
+ - ext/body/rubygame_body.so
99
104
  - samples/demo_utf8.rb
100
105
  - samples/README
101
106
  - samples/song.ogg
102
107
  - samples/GPL.txt
103
108
  - samples/demo_music.rb
104
109
  - samples/whiff.wav
110
+ - samples/framerate.rb
105
111
  - samples/demo_rubygame.rb
106
112
  - samples/demo_gl.rb
107
113
  - samples/chimp.bmp
@@ -119,6 +125,7 @@ files:
119
125
  - samples/fist.bmp
120
126
  - doc/windows_install.rdoc
121
127
  - doc/macosx_install.rdoc
128
+ - doc/managing_framerate.rdoc
122
129
  - doc/getting_started.rdoc
123
130
  - doc/extended_readme.rdoc
124
131
  - README
@@ -1,183 +0,0 @@
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
- }