rubygame 2.3.0-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +60 -0
- data/LICENSE +504 -0
- data/NEWS +252 -0
- data/README +123 -0
- data/ROADMAP +109 -0
- data/Rakefile +438 -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.o +0 -0
- data/ext/rubygame/rubygame_gfx.c +942 -0
- data/ext/rubygame/rubygame_gfx.h +101 -0
- data/ext/rubygame/rubygame_gfx.o +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.o +0 -0
- data/ext/rubygame/rubygame_image.c +252 -0
- data/ext/rubygame/rubygame_image.h +41 -0
- data/ext/rubygame/rubygame_image.o +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.o +0 -0
- data/ext/rubygame/rubygame_main.c +155 -0
- data/ext/rubygame/rubygame_main.h +36 -0
- data/ext/rubygame/rubygame_main.o +0 -0
- data/ext/rubygame/rubygame_mixer.c +1024 -0
- data/ext/rubygame/rubygame_mixer.h +36 -0
- data/ext/rubygame/rubygame_mixer.o +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.o +0 -0
- data/ext/rubygame/rubygame_screen.c +448 -0
- data/ext/rubygame/rubygame_screen.h +43 -0
- data/ext/rubygame/rubygame_screen.o +0 -0
- data/ext/rubygame/rubygame_shared.c +272 -0
- data/ext/rubygame/rubygame_shared.h +68 -0
- data/ext/rubygame/rubygame_shared.o +0 -0
- data/ext/rubygame/rubygame_sound.c +863 -0
- data/ext/rubygame/rubygame_sound.h +29 -0
- data/ext/rubygame/rubygame_sound.o +0 -0
- data/ext/rubygame/rubygame_surface.c +1151 -0
- data/ext/rubygame/rubygame_surface.h +62 -0
- data/ext/rubygame/rubygame_surface.o +0 -0
- data/ext/rubygame/rubygame_time.c +183 -0
- data/ext/rubygame/rubygame_time.h +32 -0
- data/ext/rubygame/rubygame_time.o +0 -0
- data/ext/rubygame/rubygame_ttf.c +599 -0
- data/ext/rubygame/rubygame_ttf.h +69 -0
- data/ext/rubygame/rubygame_ttf.o +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
- data/test/audio_spec.rb +236 -0
- data/test/color_spec.rb +544 -0
- data/test/image.png +0 -0
- data/test/music_spec.rb +727 -0
- data/test/named_resource_spec.rb +211 -0
- data/test/short.ogg +0 -0
- data/test/sound_spec.rb +564 -0
- data/test/surface_spec.rb +219 -0
- data/test/test_crop.rb +45 -0
- data/test/test_rect.rb +841 -0
- metadata +174 -0
data/Rakefile
ADDED
@@ -0,0 +1,438 @@
|
|
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,test}/**/*")
|
64
|
+
fl.exclude(/svn/)
|
65
|
+
#fl.exclude(/\.#{OBJEXT}/)
|
66
|
+
end
|
67
|
+
|
68
|
+
s.require_paths = ["lib", "lib/rubygame/", "ext/rubygame/"]
|
69
|
+
s.extensions = ["Rakefile"]
|
70
|
+
|
71
|
+
s.extra_rdoc_files = FileList.new do |fl|
|
72
|
+
fl.include "doc/*.rdoc"
|
73
|
+
fl.include "README", "LICENSE", "CREDITS", "ROADMAP", "NEWS"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
task :binary do
|
78
|
+
gem_spec.platform = Gem::Platform::CURRENT
|
79
|
+
end
|
80
|
+
|
81
|
+
Rake::GemPackageTask.new(gem_spec) do |pkg|
|
82
|
+
pkg.need_tar_bz2 = true
|
83
|
+
end
|
84
|
+
|
85
|
+
Rake::RDocTask.new do |rd|
|
86
|
+
rd.main = "README"
|
87
|
+
rd.title = "Rubygame #{RUBYGAME_VERSION.join(".")} Docs"
|
88
|
+
rd.rdoc_files.include("ext/rubygame/*.c",
|
89
|
+
"lib/rubygame/**/*.rb",
|
90
|
+
"doc/*.rdoc",
|
91
|
+
"README",
|
92
|
+
"LICENSE",
|
93
|
+
"CREDITS",
|
94
|
+
"ROADMAP",
|
95
|
+
"NEWS")
|
96
|
+
end
|
97
|
+
|
98
|
+
task :default => [:build]
|
99
|
+
desc "Compile all of the extensions"
|
100
|
+
task :build
|
101
|
+
|
102
|
+
require 'rake/clean'
|
103
|
+
task(:clean) { puts "Cleaning out temporary generated files" }
|
104
|
+
task(:clobber) { puts "Cleaning out final generated files" }
|
105
|
+
|
106
|
+
##############################
|
107
|
+
## BUILD OPTIONS ##
|
108
|
+
##############################
|
109
|
+
|
110
|
+
$options = {
|
111
|
+
:"sdl-gfx" => true,
|
112
|
+
:"sdl-image" => true,
|
113
|
+
:"sdl-ttf" => true,
|
114
|
+
:"sdl-mixer" => true,
|
115
|
+
:opengl => true,
|
116
|
+
:"sdl-config" => true,
|
117
|
+
:universal => false,
|
118
|
+
:debug => false,
|
119
|
+
:verbose => false,
|
120
|
+
:sitearchdir => CONFIG["sitearchdir"],
|
121
|
+
:sitelibdir => CONFIG["sitelibdir"]
|
122
|
+
}
|
123
|
+
|
124
|
+
# Default behavior for win32 is to skip sdl_config,
|
125
|
+
# since it's usually not available. It can still be
|
126
|
+
# enabled through the options, though.
|
127
|
+
if PLATFORM =~ /win32/
|
128
|
+
$options[:"sdl-config"] = false
|
129
|
+
end
|
130
|
+
|
131
|
+
# Define tasks to enable and disable bool options.
|
132
|
+
#
|
133
|
+
# rake option
|
134
|
+
# rake no-option
|
135
|
+
#
|
136
|
+
# task_name:: the task name to use
|
137
|
+
# option_name:: the option name (if different from
|
138
|
+
# the task name)
|
139
|
+
# desc:: a longer description, to fill
|
140
|
+
# "Enable ________.", if different
|
141
|
+
# from the task name.
|
142
|
+
#
|
143
|
+
def bool_option( task_name, option_name=nil, desc=nil )
|
144
|
+
option_name = task_name unless option_name
|
145
|
+
option_name = option_name.intern if option_name.kind_of? String
|
146
|
+
|
147
|
+
desc = task_name.to_s unless desc
|
148
|
+
|
149
|
+
notask_name = "no-#{task_name.to_s}".intern
|
150
|
+
|
151
|
+
is_true = $options[option_name]
|
152
|
+
|
153
|
+
desc "Enable #{desc} #{'(default)' if is_true}"
|
154
|
+
task(task_name) { $options[option_name] = true }
|
155
|
+
|
156
|
+
desc "Disable #{desc} #{'(default)' unless is_true}"
|
157
|
+
task(notask_name) { $options[option_name] = false }
|
158
|
+
end
|
159
|
+
|
160
|
+
# Gather a string option from an environment variable:
|
161
|
+
#
|
162
|
+
# rake option="the value of the option"
|
163
|
+
#
|
164
|
+
# task_name:: the task name to use
|
165
|
+
# option_name:: the option name (if different from
|
166
|
+
# the task name)
|
167
|
+
#
|
168
|
+
def string_option( task_name, option_name=nil )
|
169
|
+
option_name = task_name unless option_name
|
170
|
+
option_name = option_name.intern if option_name.kind_of? String
|
171
|
+
|
172
|
+
$options[option_name] = ENV["#{task_name}"] if ENV["#{task_name}"]
|
173
|
+
end
|
174
|
+
|
175
|
+
bool_option :"sdl-gfx", nil, "SDL_gfx support"
|
176
|
+
bool_option :"sdl-image", nil, "SDL_image support"
|
177
|
+
bool_option :"sdl-mixer", nil, "SDL_mixer support"
|
178
|
+
bool_option :"sdl-ttf", nil, "SDL_ttf support"
|
179
|
+
bool_option :"sdl-config", nil, "guess compiler flags for SDL"
|
180
|
+
bool_option :opengl, nil, "OpenGL support"
|
181
|
+
bool_option :debug, nil, "compile with debug symbols"
|
182
|
+
bool_option :verbose, nil, "show compiler commands"
|
183
|
+
bool_option :universal, nil, "universal binary (MacOS X Intel)"
|
184
|
+
|
185
|
+
string_option "RUBYARCHDIR", :sitearchdir
|
186
|
+
string_option :sitearchdir
|
187
|
+
|
188
|
+
string_option "RUBYLIBDIR", :sitelibdir
|
189
|
+
string_option :sitelibdir
|
190
|
+
|
191
|
+
|
192
|
+
CFLAGS = [from_env_or_config("CFLAGS"),
|
193
|
+
try_sdl_config("--cflags"),
|
194
|
+
"-I. -I#{CONFIG['topdir']}",
|
195
|
+
("-g" if $options[:debug]),
|
196
|
+
"-DRUBYGAME_MAJOR_VERSION=#{RUBYGAME_VERSION[0]}",
|
197
|
+
"-DRUBYGAME_MINOR_VERSION=#{RUBYGAME_VERSION[1]}",
|
198
|
+
"-DRUBYGAME_PATCHLEVEL=#{RUBYGAME_VERSION[2]}"
|
199
|
+
].join(" ")
|
200
|
+
|
201
|
+
LINK_FLAGS = [from_env_or_config("LIBRUBYARG_SHARED"),
|
202
|
+
from_env_or_config("LDFLAGS"),
|
203
|
+
try_sdl_config("--libs")].join(" ")
|
204
|
+
|
205
|
+
DEFAULT_EXTDIR = File.join('ext','rubygame','')
|
206
|
+
|
207
|
+
class ExtensionModule
|
208
|
+
@@libflag = " -l%s " # compiler flag for giving linked libraries
|
209
|
+
attr_accessor :dynlib, :objs, :libs, :cflags, :lflags, :directory
|
210
|
+
def initialize(&block)
|
211
|
+
@directory = DEFAULT_EXTDIR
|
212
|
+
@dynlib = ""
|
213
|
+
@objs = []
|
214
|
+
@libs = []
|
215
|
+
@lflags = ""
|
216
|
+
yield self if block_given?
|
217
|
+
end
|
218
|
+
|
219
|
+
def add_lib( lib )
|
220
|
+
@lflags << @@libflag%lib
|
221
|
+
end
|
222
|
+
|
223
|
+
def add_header( header )
|
224
|
+
#CFLAGS << " -DHAVE_#{header.upcase.gsub('.','_')} "
|
225
|
+
end
|
226
|
+
|
227
|
+
def create_all_tasks()
|
228
|
+
create_obj_task
|
229
|
+
create_dl_task
|
230
|
+
CLEAN.include("#{@directory}/*.#{OBJEXT}")
|
231
|
+
CLOBBER.include("#{@directory}/*.#{DLEXT}")
|
232
|
+
end
|
233
|
+
|
234
|
+
# Create a file task for each dynamic library (.so) we want to generate.
|
235
|
+
#
|
236
|
+
# The file task invokes another task which does the actual compiling, and
|
237
|
+
# has the true prerequisites.
|
238
|
+
#
|
239
|
+
# This is done so that the prerequisites don't have to be compiled when
|
240
|
+
# the final product already exists (such as in the precompiled win32 gem).
|
241
|
+
#
|
242
|
+
def create_dl_task
|
243
|
+
dynlib_full = File.join( @directory, "#{dynlib}.#{DLEXT}" )
|
244
|
+
objs_full = @objs.collect { |obj|
|
245
|
+
File.join( @directory, "#{obj}.#{OBJEXT}" )
|
246
|
+
}
|
247
|
+
|
248
|
+
desc "Compile the #{@dynlib} extension"
|
249
|
+
file dynlib_full => objs_full do |task|
|
250
|
+
|
251
|
+
link_command = "#{from_env_or_config('LDSHARED')} #{LINK_FLAGS} #{@lflags} -o #{dynlib_full} #{task.prerequisites.join(' ')}"
|
252
|
+
|
253
|
+
|
254
|
+
# If link command includes i386 arch, and we're not allowing universal
|
255
|
+
if( /-arch i386/ === link_command and not $options[:universal] )
|
256
|
+
# Strip "-arch ppc" to prevent building a universal binary.
|
257
|
+
link_command.gsub!("-arch ppc","")
|
258
|
+
end
|
259
|
+
|
260
|
+
if( $options[:verbose] )
|
261
|
+
try_shell { sh link_command }
|
262
|
+
else
|
263
|
+
puts "Linking compiled files to create #{File.basename(@directory)}/#{File.basename(dynlib_full)}"
|
264
|
+
try_shell { `#{link_command}` }
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
task :build => [dynlib_full] # Add this as a prereq of the build
|
269
|
+
task :install_ext => [dynlib_full] # ...and install_ext tasks
|
270
|
+
end
|
271
|
+
|
272
|
+
def create_obj_task
|
273
|
+
# A rule for object files (".o" on linux).
|
274
|
+
# This won't work for rake < 0.7.2, because the proc returns an Array.
|
275
|
+
# If it raises an exception, we'll try a more compatible way.
|
276
|
+
rule(/#{@directory}.+\.#{OBJEXT}$/ =>
|
277
|
+
[
|
278
|
+
# Generate dependencies for this .o file
|
279
|
+
proc do |objfile|
|
280
|
+
source = objfile.sub(".#{OBJEXT}", ".c") # the .c file
|
281
|
+
[source] + depends_headers( source ) # Array of .c + .h dependencies
|
282
|
+
end
|
283
|
+
])\
|
284
|
+
do |t|
|
285
|
+
|
286
|
+
compile_command = "#{from_env_or_config('CC')} -c #{CFLAGS} #{t.source} -o #{t.name}"
|
287
|
+
|
288
|
+
# If compile command includes i386 arch, and we're not allowing universal
|
289
|
+
if( /-arch i386/ === compile_command and not $options[:universal] )
|
290
|
+
# Strip "-arch ppc" to prevent building a universal binary.
|
291
|
+
compile_command.gsub!("-arch ppc","")
|
292
|
+
end
|
293
|
+
|
294
|
+
if( $options[:verbose] )
|
295
|
+
try_shell { sh compile_command }
|
296
|
+
else
|
297
|
+
puts "Compiling #{File.basename(@directory)}/#{File.basename(t.source)}"
|
298
|
+
try_shell { `#{compile_command}` }
|
299
|
+
end
|
300
|
+
end
|
301
|
+
rescue
|
302
|
+
# Generate a .o rule for each .c file in the directory.
|
303
|
+
FileList.new("#{@directory}*.c").each do |source|
|
304
|
+
object = source.sub(".c", ".#{OBJEXT}")
|
305
|
+
file object => ([source] + depends_headers( source )) do |t|
|
306
|
+
compile_command = "#{CONFIG['CC']} -c #{CFLAGS} #{source} -o #{t.name}"
|
307
|
+
if( $options[:verbose] )
|
308
|
+
try_shell { sh compile_command }
|
309
|
+
else
|
310
|
+
puts "Compiling #{File.basename(@directory)}/#{File.basename(source)}"
|
311
|
+
try_shell { `#{compile_command}` }
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
# Extracts the names of all the headers that the C file depends on.
|
318
|
+
def depends_headers( filename )
|
319
|
+
return [] # workaround for a bug
|
320
|
+
depends = []
|
321
|
+
File.open(filename, "r") do |file|
|
322
|
+
file.each_line do |line|
|
323
|
+
if /#include\s+"(\w+\.h)"/ =~ line
|
324
|
+
depends << @directory+$1
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
return depends
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
rubygame_core = ExtensionModule.new do |core|
|
333
|
+
core.dynlib = 'rubygame_core'
|
334
|
+
core.objs = ['rubygame_main',
|
335
|
+
'rubygame_shared',
|
336
|
+
'rubygame_event',
|
337
|
+
'rubygame_gl',
|
338
|
+
'rubygame_joystick',
|
339
|
+
'rubygame_screen',
|
340
|
+
'rubygame_surface',
|
341
|
+
'rubygame_time',
|
342
|
+
]
|
343
|
+
core.create_all_tasks()
|
344
|
+
end
|
345
|
+
|
346
|
+
# TODO: We should check if the libraries exist?
|
347
|
+
|
348
|
+
rubygame_gfx = ExtensionModule.new do |gfx|
|
349
|
+
gfx.dynlib = 'rubygame_gfx'
|
350
|
+
gfx.objs = ['rubygame_shared', 'rubygame_gfx']
|
351
|
+
gfx.add_lib( 'SDL_gfx' )
|
352
|
+
gfx.add_header( 'SDL_gfxPrimitives.h')
|
353
|
+
gfx.add_header( 'SDL_rotozoom.h' )
|
354
|
+
gfx.create_all_tasks() if $options[:"sdl-gfx"]
|
355
|
+
end
|
356
|
+
|
357
|
+
rubygame_image = ExtensionModule.new do |image|
|
358
|
+
image.dynlib = 'rubygame_image'
|
359
|
+
image.objs = ['rubygame_shared', 'rubygame_image']
|
360
|
+
image.add_lib('SDL_image')
|
361
|
+
image.add_header('SDL_image.h')
|
362
|
+
image.create_all_tasks() if $options[:"sdl-image"]
|
363
|
+
end
|
364
|
+
|
365
|
+
rubygame_mixer = ExtensionModule.new do |mixer|
|
366
|
+
mixer.dynlib = 'rubygame_mixer'
|
367
|
+
mixer.objs = ['rubygame_shared', 'rubygame_mixer', 'rubygame_sound', 'rubygame_music']
|
368
|
+
mixer.add_lib('SDL_mixer')
|
369
|
+
mixer.add_header('SDL_mixer.h')
|
370
|
+
mixer.create_all_tasks() if $options[:"sdl-mixer"]
|
371
|
+
end
|
372
|
+
|
373
|
+
rubygame_ttf = ExtensionModule.new do |ttf|
|
374
|
+
ttf.dynlib = 'rubygame_ttf'
|
375
|
+
ttf.add_lib('SDL_ttf')
|
376
|
+
ttf.objs = ['rubygame_shared', 'rubygame_ttf']
|
377
|
+
ttf.add_header('SDL_ttf.h')
|
378
|
+
ttf.create_all_tasks() if $options[:"sdl-ttf"]
|
379
|
+
end
|
380
|
+
|
381
|
+
if $options[:opengl]
|
382
|
+
CFLAGS << " -DHAVE_OPENGL "
|
383
|
+
end
|
384
|
+
|
385
|
+
desc "(Called when installing via Rubygems)"
|
386
|
+
task :extension => [:fix_filenames, :build]
|
387
|
+
|
388
|
+
task :fix_filenames do
|
389
|
+
unless DLEXT == 'so'
|
390
|
+
Rake::Task[:install_ext].prerequisites.each do |prereq|
|
391
|
+
prereq = prereq.ext('so')
|
392
|
+
if File.exist? prereq
|
393
|
+
mv prereq, prereq.ext(DLEXT)
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
desc "Install just the extensions"
|
400
|
+
task :install_ext do |task|
|
401
|
+
puts "Installing extensions to #{$options[:sitearchdir]}"
|
402
|
+
mkdir_p $options[:sitearchdir]
|
403
|
+
cp task.prerequisites.to_a, $options[:sitearchdir]
|
404
|
+
end
|
405
|
+
|
406
|
+
desc "Install just the library"
|
407
|
+
task :install_lib do |task|
|
408
|
+
puts "Installing library to #{$options[:sitelibdir]}"
|
409
|
+
|
410
|
+
files = FileList.new do |fl|
|
411
|
+
fl.include("lib/**/*.rb")
|
412
|
+
fl.exclude(/svn/)
|
413
|
+
end
|
414
|
+
|
415
|
+
files.each do |f|
|
416
|
+
dir = File.join($options[:sitelibdir], File.dirname(f).sub('lib',''), "")
|
417
|
+
mkdir_p dir
|
418
|
+
cp f, dir
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
desc "Install both the extensions and the library"
|
423
|
+
task :install => [:install_ext, :install_lib]
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
begin
|
428
|
+
require 'spec/rake/spectask'
|
429
|
+
|
430
|
+
desc "Run all specs (tests)"
|
431
|
+
Spec::Rake::SpecTask.new do |t|
|
432
|
+
t.spec_files = FileList['test/*_spec.rb']
|
433
|
+
end
|
434
|
+
rescue LoadError
|
435
|
+
task :spec do
|
436
|
+
puts "ERROR: RSpec is not installed?"
|
437
|
+
end
|
438
|
+
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.
|