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
@@ -0,0 +1,149 @@
|
|
1
|
+
#--
|
2
|
+
# Rubygame -- Ruby code and bindings to SDL to facilitate game creation
|
3
|
+
# Copyright (C) 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
|
+
require 'rubygame/color/models/base'
|
21
|
+
|
22
|
+
module Rubygame
|
23
|
+
module Color
|
24
|
+
|
25
|
+
# Represents color in the HSV (Hue, Saturation, Value) color space.
|
26
|
+
class ColorHSV
|
27
|
+
include ColorBase
|
28
|
+
|
29
|
+
attr_reader :h, :s, :v, :a
|
30
|
+
|
31
|
+
# call-seq:
|
32
|
+
# new( [h,s,v,a] ) -> ColorHSV
|
33
|
+
# new( [h,s,v] ) -> ColorHSV
|
34
|
+
# new( color ) -> ColorHSV
|
35
|
+
#
|
36
|
+
# Create a new instance from an Array or an existing color
|
37
|
+
# (of any type). If the alpha (opacity) component is omitted
|
38
|
+
# from the array, full opacity will be used.
|
39
|
+
#
|
40
|
+
# All color components range from 0.0 to 1.0.
|
41
|
+
#
|
42
|
+
def initialize( color )
|
43
|
+
if color.kind_of?(Array)
|
44
|
+
@h, @s, @v, @a = color.collect { |i| i.to_f }
|
45
|
+
@a = 1.0 unless @a
|
46
|
+
elsif color.respond_to?(:to_rgba_ary)
|
47
|
+
@h, @s, @v, @a = self.class.rgba_to_hsva( *color.to_rgba_ary )
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Return an Array with the red, green, blue, and alpha components
|
52
|
+
# of the color (converting the color to the RGBA model first).
|
53
|
+
def to_rgba_ary
|
54
|
+
return self.class.hsva_to_rgba( @h, @s, @v, @a )
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_s
|
58
|
+
"#<#{self.class} [#{@h}, #{@s}, #{@v}, #{@a}]>"
|
59
|
+
end
|
60
|
+
alias :inspect :to_s
|
61
|
+
|
62
|
+
class << self
|
63
|
+
|
64
|
+
def new_from_rgba( rgba )
|
65
|
+
new( rgba_to_hsva(*rgba) )
|
66
|
+
end
|
67
|
+
|
68
|
+
def new_from_sdl_rgba( rgba )
|
69
|
+
new_from_rgba( rgba.collect { |i| i / 255.0 } )
|
70
|
+
end
|
71
|
+
|
72
|
+
# Convert the red, green, blue, and alpha to the
|
73
|
+
# equivalent hue, saturation, value, and alpha.
|
74
|
+
def rgba_to_hsva( r, g, b, a ) # :nodoc:
|
75
|
+
rgb_arr = [r, g, b]
|
76
|
+
max = rgb_arr.max
|
77
|
+
min = rgb_arr.min
|
78
|
+
|
79
|
+
# Calculate hue.
|
80
|
+
if min == max
|
81
|
+
h = 0
|
82
|
+
# Undefined in this case, but set it to zero
|
83
|
+
elsif max == r and g >= b
|
84
|
+
h = (1.quo(6) * (g - b) / (max - min)) + 0
|
85
|
+
elsif max == r and g < b
|
86
|
+
h = (1.quo(6) * (g - b) / (max - min)) + 1.0
|
87
|
+
elsif max == g
|
88
|
+
h = (1.quo(6) * (b - r) / (max - min)) + 1.quo(3)
|
89
|
+
elsif max == b
|
90
|
+
h = (1.quo(6) * (r - g) / (max - min)) + 2.quo(3)
|
91
|
+
else
|
92
|
+
raise "Should never happen"
|
93
|
+
end
|
94
|
+
|
95
|
+
# Calulate value.
|
96
|
+
v = max
|
97
|
+
|
98
|
+
# Calculate saturation.
|
99
|
+
if max == 0.0
|
100
|
+
s = 0.0
|
101
|
+
else
|
102
|
+
s = 1.0 - (min / max)
|
103
|
+
end
|
104
|
+
|
105
|
+
return [h,s,v,a]
|
106
|
+
end
|
107
|
+
|
108
|
+
# Convert the hue, saturation, value, and alpha
|
109
|
+
# to the equivalent red, green, blue, and alpha.
|
110
|
+
def hsva_to_rgba( h, s, v, a ) # :nodoc:
|
111
|
+
# Determine what part of the "color hexagon" the hue is in.
|
112
|
+
hi = (h * 6).floor % 6
|
113
|
+
|
114
|
+
# Fractional part
|
115
|
+
f = (h * 6) - hi
|
116
|
+
|
117
|
+
# Helper values
|
118
|
+
p = v * (1.0 - s)
|
119
|
+
q = v * (1.0 - (f * s))
|
120
|
+
t = v * (1.0 - ((1.0 - f) * s))
|
121
|
+
|
122
|
+
# Finally calculate the rgb values
|
123
|
+
r, g, b = calculate_rgb(hi, v, p, t, q)
|
124
|
+
|
125
|
+
return [r, g, b, a]
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def calculate_rgb(hi, v, p, t, q) # :nodoc:
|
131
|
+
case hi
|
132
|
+
when 0
|
133
|
+
return v, t, p
|
134
|
+
when 1
|
135
|
+
return q, v, p
|
136
|
+
when 2
|
137
|
+
return p, v, t
|
138
|
+
when 3
|
139
|
+
return p, q, v
|
140
|
+
when 4
|
141
|
+
return t, p, v
|
142
|
+
when 5
|
143
|
+
return v, p, q
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#--
|
2
|
+
# Rubygame -- Ruby code and bindings to SDL to facilitate game creation
|
3
|
+
# Copyright (C) 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
|
+
require 'rubygame/color/models/base'
|
21
|
+
|
22
|
+
module Rubygame
|
23
|
+
module Color
|
24
|
+
|
25
|
+
# Represents color in the RGB (Red, Green, Blue) color space.
|
26
|
+
class ColorRGB
|
27
|
+
include ColorBase
|
28
|
+
|
29
|
+
attr_reader :r, :g, :b, :a
|
30
|
+
|
31
|
+
# call-seq:
|
32
|
+
# new( [r,g,b,a] ) -> ColorRGB
|
33
|
+
# new( [r,g,b] ) -> ColorRGB
|
34
|
+
# new( color ) -> ColorRGB
|
35
|
+
#
|
36
|
+
# Create a new instance from an Array or an existing color
|
37
|
+
# (of any type). If the alpha (opacity) component is omitted
|
38
|
+
# from the array, full opacity will be used.
|
39
|
+
#
|
40
|
+
# All color components range from 0.0 to 1.0.
|
41
|
+
#
|
42
|
+
def initialize( color )
|
43
|
+
if color.kind_of?(Array)
|
44
|
+
@r, @g, @b, @a = color.collect { |i| i.to_f }
|
45
|
+
@a = 1.0 unless @a
|
46
|
+
elsif color.respond_to?(:to_rgba_ary)
|
47
|
+
@r, @g, @b, @a = color.to_rgba_ary
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Converts the color to an RGBA array of integers
|
52
|
+
# ranging from 0 to 255, as SDL wants.
|
53
|
+
def to_sdl_rgba_ary
|
54
|
+
self.to_rgba_ary.collect { |i| (i * 255).to_i }
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_rgba_ary
|
58
|
+
return [@r, @g, @b, @a]
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_s
|
62
|
+
"#<#{self.class} [#{@r}, #{@g}, #{@b}, #{@a}]>"
|
63
|
+
end
|
64
|
+
alias :inspect :to_s
|
65
|
+
|
66
|
+
class << self
|
67
|
+
def new_from_rgba( rgba )
|
68
|
+
new( rgba )
|
69
|
+
end
|
70
|
+
|
71
|
+
def new_from_sdl_rgba( rgba )
|
72
|
+
new_from_rgba( rgba.collect { |i| i / 255.0 } )
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#--
|
2
|
+
# Rubygame -- Ruby code and bindings to SDL to facilitate game creation
|
3
|
+
# Copyright (C) 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
|
+
require 'rubygame/color'
|
21
|
+
require 'rubygame/color/palettes/palette'
|
22
|
+
require 'rubygame/color/palettes/x11'
|
23
|
+
|
24
|
+
module Rubygame
|
25
|
+
module Color
|
26
|
+
|
27
|
+
# :enddoc:
|
28
|
+
|
29
|
+
# The CSS module contains all the colors in the CSS/HTML palette
|
30
|
+
# by symbol name, e.g. :alice_blue, :dark_olive_green, etc.
|
31
|
+
#
|
32
|
+
# NOTE: The CSS palette is identical to the X11 palette except for
|
33
|
+
# four colors: gray, green, maroon, and purple.
|
34
|
+
#
|
35
|
+
# Differences between CSS and X11 derived from
|
36
|
+
# http://en.wikipedia.org/wiki/X11_color_names
|
37
|
+
# as accessed on 2007-12-17
|
38
|
+
#
|
39
|
+
CSS = Palette.new({
|
40
|
+
:gray => ColorRGB.new( [0.50196, 0.50196, 0.50196] ),
|
41
|
+
:green => ColorRGB.new( [0.00000, 0.50196, 0.00000] ),
|
42
|
+
:maroon => ColorRGB.new( [0.50196, 0.00000, 0.00000] ),
|
43
|
+
:purple => ColorRGB.new( [0.50196, 0.00000, 0.50196] )
|
44
|
+
})
|
45
|
+
|
46
|
+
CSS.include X11
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
#--
|
2
|
+
# Rubygame -- Ruby code and bindings to SDL to facilitate game creation
|
3
|
+
# Copyright (C) 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
|
+
class Rubygame::Color::Palette
|
21
|
+
|
22
|
+
# Create a new Palette with the given name => color pairs.
|
23
|
+
def initialize( colors = {} )
|
24
|
+
@includes = []
|
25
|
+
|
26
|
+
@colors = {}
|
27
|
+
colors.each_pair do |name, color|
|
28
|
+
@colors[sanitize_name(name)] = color
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Retrieve a color by name from this palette.
|
33
|
+
#
|
34
|
+
# The name can be a Symbol or String. See #sanitize_name.
|
35
|
+
#
|
36
|
+
# If the color cannot be found in this palette, search
|
37
|
+
# each of the #included palettes (recursively, depth-first,
|
38
|
+
# to a maximum depth of 5 levels).
|
39
|
+
#
|
40
|
+
# If the color is not found in this palette or any included
|
41
|
+
# palettes, raise IndexError.
|
42
|
+
#
|
43
|
+
def []( name )
|
44
|
+
c = lookup( sanitize_name( name ) )
|
45
|
+
raise IndexError, "unknown color #{name}" unless c
|
46
|
+
return c
|
47
|
+
end
|
48
|
+
|
49
|
+
# Store a color by name in this palette. See #sanitize_name
|
50
|
+
def []=( name, color )
|
51
|
+
name = sanitize_name( name )
|
52
|
+
@colors[name] = color
|
53
|
+
end
|
54
|
+
|
55
|
+
# Include another palette in this one. If a color cannot be
|
56
|
+
# found in this palette, the included palette(s) will be searched.
|
57
|
+
# See also #uninclude.
|
58
|
+
#
|
59
|
+
# Has no effect if the palette is already included.
|
60
|
+
def include( palette )
|
61
|
+
@includes += [palette] unless @includes.include? palette
|
62
|
+
end
|
63
|
+
|
64
|
+
# Remove the other palette from this one, so that it won't be
|
65
|
+
# searched for missing colors anymore. Has no effect if the
|
66
|
+
# other palette hasn't been #included.
|
67
|
+
def uninclude( palette )
|
68
|
+
@includes -= [palette]
|
69
|
+
end
|
70
|
+
|
71
|
+
protected
|
72
|
+
|
73
|
+
# Recursive color lookup
|
74
|
+
def lookup( name, max_depth=5 ) # :nodoc:
|
75
|
+
return nil if max_depth < 0
|
76
|
+
|
77
|
+
color = @colors[name]
|
78
|
+
|
79
|
+
unless color
|
80
|
+
@includes.each { |palette|
|
81
|
+
c = palette.lookup(name, max_depth-1)
|
82
|
+
color = c if c
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
return color
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
# Takes either a Symbol or a String, and converts it to a
|
92
|
+
# lowercase Symbol with spaces converted to underscores.
|
93
|
+
#
|
94
|
+
# E.g. "Alice Blue" and :ALICE_BLUE both become :alice_blue.
|
95
|
+
#
|
96
|
+
def sanitize_name( name )
|
97
|
+
name.to_s.gsub(' ','_').downcase.intern
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
#--
|
2
|
+
# Rubygame -- Ruby code and bindings to SDL to facilitate game creation
|
3
|
+
# Copyright (C) 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
|
+
require 'rubygame/color'
|
21
|
+
require 'rubygame/color/palettes/palette'
|
22
|
+
|
23
|
+
module Rubygame
|
24
|
+
module Color
|
25
|
+
|
26
|
+
# :enddoc:
|
27
|
+
|
28
|
+
# The X11 module contains all the colors in the X11 palette
|
29
|
+
# by symbol name, e.g. :alice_blue, :dark_olive_green, etc.
|
30
|
+
#
|
31
|
+
# The list of colors is derived from
|
32
|
+
# http://en.wikipedia.org/wiki/X11_color_names
|
33
|
+
# as accessed on 2007-12-17.
|
34
|
+
X11 = Palette.new({
|
35
|
+
:alice_blue => ColorRGB.new( [0.94117, 0.97254, 1.00000] ),
|
36
|
+
:antique_white => ColorRGB.new( [0.98039, 0.92156, 0.84313] ),
|
37
|
+
:aqua => ColorRGB.new( [0.00000, 1.00000, 1.00000] ),
|
38
|
+
:aquamarine => ColorRGB.new( [0.49803, 1.00000, 0.83137] ),
|
39
|
+
:azure => ColorRGB.new( [0.94117, 1.00000, 1.00000] ),
|
40
|
+
:beige => ColorRGB.new( [0.96078, 0.96078, 0.86274] ),
|
41
|
+
:bisque => ColorRGB.new( [1.00000, 0.89411, 0.76862] ),
|
42
|
+
:black => ColorRGB.new( [0.00000, 0.00000, 0.00000] ),
|
43
|
+
:blanched_almond => ColorRGB.new( [1.00000, 0.92156, 0.80392] ),
|
44
|
+
:blue => ColorRGB.new( [0.00000, 0.00000, 1.00000] ),
|
45
|
+
:blue_violet => ColorRGB.new( [0.54117, 0.16862, 0.88627] ),
|
46
|
+
:brown => ColorRGB.new( [0.64705, 0.16470, 0.16470] ),
|
47
|
+
:burly_wood => ColorRGB.new( [0.87058, 0.72156, 0.52941] ),
|
48
|
+
:cadet_blue => ColorRGB.new( [0.37254, 0.61960, 0.62745] ),
|
49
|
+
:chartreuse => ColorRGB.new( [0.49803, 1.00000, 0.00000] ),
|
50
|
+
:chocolate => ColorRGB.new( [0.82352, 0.41176, 0.11764] ),
|
51
|
+
:coral => ColorRGB.new( [1.00000, 0.49803, 0.31372] ),
|
52
|
+
:cornflower_blue => ColorRGB.new( [0.39215, 0.58431, 0.92941] ),
|
53
|
+
:cornsilk => ColorRGB.new( [1.00000, 0.97254, 0.86274] ),
|
54
|
+
:crimson => ColorRGB.new( [0.86274, 0.07843, 0.23529] ),
|
55
|
+
:cyan => ColorRGB.new( [0.00000, 1.00000, 1.00000] ),
|
56
|
+
:dark_blue => ColorRGB.new( [0.00000, 0.00000, 0.54509] ),
|
57
|
+
:dark_cyan => ColorRGB.new( [0.00000, 0.54509, 0.54509] ),
|
58
|
+
:dark_goldenrod => ColorRGB.new( [0.72156, 0.52549, 0.04313] ),
|
59
|
+
:dark_gray => ColorRGB.new( [0.66274, 0.66274, 0.66274] ),
|
60
|
+
:dark_green => ColorRGB.new( [0.00000, 0.39215, 0.00000] ),
|
61
|
+
:dark_khaki => ColorRGB.new( [0.74117, 0.71764, 0.41960] ),
|
62
|
+
:dark_magenta => ColorRGB.new( [0.54509, 0.00000, 0.54509] ),
|
63
|
+
:dark_olive_green => ColorRGB.new( [0.33333, 0.41960, 0.18431] ),
|
64
|
+
:dark_orange => ColorRGB.new( [1.00000, 0.54901, 0.00000] ),
|
65
|
+
:dark_orchid => ColorRGB.new( [0.60000, 0.19607, 0.80000] ),
|
66
|
+
:dark_red => ColorRGB.new( [0.54509, 0.00000, 0.00000] ),
|
67
|
+
:dark_salmon => ColorRGB.new( [0.91372, 0.58823, 0.47843] ),
|
68
|
+
:dark_sea_green => ColorRGB.new( [0.56078, 0.73725, 0.56078] ),
|
69
|
+
:dark_slate_blue => ColorRGB.new( [0.28235, 0.23921, 0.54509] ),
|
70
|
+
:dark_slate_gray => ColorRGB.new( [0.18431, 0.30980, 0.30980] ),
|
71
|
+
:dark_turquoise => ColorRGB.new( [0.00000, 0.80784, 0.81960] ),
|
72
|
+
:dark_violet => ColorRGB.new( [0.58039, 0.00000, 0.82745] ),
|
73
|
+
:deep_pink => ColorRGB.new( [1.00000, 0.07843, 0.57647] ),
|
74
|
+
:deep_sky_blue => ColorRGB.new( [0.00000, 0.74901, 1.00000] ),
|
75
|
+
:dim_gray => ColorRGB.new( [0.41176, 0.41176, 0.41176] ),
|
76
|
+
:dodger_blue => ColorRGB.new( [0.11764, 0.56470, 1.00000] ),
|
77
|
+
:fire_brick => ColorRGB.new( [0.69803, 0.13333, 0.13333] ),
|
78
|
+
:floral_white => ColorRGB.new( [1.00000, 0.98039, 0.94117] ),
|
79
|
+
:forest_green => ColorRGB.new( [0.13333, 0.54509, 0.13333] ),
|
80
|
+
:fuchsia => ColorRGB.new( [1.00000, 0.00000, 1.00000] ),
|
81
|
+
:gainsboro => ColorRGB.new( [0.86274, 0.86274, 0.86274] ),
|
82
|
+
:ghost_white => ColorRGB.new( [0.97254, 0.97254, 1.00000] ),
|
83
|
+
:gold => ColorRGB.new( [1.00000, 0.84313, 0.00000] ),
|
84
|
+
:goldenrod => ColorRGB.new( [0.85490, 0.64705, 0.12549] ),
|
85
|
+
:gray => ColorRGB.new( [0.50196, 0.50196, 0.50196] ),
|
86
|
+
:green => ColorRGB.new( [0.00000, 0.50196, 0.00000] ),
|
87
|
+
:green_yellow => ColorRGB.new( [0.67843, 1.00000, 0.18431] ),
|
88
|
+
:honeydew => ColorRGB.new( [0.94117, 1.00000, 0.94117] ),
|
89
|
+
:hot_pink => ColorRGB.new( [1.00000, 0.41176, 0.70588] ),
|
90
|
+
:indian_red => ColorRGB.new( [0.80392, 0.36078, 0.36078] ),
|
91
|
+
:indigo => ColorRGB.new( [0.29411, 0.00000, 0.50980] ),
|
92
|
+
:ivory => ColorRGB.new( [1.00000, 1.00000, 0.94117] ),
|
93
|
+
:khaki => ColorRGB.new( [0.94117, 0.90196, 0.54901] ),
|
94
|
+
:lavender => ColorRGB.new( [0.90196, 0.90196, 0.98039] ),
|
95
|
+
:lavender_blush => ColorRGB.new( [1.00000, 0.94117, 0.96078] ),
|
96
|
+
:lawn_green => ColorRGB.new( [0.48627, 0.98823, 0.00000] ),
|
97
|
+
:lemon_chiffon => ColorRGB.new( [1.00000, 0.98039, 0.80392] ),
|
98
|
+
:light_blue => ColorRGB.new( [0.67843, 0.84705, 0.90196] ),
|
99
|
+
:light_coral => ColorRGB.new( [0.94117, 0.50196, 0.50196] ),
|
100
|
+
:light_cyan => ColorRGB.new( [0.87843, 1.00000, 1.00000] ),
|
101
|
+
:light_goldenrod_yellow => ColorRGB.new( [0.98039, 0.98039, 0.82352] ),
|
102
|
+
:light_green => ColorRGB.new( [0.56470, 0.93333, 0.56470] ),
|
103
|
+
:light_grey => ColorRGB.new( [0.82745, 0.82745, 0.82745] ),
|
104
|
+
:light_pink => ColorRGB.new( [1.00000, 0.71372, 0.75686] ),
|
105
|
+
:light_salmon => ColorRGB.new( [1.00000, 0.62745, 0.47843] ),
|
106
|
+
:light_sea_green => ColorRGB.new( [0.12549, 0.69803, 0.66666] ),
|
107
|
+
:light_sky_blue => ColorRGB.new( [0.52941, 0.80784, 0.98039] ),
|
108
|
+
:light_slate_gray => ColorRGB.new( [0.46666, 0.53333, 0.60000] ),
|
109
|
+
:light_steel_blue => ColorRGB.new( [0.69019, 0.76862, 0.87058] ),
|
110
|
+
:light_yellow => ColorRGB.new( [1.00000, 1.00000, 0.87843] ),
|
111
|
+
:lime => ColorRGB.new( [0.00000, 1.00000, 0.00000] ),
|
112
|
+
:lime_green => ColorRGB.new( [0.19607, 0.80392, 0.19607] ),
|
113
|
+
:linen => ColorRGB.new( [0.98039, 0.94117, 0.90196] ),
|
114
|
+
:magenta => ColorRGB.new( [1.00000, 0.00000, 1.00000] ),
|
115
|
+
:maroon => ColorRGB.new( [0.50196, 0.00000, 0.00000] ),
|
116
|
+
:medium_aquamarine => ColorRGB.new( [0.40000, 0.80392, 0.66666] ),
|
117
|
+
:medium_blue => ColorRGB.new( [0.00000, 0.00000, 0.80392] ),
|
118
|
+
:medium_orchid => ColorRGB.new( [0.72941, 0.33333, 0.82745] ),
|
119
|
+
:medium_purple => ColorRGB.new( [0.57647, 0.43921, 0.85882] ),
|
120
|
+
:medium_sea_green => ColorRGB.new( [0.23529, 0.70196, 0.44313] ),
|
121
|
+
:medium_slate_blue => ColorRGB.new( [0.48235, 0.40784, 0.93333] ),
|
122
|
+
:medium_spring_green => ColorRGB.new( [0.00000, 0.98039, 0.60392] ),
|
123
|
+
:medium_turquoise => ColorRGB.new( [0.28235, 0.81960, 0.80000] ),
|
124
|
+
:medium_violet_red => ColorRGB.new( [0.78039, 0.08235, 0.52156] ),
|
125
|
+
:midnight_blue => ColorRGB.new( [0.09803, 0.09803, 0.43921] ),
|
126
|
+
:mint_cream => ColorRGB.new( [0.96078, 1.00000, 0.98039] ),
|
127
|
+
:misty_rose => ColorRGB.new( [1.00000, 0.89411, 0.88235] ),
|
128
|
+
:moccasin => ColorRGB.new( [1.00000, 0.89411, 0.70980] ),
|
129
|
+
:navajo_white => ColorRGB.new( [1.00000, 0.87058, 0.67843] ),
|
130
|
+
:navy => ColorRGB.new( [0.00000, 0.00000, 0.50196] ),
|
131
|
+
:old_lace => ColorRGB.new( [0.99215, 0.96078, 0.90196] ),
|
132
|
+
:olive => ColorRGB.new( [0.50196, 0.50196, 0.00000] ),
|
133
|
+
:olive_drab => ColorRGB.new( [0.41960, 0.55686, 0.13725] ),
|
134
|
+
:orange => ColorRGB.new( [1.00000, 0.64705, 0.00000] ),
|
135
|
+
:orange_red => ColorRGB.new( [1.00000, 0.27058, 0.00000] ),
|
136
|
+
:orchid => ColorRGB.new( [0.85490, 0.43921, 0.83921] ),
|
137
|
+
:pale_goldenrod => ColorRGB.new( [0.93333, 0.90980, 0.66666] ),
|
138
|
+
:pale_green => ColorRGB.new( [0.59607, 0.98431, 0.59607] ),
|
139
|
+
:pale_turquoise => ColorRGB.new( [0.68627, 0.93333, 0.93333] ),
|
140
|
+
:pale_violet_red => ColorRGB.new( [0.85882, 0.43921, 0.57647] ),
|
141
|
+
:papaya_whip => ColorRGB.new( [1.00000, 0.93725, 0.83529] ),
|
142
|
+
:peach_puff => ColorRGB.new( [1.00000, 0.85490, 0.72549] ),
|
143
|
+
:peru => ColorRGB.new( [0.80392, 0.52156, 0.24705] ),
|
144
|
+
:pink => ColorRGB.new( [1.00000, 0.75294, 0.79607] ),
|
145
|
+
:plum => ColorRGB.new( [0.86666, 0.62745, 0.86666] ),
|
146
|
+
:powder_blue => ColorRGB.new( [0.69019, 0.87843, 0.90196] ),
|
147
|
+
:purple => ColorRGB.new( [0.50196, 0.00000, 0.50196] ),
|
148
|
+
:red => ColorRGB.new( [1.00000, 0.00000, 0.00000] ),
|
149
|
+
:rosy_brown => ColorRGB.new( [0.73725, 0.56078, 0.56078] ),
|
150
|
+
:royal_blue => ColorRGB.new( [0.25490, 0.41176, 0.88235] ),
|
151
|
+
:saddle_brown => ColorRGB.new( [0.54509, 0.27058, 0.07450] ),
|
152
|
+
:salmon => ColorRGB.new( [0.98039, 0.50196, 0.44705] ),
|
153
|
+
:sandy_brown => ColorRGB.new( [0.95686, 0.64313, 0.37647] ),
|
154
|
+
:sea_green => ColorRGB.new( [0.18039, 0.54509, 0.34117] ),
|
155
|
+
:seashell => ColorRGB.new( [1.00000, 0.96078, 0.93333] ),
|
156
|
+
:sienna => ColorRGB.new( [0.62745, 0.32156, 0.17647] ),
|
157
|
+
:silver => ColorRGB.new( [0.75294, 0.75294, 0.75294] ),
|
158
|
+
:sky_blue => ColorRGB.new( [0.52941, 0.80784, 0.92156] ),
|
159
|
+
:slate_blue => ColorRGB.new( [0.41568, 0.35294, 0.80392] ),
|
160
|
+
:slate_gray => ColorRGB.new( [0.43921, 0.50196, 0.56470] ),
|
161
|
+
:snow => ColorRGB.new( [1.00000, 0.98039, 0.98039] ),
|
162
|
+
:spring_green => ColorRGB.new( [0.00000, 1.00000, 0.49803] ),
|
163
|
+
:steel_blue => ColorRGB.new( [0.27450, 0.50980, 0.70588] ),
|
164
|
+
:tan => ColorRGB.new( [0.82352, 0.70588, 0.54901] ),
|
165
|
+
:teal => ColorRGB.new( [0.00000, 0.50196, 0.50196] ),
|
166
|
+
:thistle => ColorRGB.new( [0.84705, 0.74901, 0.84705] ),
|
167
|
+
:tomato => ColorRGB.new( [1.00000, 0.38823, 0.27843] ),
|
168
|
+
:turquoise => ColorRGB.new( [0.25098, 0.87843, 0.81568] ),
|
169
|
+
:violet => ColorRGB.new( [0.93333, 0.50980, 0.93333] ),
|
170
|
+
:wheat => ColorRGB.new( [0.96078, 0.87058, 0.70196] ),
|
171
|
+
:white => ColorRGB.new( [1.00000, 1.00000, 1.00000] ),
|
172
|
+
:white_smoke => ColorRGB.new( [0.96078, 0.96078, 0.96078] ),
|
173
|
+
:yellow => ColorRGB.new( [1.00000, 1.00000, 0.00000] ),
|
174
|
+
:yellow_green => ColorRGB.new( [0.60392, 0.80392, 0.19607] )
|
175
|
+
})
|
176
|
+
end
|
177
|
+
end
|