rubygame 2.3.0-x86-mswin32-60
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.
- data/CREDITS +60 -0
- data/LICENSE +504 -0
- data/NEWS +252 -0
- data/README +123 -0
- data/ROADMAP +109 -0
- data/Rakefile +440 -0
- data/doc/extended_readme.rdoc +49 -0
- data/doc/getting_started.rdoc +47 -0
- data/doc/macosx_install.rdoc +70 -0
- data/doc/windows_install.rdoc +123 -0
- data/ext/rubygame/rubygame_core.so +0 -0
- data/ext/rubygame/rubygame_event.c +644 -0
- data/ext/rubygame/rubygame_event.h +48 -0
- data/ext/rubygame/rubygame_event.obj +0 -0
- data/ext/rubygame/rubygame_gfx.c +942 -0
- data/ext/rubygame/rubygame_gfx.h +101 -0
- data/ext/rubygame/rubygame_gfx.obj +0 -0
- data/ext/rubygame/rubygame_gfx.so +0 -0
- data/ext/rubygame/rubygame_gl.c +154 -0
- data/ext/rubygame/rubygame_gl.h +32 -0
- data/ext/rubygame/rubygame_gl.obj +0 -0
- data/ext/rubygame/rubygame_image.c +252 -0
- data/ext/rubygame/rubygame_image.h +41 -0
- data/ext/rubygame/rubygame_image.obj +0 -0
- data/ext/rubygame/rubygame_image.so +0 -0
- data/ext/rubygame/rubygame_joystick.c +247 -0
- data/ext/rubygame/rubygame_joystick.h +41 -0
- data/ext/rubygame/rubygame_joystick.obj +0 -0
- data/ext/rubygame/rubygame_main.c +155 -0
- data/ext/rubygame/rubygame_main.h +36 -0
- data/ext/rubygame/rubygame_main.obj +0 -0
- data/ext/rubygame/rubygame_mixer.c +1024 -0
- data/ext/rubygame/rubygame_mixer.h +36 -0
- data/ext/rubygame/rubygame_mixer.obj +0 -0
- data/ext/rubygame/rubygame_mixer.so +0 -0
- data/ext/rubygame/rubygame_music.c +1017 -0
- data/ext/rubygame/rubygame_music.h +29 -0
- data/ext/rubygame/rubygame_music.obj +0 -0
- data/ext/rubygame/rubygame_screen.c +448 -0
- data/ext/rubygame/rubygame_screen.h +43 -0
- data/ext/rubygame/rubygame_screen.obj +0 -0
- data/ext/rubygame/rubygame_shared.c +272 -0
- data/ext/rubygame/rubygame_shared.h +68 -0
- data/ext/rubygame/rubygame_shared.obj +0 -0
- data/ext/rubygame/rubygame_sound.c +863 -0
- data/ext/rubygame/rubygame_sound.h +29 -0
- data/ext/rubygame/rubygame_sound.obj +0 -0
- data/ext/rubygame/rubygame_surface.c +1151 -0
- data/ext/rubygame/rubygame_surface.h +62 -0
- data/ext/rubygame/rubygame_surface.obj +0 -0
- data/ext/rubygame/rubygame_time.c +183 -0
- data/ext/rubygame/rubygame_time.h +32 -0
- data/ext/rubygame/rubygame_time.obj +0 -0
- data/ext/rubygame/rubygame_ttf.c +599 -0
- data/ext/rubygame/rubygame_ttf.h +69 -0
- data/ext/rubygame/rubygame_ttf.obj +0 -0
- data/ext/rubygame/rubygame_ttf.so +0 -0
- data/lib/rubygame.rb +41 -0
- data/lib/rubygame/clock.rb +128 -0
- data/lib/rubygame/color.rb +79 -0
- data/lib/rubygame/color/models/base.rb +111 -0
- data/lib/rubygame/color/models/hsl.rb +153 -0
- data/lib/rubygame/color/models/hsv.rb +149 -0
- data/lib/rubygame/color/models/rgb.rb +78 -0
- data/lib/rubygame/color/palettes/css.rb +49 -0
- data/lib/rubygame/color/palettes/palette.rb +100 -0
- data/lib/rubygame/color/palettes/x11.rb +177 -0
- data/lib/rubygame/constants.rb +238 -0
- data/lib/rubygame/event.rb +313 -0
- data/lib/rubygame/ftor.rb +370 -0
- data/lib/rubygame/hotspot.rb +265 -0
- data/lib/rubygame/keyconstants.rb +237 -0
- data/lib/rubygame/mediabag.rb +94 -0
- data/lib/rubygame/named_resource.rb +254 -0
- data/lib/rubygame/queue.rb +288 -0
- data/lib/rubygame/rect.rb +612 -0
- data/lib/rubygame/sfont.rb +223 -0
- data/lib/rubygame/sprite.rb +511 -0
- data/samples/FreeSans.ttf +0 -0
- data/samples/GPL.txt +340 -0
- data/samples/README +40 -0
- data/samples/chimp.bmp +0 -0
- data/samples/chimp.rb +302 -0
- data/samples/demo_gl.rb +151 -0
- data/samples/demo_gl_tex.rb +197 -0
- data/samples/demo_music.rb +77 -0
- data/samples/demo_rubygame.rb +296 -0
- data/samples/demo_sfont.rb +52 -0
- data/samples/demo_ttf.rb +193 -0
- data/samples/demo_utf8.rb +53 -0
- data/samples/fist.bmp +0 -0
- data/samples/load_and_blit.rb +22 -0
- data/samples/panda.png +0 -0
- data/samples/punch.wav +0 -0
- data/samples/ruby.png +0 -0
- data/samples/song.ogg +0 -0
- data/samples/term16.png +0 -0
- data/samples/whiff.wav +0 -0
- metadata +164 -0
data/Rakefile
ADDED
@@ -0,0 +1,440 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
Gem::manage_gems
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
require 'rake/rdoctask'
|
7
|
+
|
8
|
+
require "rbconfig"
|
9
|
+
include Config
|
10
|
+
|
11
|
+
require 'English'
|
12
|
+
|
13
|
+
class ShellCommandError < RuntimeError
|
14
|
+
end
|
15
|
+
|
16
|
+
# Execute the block (which is supposed to perform a shell command),
|
17
|
+
# then raise ShellCommandError if the command failed.
|
18
|
+
def try_shell( &block )
|
19
|
+
result = yield
|
20
|
+
|
21
|
+
unless $CHILD_STATUS.exitstatus == 0
|
22
|
+
raise ShellCommandError, "Command failed. Aborting."
|
23
|
+
end
|
24
|
+
|
25
|
+
return result
|
26
|
+
end
|
27
|
+
|
28
|
+
def try_sdl_config( flag )
|
29
|
+
begin
|
30
|
+
if $options[:"sdl-config"]
|
31
|
+
return try_shell { `sdl-config #{flag}`.chomp }
|
32
|
+
else
|
33
|
+
return String.new
|
34
|
+
end
|
35
|
+
rescue ShellCommandError
|
36
|
+
warn "WARNING: 'sdl-config' failed."
|
37
|
+
warn "Continuing anyway, but compile may fail."
|
38
|
+
return String.new
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get a variable from ENV or CONFIG, with ENV having precedence.
|
43
|
+
# Returns "" if the variable didn't exist at all.
|
44
|
+
def from_env_or_config(string)
|
45
|
+
([ENV[string], CONFIG[string]] - ["", nil])[0] or ""
|
46
|
+
end
|
47
|
+
|
48
|
+
OBJEXT = from_env_or_config("OBJEXT")
|
49
|
+
DLEXT = from_env_or_config("DLEXT")
|
50
|
+
|
51
|
+
RUBYGAME_VERSION = [2,3,0]
|
52
|
+
|
53
|
+
gem_spec = Gem::Specification.new do |s|
|
54
|
+
s.name = "rubygame"
|
55
|
+
s.version = RUBYGAME_VERSION.join(".")
|
56
|
+
s.author = "John Croisant"
|
57
|
+
s.email = "jacius@users.sourceforge.net"
|
58
|
+
s.homepage = "http://rubygame.sourceforge.net/"
|
59
|
+
s.summary = "Clean and powerful library for game programming"
|
60
|
+
s.has_rdoc = true
|
61
|
+
|
62
|
+
s.files = FileList.new do |fl|
|
63
|
+
fl.include("{lib,ext,samples,doc}/**/*")
|
64
|
+
fl.exclude(/svn/)
|
65
|
+
#fl.exclude(/\.#{OBJEXT}/)
|
66
|
+
end
|
67
|
+
|
68
|
+
puts(s.files.join("\n"))
|
69
|
+
|
70
|
+
s.require_paths = ["lib", "lib/rubygame/", "ext/rubygame/"]
|
71
|
+
s.extensions = ["Rakefile"]
|
72
|
+
|
73
|
+
s.extra_rdoc_files = FileList.new do |fl|
|
74
|
+
fl.include "doc/*.rdoc"
|
75
|
+
fl.include "README", "LICENSE", "CREDITS", "ROADMAP", "NEWS"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
task :binary do
|
80
|
+
gem_spec.platform = Gem::Platform::CURRENT
|
81
|
+
end
|
82
|
+
|
83
|
+
Rake::GemPackageTask.new(gem_spec) do |pkg|
|
84
|
+
pkg.need_tar_bz2 = true
|
85
|
+
end
|
86
|
+
|
87
|
+
Rake::RDocTask.new do |rd|
|
88
|
+
rd.main = "README"
|
89
|
+
rd.title = "Rubygame #{RUBYGAME_VERSION.join(".")} Docs"
|
90
|
+
rd.rdoc_files.include("ext/rubygame/*.c",
|
91
|
+
"lib/rubygame/**/*.rb",
|
92
|
+
"doc/*.rdoc",
|
93
|
+
"README",
|
94
|
+
"LICENSE",
|
95
|
+
"CREDITS",
|
96
|
+
"ROADMAP",
|
97
|
+
"NEWS")
|
98
|
+
end
|
99
|
+
|
100
|
+
task :default => [:build]
|
101
|
+
desc "Compile all of the extensions"
|
102
|
+
task :build
|
103
|
+
|
104
|
+
require 'rake/clean'
|
105
|
+
task(:clean) { puts "Cleaning out temporary generated files" }
|
106
|
+
task(:clobber) { puts "Cleaning out final generated files" }
|
107
|
+
|
108
|
+
##############################
|
109
|
+
## BUILD OPTIONS ##
|
110
|
+
##############################
|
111
|
+
|
112
|
+
$options = {
|
113
|
+
:"sdl-gfx" => true,
|
114
|
+
:"sdl-image" => true,
|
115
|
+
:"sdl-ttf" => true,
|
116
|
+
:"sdl-mixer" => true,
|
117
|
+
:opengl => true,
|
118
|
+
:"sdl-config" => true,
|
119
|
+
:universal => false,
|
120
|
+
:debug => false,
|
121
|
+
:verbose => false,
|
122
|
+
:sitearchdir => CONFIG["sitearchdir"],
|
123
|
+
:sitelibdir => CONFIG["sitelibdir"]
|
124
|
+
}
|
125
|
+
|
126
|
+
# Default behavior for win32 is to skip sdl_config,
|
127
|
+
# since it's usually not available. It can still be
|
128
|
+
# enabled through the options, though.
|
129
|
+
if PLATFORM =~ /win32/
|
130
|
+
$options[:"sdl-config"] = false
|
131
|
+
end
|
132
|
+
|
133
|
+
# Define tasks to enable and disable bool options.
|
134
|
+
#
|
135
|
+
# rake option
|
136
|
+
# rake no-option
|
137
|
+
#
|
138
|
+
# task_name:: the task name to use
|
139
|
+
# option_name:: the option name (if different from
|
140
|
+
# the task name)
|
141
|
+
# desc:: a longer description, to fill
|
142
|
+
# "Enable ________.", if different
|
143
|
+
# from the task name.
|
144
|
+
#
|
145
|
+
def bool_option( task_name, option_name=nil, desc=nil )
|
146
|
+
option_name = task_name unless option_name
|
147
|
+
option_name = option_name.intern if option_name.kind_of? String
|
148
|
+
|
149
|
+
desc = task_name.to_s unless desc
|
150
|
+
|
151
|
+
notask_name = "no-#{task_name.to_s}".intern
|
152
|
+
|
153
|
+
is_true = $options[option_name]
|
154
|
+
|
155
|
+
desc "Enable #{desc} #{'(default)' if is_true}"
|
156
|
+
task(task_name) { $options[option_name] = true }
|
157
|
+
|
158
|
+
desc "Disable #{desc} #{'(default)' unless is_true}"
|
159
|
+
task(notask_name) { $options[option_name] = false }
|
160
|
+
end
|
161
|
+
|
162
|
+
# Gather a string option from an environment variable:
|
163
|
+
#
|
164
|
+
# rake option="the value of the option"
|
165
|
+
#
|
166
|
+
# task_name:: the task name to use
|
167
|
+
# option_name:: the option name (if different from
|
168
|
+
# the task name)
|
169
|
+
#
|
170
|
+
def string_option( task_name, option_name=nil )
|
171
|
+
option_name = task_name unless option_name
|
172
|
+
option_name = option_name.intern if option_name.kind_of? String
|
173
|
+
|
174
|
+
$options[option_name] = ENV["#{task_name}"] if ENV["#{task_name}"]
|
175
|
+
end
|
176
|
+
|
177
|
+
bool_option :"sdl-gfx", nil, "SDL_gfx support"
|
178
|
+
bool_option :"sdl-image", nil, "SDL_image support"
|
179
|
+
bool_option :"sdl-mixer", nil, "SDL_mixer support"
|
180
|
+
bool_option :"sdl-ttf", nil, "SDL_ttf support"
|
181
|
+
bool_option :"sdl-config", nil, "guess compiler flags for SDL"
|
182
|
+
bool_option :opengl, nil, "OpenGL support"
|
183
|
+
bool_option :debug, nil, "compile with debug symbols"
|
184
|
+
bool_option :verbose, nil, "show compiler commands"
|
185
|
+
bool_option :universal, nil, "universal binary (MacOS X Intel)"
|
186
|
+
|
187
|
+
string_option "RUBYARCHDIR", :sitearchdir
|
188
|
+
string_option :sitearchdir
|
189
|
+
|
190
|
+
string_option "RUBYLIBDIR", :sitelibdir
|
191
|
+
string_option :sitelibdir
|
192
|
+
|
193
|
+
|
194
|
+
CFLAGS = [from_env_or_config("CFLAGS"),
|
195
|
+
try_sdl_config("--cflags"),
|
196
|
+
"-I. -I#{CONFIG['topdir']}",
|
197
|
+
("-g" if $options[:debug]),
|
198
|
+
"-DRUBYGAME_MAJOR_VERSION=#{RUBYGAME_VERSION[0]}",
|
199
|
+
"-DRUBYGAME_MINOR_VERSION=#{RUBYGAME_VERSION[1]}",
|
200
|
+
"-DRUBYGAME_PATCHLEVEL=#{RUBYGAME_VERSION[2]}"
|
201
|
+
].join(" ")
|
202
|
+
|
203
|
+
LINK_FLAGS = [from_env_or_config("LIBRUBYARG_SHARED"),
|
204
|
+
from_env_or_config("LDFLAGS"),
|
205
|
+
try_sdl_config("--libs")].join(" ")
|
206
|
+
|
207
|
+
DEFAULT_EXTDIR = File.join('ext','rubygame','')
|
208
|
+
|
209
|
+
class ExtensionModule
|
210
|
+
@@libflag = " -l%s " # compiler flag for giving linked libraries
|
211
|
+
attr_accessor :dynlib, :objs, :libs, :cflags, :lflags, :directory
|
212
|
+
def initialize(&block)
|
213
|
+
@directory = DEFAULT_EXTDIR
|
214
|
+
@dynlib = ""
|
215
|
+
@objs = []
|
216
|
+
@libs = []
|
217
|
+
@lflags = ""
|
218
|
+
yield self if block_given?
|
219
|
+
end
|
220
|
+
|
221
|
+
def add_lib( lib )
|
222
|
+
@lflags << @@libflag%lib
|
223
|
+
end
|
224
|
+
|
225
|
+
def add_header( header )
|
226
|
+
#CFLAGS << " -DHAVE_#{header.upcase.gsub('.','_')} "
|
227
|
+
end
|
228
|
+
|
229
|
+
def create_all_tasks()
|
230
|
+
create_obj_task
|
231
|
+
create_dl_task
|
232
|
+
CLEAN.include("#{@directory}/*.#{OBJEXT}")
|
233
|
+
CLOBBER.include("#{@directory}/*.#{DLEXT}")
|
234
|
+
end
|
235
|
+
|
236
|
+
# Create a file task for each dynamic library (.so) we want to generate.
|
237
|
+
#
|
238
|
+
# The file task invokes another task which does the actual compiling, and
|
239
|
+
# has the true prerequisites.
|
240
|
+
#
|
241
|
+
# This is done so that the prerequisites don't have to be compiled when
|
242
|
+
# the final product already exists (such as in the precompiled win32 gem).
|
243
|
+
#
|
244
|
+
def create_dl_task
|
245
|
+
dynlib_full = File.join( @directory, "#{dynlib}.#{DLEXT}" )
|
246
|
+
objs_full = @objs.collect { |obj|
|
247
|
+
File.join( @directory, "#{obj}.#{OBJEXT}" )
|
248
|
+
}
|
249
|
+
|
250
|
+
desc "Compile the #{@dynlib} extension"
|
251
|
+
file dynlib_full => objs_full do |task|
|
252
|
+
|
253
|
+
link_command = "#{from_env_or_config('LDSHARED')} #{LINK_FLAGS} #{@lflags} -o #{dynlib_full} #{task.prerequisites.join(' ')}"
|
254
|
+
|
255
|
+
|
256
|
+
# If link command includes i386 arch, and we're not allowing universal
|
257
|
+
if( /-arch i386/ === link_command and not $options[:universal] )
|
258
|
+
# Strip "-arch ppc" to prevent building a universal binary.
|
259
|
+
link_command.gsub!("-arch ppc","")
|
260
|
+
end
|
261
|
+
|
262
|
+
if( $options[:verbose] )
|
263
|
+
try_shell { sh link_command }
|
264
|
+
else
|
265
|
+
puts "Linking compiled files to create #{File.basename(@directory)}/#{File.basename(dynlib_full)}"
|
266
|
+
try_shell { `#{link_command}` }
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
task :build => [dynlib_full] # Add this as a prereq of the build
|
271
|
+
task :install_ext => [dynlib_full] # ...and install_ext tasks
|
272
|
+
end
|
273
|
+
|
274
|
+
def create_obj_task
|
275
|
+
# A rule for object files (".o" on linux).
|
276
|
+
# This won't work for rake < 0.7.2, because the proc returns an Array.
|
277
|
+
# If it raises an exception, we'll try a more compatible way.
|
278
|
+
rule(/#{@directory}.+\.#{OBJEXT}$/ =>
|
279
|
+
[
|
280
|
+
# Generate dependencies for this .o file
|
281
|
+
proc do |objfile|
|
282
|
+
source = objfile.sub(".#{OBJEXT}", ".c") # the .c file
|
283
|
+
[source] + depends_headers( source ) # Array of .c + .h dependencies
|
284
|
+
end
|
285
|
+
])\
|
286
|
+
do |t|
|
287
|
+
|
288
|
+
compile_command = "#{from_env_or_config('CC')} -c #{CFLAGS} #{t.source} -o #{t.name}"
|
289
|
+
|
290
|
+
# If compile command includes i386 arch, and we're not allowing universal
|
291
|
+
if( /-arch i386/ === compile_command and not $options[:universal] )
|
292
|
+
# Strip "-arch ppc" to prevent building a universal binary.
|
293
|
+
compile_command.gsub!("-arch ppc","")
|
294
|
+
end
|
295
|
+
|
296
|
+
if( $options[:verbose] )
|
297
|
+
try_shell { sh compile_command }
|
298
|
+
else
|
299
|
+
puts "Compiling #{File.basename(@directory)}/#{File.basename(t.source)}"
|
300
|
+
try_shell { `#{compile_command}` }
|
301
|
+
end
|
302
|
+
end
|
303
|
+
rescue
|
304
|
+
# Generate a .o rule for each .c file in the directory.
|
305
|
+
FileList.new("#{@directory}*.c").each do |source|
|
306
|
+
object = source.sub(".c", ".#{OBJEXT}")
|
307
|
+
file object => ([source] + depends_headers( source )) do |t|
|
308
|
+
compile_command = "#{CONFIG['CC']} -c #{CFLAGS} #{source} -o #{t.name}"
|
309
|
+
if( $options[:verbose] )
|
310
|
+
try_shell { sh compile_command }
|
311
|
+
else
|
312
|
+
puts "Compiling #{File.basename(@directory)}/#{File.basename(source)}"
|
313
|
+
try_shell { `#{compile_command}` }
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# Extracts the names of all the headers that the C file depends on.
|
320
|
+
def depends_headers( filename )
|
321
|
+
return [] # workaround for a bug
|
322
|
+
depends = []
|
323
|
+
File.open(filename, "r") do |file|
|
324
|
+
file.each_line do |line|
|
325
|
+
if /#include\s+"(\w+\.h)"/ =~ line
|
326
|
+
depends << @directory+$1
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
return depends
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
rubygame_core = ExtensionModule.new do |core|
|
335
|
+
core.dynlib = 'rubygame_core'
|
336
|
+
core.objs = ['rubygame_main',
|
337
|
+
'rubygame_shared',
|
338
|
+
'rubygame_event',
|
339
|
+
'rubygame_gl',
|
340
|
+
'rubygame_joystick',
|
341
|
+
'rubygame_screen',
|
342
|
+
'rubygame_surface',
|
343
|
+
'rubygame_time',
|
344
|
+
]
|
345
|
+
core.create_all_tasks()
|
346
|
+
end
|
347
|
+
|
348
|
+
# TODO: We should check if the libraries exist?
|
349
|
+
|
350
|
+
rubygame_gfx = ExtensionModule.new do |gfx|
|
351
|
+
gfx.dynlib = 'rubygame_gfx'
|
352
|
+
gfx.objs = ['rubygame_shared', 'rubygame_gfx']
|
353
|
+
gfx.add_lib( 'SDL_gfx' )
|
354
|
+
gfx.add_header( 'SDL_gfxPrimitives.h')
|
355
|
+
gfx.add_header( 'SDL_rotozoom.h' )
|
356
|
+
gfx.create_all_tasks() if $options[:"sdl-gfx"]
|
357
|
+
end
|
358
|
+
|
359
|
+
rubygame_image = ExtensionModule.new do |image|
|
360
|
+
image.dynlib = 'rubygame_image'
|
361
|
+
image.objs = ['rubygame_shared', 'rubygame_image']
|
362
|
+
image.add_lib('SDL_image')
|
363
|
+
image.add_header('SDL_image.h')
|
364
|
+
image.create_all_tasks() if $options[:"sdl-image"]
|
365
|
+
end
|
366
|
+
|
367
|
+
rubygame_mixer = ExtensionModule.new do |mixer|
|
368
|
+
mixer.dynlib = 'rubygame_mixer'
|
369
|
+
mixer.objs = ['rubygame_shared', 'rubygame_mixer', 'rubygame_sound', 'rubygame_music']
|
370
|
+
mixer.add_lib('SDL_mixer')
|
371
|
+
mixer.add_header('SDL_mixer.h')
|
372
|
+
mixer.create_all_tasks() if $options[:"sdl-mixer"]
|
373
|
+
end
|
374
|
+
|
375
|
+
rubygame_ttf = ExtensionModule.new do |ttf|
|
376
|
+
ttf.dynlib = 'rubygame_ttf'
|
377
|
+
ttf.add_lib('SDL_ttf')
|
378
|
+
ttf.objs = ['rubygame_shared', 'rubygame_ttf']
|
379
|
+
ttf.add_header('SDL_ttf.h')
|
380
|
+
ttf.create_all_tasks() if $options[:"sdl-ttf"]
|
381
|
+
end
|
382
|
+
|
383
|
+
if $options[:opengl]
|
384
|
+
CFLAGS << " -DHAVE_OPENGL "
|
385
|
+
end
|
386
|
+
|
387
|
+
desc "(Called when installing via Rubygems)"
|
388
|
+
task :extension => [:fix_filenames, :build]
|
389
|
+
|
390
|
+
task :fix_filenames do
|
391
|
+
unless DLEXT == 'so'
|
392
|
+
Rake::Task[:install_ext].prerequisites.each do |prereq|
|
393
|
+
prereq = prereq.ext('so')
|
394
|
+
if File.exist? prereq
|
395
|
+
mv prereq, prereq.ext(DLEXT)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
desc "Install just the extensions"
|
402
|
+
task :install_ext do |task|
|
403
|
+
puts "Installing extensions to #{$options[:sitearchdir]}"
|
404
|
+
mkdir_p $options[:sitearchdir]
|
405
|
+
cp task.prerequisites.to_a, $options[:sitearchdir]
|
406
|
+
end
|
407
|
+
|
408
|
+
desc "Install just the library"
|
409
|
+
task :install_lib do |task|
|
410
|
+
puts "Installing library to #{$options[:sitelibdir]}"
|
411
|
+
|
412
|
+
files = FileList.new do |fl|
|
413
|
+
fl.include("lib/**/*.rb")
|
414
|
+
fl.exclude(/svn/)
|
415
|
+
end
|
416
|
+
|
417
|
+
files.each do |f|
|
418
|
+
dir = File.join($options[:sitelibdir], File.dirname(f).sub('lib',''), "")
|
419
|
+
mkdir_p dir
|
420
|
+
cp f, dir
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
desc "Install both the extensions and the library"
|
425
|
+
task :install => [:install_ext, :install_lib]
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
begin
|
430
|
+
require 'spec/rake/spectask'
|
431
|
+
|
432
|
+
desc "Run all specs (tests)"
|
433
|
+
Spec::Rake::SpecTask.new do |t|
|
434
|
+
t.spec_files = FileList['test/*_spec.rb']
|
435
|
+
end
|
436
|
+
rescue LoadError
|
437
|
+
task :spec do
|
438
|
+
puts "ERROR: RSpec is not installed?"
|
439
|
+
end
|
440
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
= Extended README
|
2
|
+
|
3
|
+
(Stuff that didn't make it into the main README file.)
|
4
|
+
|
5
|
+
== Internal structure of Rubygame
|
6
|
+
|
7
|
+
Rubygame's core is a low-level extension written in C; it
|
8
|
+
provides a basic interface to SDL and its companion libraries.
|
9
|
+
Building upon that is a ruby library which implements high-level
|
10
|
+
concepts like game objects, event management, etc.
|
11
|
+
|
12
|
+
Rubygame is modular, meaning you can pick and choose which parts to use.
|
13
|
+
For example, if you don't need TrueType font support, SDL_ttf is not
|
14
|
+
required to compile Rubygame. It is possible for a game to detect at
|
15
|
+
run-time which features are present, and behave accordingly (for example,
|
16
|
+
the game might disable certain optional features).
|
17
|
+
|
18
|
+
Rubygame is multi-tiered, meaning you can access Rubygame's functionality
|
19
|
+
on a number of levels, each level being built on the level below it.
|
20
|
+
Each higher level is closer to a complete game, but is also less flexible.
|
21
|
+
The idea here is that developers will use the higher levels most of the
|
22
|
+
time, but be free to hack lower levels when they need to do something
|
23
|
+
special.
|
24
|
+
|
25
|
+
== About the version number
|
26
|
+
|
27
|
+
The version number of Rubygame has a strict meaning, to help you decide
|
28
|
+
whether the new version might break your application. The version number has
|
29
|
+
3 parts: the major version number, the minor version number, and the patch
|
30
|
+
number. For the example of Rubygame 2.0.0:
|
31
|
+
|
32
|
+
2 . 0 . 0
|
33
|
+
MAJOR . MINOR . PATCH
|
34
|
+
|
35
|
+
When a new release of Rubygame is made, one of the version numbers will
|
36
|
+
go up, and the numbers that come after it will be reset to 0. Which number
|
37
|
+
will go up depends on how much the Rubygame API changed:
|
38
|
+
|
39
|
+
- *MAJOR*: API has changed, and old apps must be updated.
|
40
|
+
An example of this is when a class has been significantly changed, or a
|
41
|
+
method has renamed/moved to another module and the old name is removed.
|
42
|
+
|
43
|
+
- *MINOR*: API has changed, but old apps will still work.
|
44
|
+
An example of this is when a new feature has been added, or a
|
45
|
+
method has been renamed but the old name is still supported.
|
46
|
+
|
47
|
+
- *PATCH*: API has not changed at all.
|
48
|
+
An example of this is when a bug has been fixed, or existing code has
|
49
|
+
been improved beneath the surface.
|