gglib 1.1.0
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/gemspec.txt +15 -0
- data/gglib-1.1.tar.gz +0 -0
- data/gglib.gemspec +15 -0
- data/gglib.tar +0 -0
- data/lib/camera.rb +7 -0
- data/lib/carray.rb +71 -0
- data/lib/examples/BasicExample.rb +71 -0
- data/lib/examples/ConsoleDemo.rb +26 -0
- data/lib/examples/FadeIn.rb +40 -0
- data/lib/examples/SplashScreen.rb +30 -0
- data/lib/ext/menus.rb +0 -0
- data/lib/ext/splash.rb +42 -0
- data/lib/ext/themes.rb +159 -0
- data/lib/ext/widgets.rb +349 -0
- data/lib/gglib.rb +13 -0
- data/lib/image.rb +177 -0
- data/lib/mouse.rb +63 -0
- data/lib/null.rb +1 -0
- data/lib/state.rb +137 -0
- data/lib/theme.rb +205 -0
- data/lib/tile.rb +170 -0
- data/lib/widget.rb +206 -0
- data/lib/window.rb +324 -0
- metadata +74 -0
data/lib/mouse.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
module GGLib
|
2
|
+
|
3
|
+
class Cursor
|
4
|
+
attr_reader :img, :visible, :imgObj
|
5
|
+
def initialize(img,visible)
|
6
|
+
@img=img
|
7
|
+
@visible=visible
|
8
|
+
@imgObj=Gosu::Image.new($window,img,true)
|
9
|
+
@forced=false
|
10
|
+
end
|
11
|
+
def toggleVisible
|
12
|
+
if not @forced
|
13
|
+
@visible=!@visible
|
14
|
+
end
|
15
|
+
end
|
16
|
+
def forceVisible(visible=true)
|
17
|
+
@forced=true
|
18
|
+
@visible=visible
|
19
|
+
end
|
20
|
+
def unforceVisible
|
21
|
+
@forced=false
|
22
|
+
end
|
23
|
+
def visible?
|
24
|
+
return visible
|
25
|
+
end
|
26
|
+
def visible=(visible)
|
27
|
+
if not @forced
|
28
|
+
@visible=visible
|
29
|
+
end
|
30
|
+
end
|
31
|
+
def draw
|
32
|
+
if @visible
|
33
|
+
@imgObj.draw($window.mouse_x,$window.mouse_y,ZOrder::Cursor)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class MouseDragEvent
|
39
|
+
attr_reader :start_x, :start_y, :end_x, :end_y, :inprogress, :starting
|
40
|
+
def initialize
|
41
|
+
@start_x, @start_y = 0
|
42
|
+
@end_x, @end_y = 0
|
43
|
+
@inprogress = false
|
44
|
+
@starting = false
|
45
|
+
end
|
46
|
+
def start
|
47
|
+
@start_x, @start_y = $window.mouse_x, $window.mouse_y
|
48
|
+
@starting = true
|
49
|
+
end
|
50
|
+
def confirmStart
|
51
|
+
@starting = false
|
52
|
+
@inprogress = true
|
53
|
+
end
|
54
|
+
def end
|
55
|
+
@end_x, @end_y = $window.mouse_x, $window.mouse_y
|
56
|
+
@inprogress = false
|
57
|
+
end
|
58
|
+
def terminate
|
59
|
+
@inprogress, @starting = false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end #module GGLib
|
data/lib/null.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
#PlaceHolder Module
|
data/lib/state.rb
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
module GGLib
|
2
|
+
|
3
|
+
#A StaticScreen is a menu. It suspends the game and redirects all input to itself.
|
4
|
+
#StaticScreen is typically used through derivation, although it can be used otherwise.
|
5
|
+
#StaticScreen#start suspends the game and starts the menu. StaticScreen#end returns to the game.
|
6
|
+
|
7
|
+
class StateObject
|
8
|
+
#Begin rerouting input to the static screen. DO NOT OVERRIDE THIS METHOD.
|
9
|
+
def start
|
10
|
+
$window.deleteAllImages
|
11
|
+
$window.cursor.forceVisible
|
12
|
+
onStart
|
13
|
+
end
|
14
|
+
#Return control to the GameWindow. DO NOT OVERRIDE THIS METHOD.
|
15
|
+
def end
|
16
|
+
onEnd
|
17
|
+
$window.deleteAllWidgets
|
18
|
+
$window.createWidgets
|
19
|
+
$window.deleteAllImages
|
20
|
+
$window.cursor.unforceVisible
|
21
|
+
onTerminate
|
22
|
+
end
|
23
|
+
#Equivalent to Gosu::Window#button_down
|
24
|
+
def button_down(id)
|
25
|
+
#do nothing by default
|
26
|
+
end
|
27
|
+
#Equivalent to Gosu::Window#button_down
|
28
|
+
def button_up(id)
|
29
|
+
#do nothing by default
|
30
|
+
end
|
31
|
+
#Equivalent to Gosu::Window#update
|
32
|
+
def update
|
33
|
+
end
|
34
|
+
#Returns a reference to the window to which the static screen is associated.
|
35
|
+
def window
|
36
|
+
return $window
|
37
|
+
end
|
38
|
+
#This method is called when the static screen is initialized. It is ment to be overridden in derived classes.
|
39
|
+
#This is a good place to preform tasks such as creating widgets.
|
40
|
+
def onStart
|
41
|
+
end
|
42
|
+
#This method is called when the static screen is uninitialized. It is ment to be overridden in derived classes.
|
43
|
+
#This is a good place to preform tasks such as stopping audio. Widgets are automatically destroyed on exit by the base class StaticScreen
|
44
|
+
def onEnd
|
45
|
+
end
|
46
|
+
def onTerminate
|
47
|
+
end
|
48
|
+
#Equivalent to Gosu::Window#draw
|
49
|
+
def draw
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class MenuBase < StateObject
|
54
|
+
def button_down(id)
|
55
|
+
#if id == Gosu::Button::KbEscape
|
56
|
+
# close
|
57
|
+
if id == Gosu::Button::MsLeft
|
58
|
+
mouse($window.mouse_x,$window.mouse_y)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
def mouse(x,y)
|
62
|
+
#does nothing by default
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class FadeScreen < StateObject
|
67
|
+
public
|
68
|
+
attr_reader :widgetID
|
69
|
+
def initialize(fadeTo=nil, speed=1)
|
70
|
+
$faded=false
|
71
|
+
@image=Gosu::Image.new($window, $gglroot+"/media/black.bmp", true)
|
72
|
+
@fading=false
|
73
|
+
@speed=speed
|
74
|
+
@fadeTo=fadeTo
|
75
|
+
@color=Gosu::Color.new(0xffffffff)
|
76
|
+
end
|
77
|
+
def fading?
|
78
|
+
return @fading
|
79
|
+
end
|
80
|
+
def onStart
|
81
|
+
@fading=true
|
82
|
+
@alpha=0
|
83
|
+
end
|
84
|
+
def draw
|
85
|
+
if @fading
|
86
|
+
@alpha+=@speed
|
87
|
+
if @alpha > 255
|
88
|
+
@alpha=255
|
89
|
+
end
|
90
|
+
@color.alpha=@alpha
|
91
|
+
@image.draw(0, 0, ZOrder::Top+1, 640, 480, @color)
|
92
|
+
if @alpha == 255
|
93
|
+
endFade
|
94
|
+
@widgetID = FadeIn.new(@speed)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
def endFade
|
99
|
+
@fading=false
|
100
|
+
@image=nil
|
101
|
+
self.end
|
102
|
+
@fadeTo.start if @fadeTo!=nil
|
103
|
+
end
|
104
|
+
|
105
|
+
class FadeIn < Widget
|
106
|
+
def initialize(speed=5)
|
107
|
+
@image=Gosu::Image.new($window, $gglroot+"/media/black.bmp", true)
|
108
|
+
@speed=speed
|
109
|
+
@color=Gosu::Color.new(0x00ffffff)
|
110
|
+
@alpha=255
|
111
|
+
super(Button::Image, 0, 0, 0, 0)
|
112
|
+
wakeUp
|
113
|
+
stickFocus
|
114
|
+
$window.setFocus(nil)
|
115
|
+
end
|
116
|
+
def draw
|
117
|
+
@alpha-=@speed
|
118
|
+
if @alpha < 0
|
119
|
+
@alpha=0
|
120
|
+
end
|
121
|
+
@color.alpha=@alpha
|
122
|
+
@image.draw(0, 0, ZOrder::Top+1, 640, 480, @color)
|
123
|
+
if @alpha == 0
|
124
|
+
endFade
|
125
|
+
end
|
126
|
+
end
|
127
|
+
def endFade
|
128
|
+
unstickFocus
|
129
|
+
$window.setFocus(nil)
|
130
|
+
del
|
131
|
+
$faded=true
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end #module GGLib
|
data/lib/theme.rb
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
module GGLib
|
2
|
+
|
3
|
+
class Theme
|
4
|
+
attr_reader :name
|
5
|
+
def setDefaultState
|
6
|
+
end
|
7
|
+
def setOverState
|
8
|
+
end
|
9
|
+
def setDownState
|
10
|
+
end
|
11
|
+
#Returns an estimated width for the Theme. (May not be equal to the actual width.)
|
12
|
+
def width
|
13
|
+
end
|
14
|
+
#Returns an estimated height for the Theme. (May not be equal to the actual height.)
|
15
|
+
def height
|
16
|
+
end
|
17
|
+
def request(obj)
|
18
|
+
return self
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class ImageTheme < Theme
|
23
|
+
attr_reader :image, :font, :width, :height
|
24
|
+
def initialize(name, font, image)
|
25
|
+
@name = name
|
26
|
+
@image = image
|
27
|
+
@width = Gosu::Image.new($window, @image.default).width
|
28
|
+
@height = Gosu::Image.new($window, @image.default).height
|
29
|
+
@font = font
|
30
|
+
end
|
31
|
+
def newInstance(obj)
|
32
|
+
return ImageThemeInstance.new(self, obj)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class DrawnTheme < Theme
|
37
|
+
attr_reader :font
|
38
|
+
def initialize(name, font)
|
39
|
+
@name = name
|
40
|
+
@font = font
|
41
|
+
end
|
42
|
+
def newInstance(obj)
|
43
|
+
return DrawnThemeInstance.new(self, obj)
|
44
|
+
end
|
45
|
+
def width
|
46
|
+
return 200
|
47
|
+
end
|
48
|
+
def height
|
49
|
+
return 50
|
50
|
+
end
|
51
|
+
def draw(x1, y1, x2, y2, state)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class ThemeInstance
|
56
|
+
def initialize(klass, wid)
|
57
|
+
@klass = klass
|
58
|
+
@state = 1
|
59
|
+
@widget = wid
|
60
|
+
@x1 = @widget.x1
|
61
|
+
@y1 = @widget.y1
|
62
|
+
@x2 = @widget.x2
|
63
|
+
@y2 = @widget.y2
|
64
|
+
@klass = @klass.request(@widget)
|
65
|
+
end
|
66
|
+
def setCoords(x1,y1,x2,y2)
|
67
|
+
@x1 = x1
|
68
|
+
@y1 = y1
|
69
|
+
@x2 = x2
|
70
|
+
@y2 = y2
|
71
|
+
end
|
72
|
+
def setDefaultState
|
73
|
+
@state = 1
|
74
|
+
end
|
75
|
+
def setOverState
|
76
|
+
@state = 2
|
77
|
+
end
|
78
|
+
def setDownState
|
79
|
+
@state = 3
|
80
|
+
end
|
81
|
+
def setSleepState
|
82
|
+
end
|
83
|
+
def setWakeState
|
84
|
+
@state = 1
|
85
|
+
end
|
86
|
+
def font
|
87
|
+
return @klass.font
|
88
|
+
end
|
89
|
+
def name
|
90
|
+
return @klass.name
|
91
|
+
end
|
92
|
+
def width
|
93
|
+
return @klass.width
|
94
|
+
end
|
95
|
+
def height
|
96
|
+
return @klass.height
|
97
|
+
end
|
98
|
+
def draw
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class ImageThemeInstance < ThemeInstance
|
103
|
+
def initialize(klass, wid)
|
104
|
+
super(klass, wid)
|
105
|
+
@image = $window.newTexture(@x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
|
106
|
+
end
|
107
|
+
def setCoords(x1,y1,x2,y2)
|
108
|
+
super(x1,y1,x2,y2)
|
109
|
+
return if @image == -1
|
110
|
+
if @state == 1
|
111
|
+
$window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
|
112
|
+
elsif @state == 2
|
113
|
+
$window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.over)
|
114
|
+
elsif @state == 3
|
115
|
+
$window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.down)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
def setDefaultState
|
119
|
+
super
|
120
|
+
$window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
|
121
|
+
end
|
122
|
+
def setOverState
|
123
|
+
super
|
124
|
+
$window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.over)
|
125
|
+
end
|
126
|
+
def setDownState
|
127
|
+
super
|
128
|
+
$window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.down)
|
129
|
+
end
|
130
|
+
def setSleepState
|
131
|
+
super
|
132
|
+
@image = -1
|
133
|
+
$window.deleteImage(@image)
|
134
|
+
end
|
135
|
+
def setWakeState
|
136
|
+
super
|
137
|
+
@image = $window.newTexture(@x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
|
138
|
+
end
|
139
|
+
def image
|
140
|
+
return @klass.image
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class DrawnThemeInstance < ThemeInstance
|
145
|
+
def draw
|
146
|
+
@klass.draw(@x1, @y1, @x2, @y2, @state)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
class ThemeFontGroup
|
151
|
+
attr_accessor :default, :header, :editable, :color, :selcolor
|
152
|
+
def initialize(default, header, editable, color=0xff000000, selcolor=0xff33FFFF)
|
153
|
+
@default = default
|
154
|
+
@header = header
|
155
|
+
@editable = editable
|
156
|
+
@color = color
|
157
|
+
@selcolor = selcolor
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
class ThemeImageGroup
|
162
|
+
attr_accessor :default, :over, :down
|
163
|
+
def initialize(default, over, down)
|
164
|
+
@default = default
|
165
|
+
@over = over
|
166
|
+
@down = down
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
module Themes
|
171
|
+
public
|
172
|
+
def Themes.blank
|
173
|
+
ImageTheme.new(
|
174
|
+
"BlankTheme",
|
175
|
+
ThemeFontGroup.new(
|
176
|
+
Gosu::Font.new($window, Gosu::default_font_name, 17),
|
177
|
+
Gosu::Font.new($window, Gosu::default_font_name, 25),
|
178
|
+
Gosu::Font.new($window, Gosu::default_font_name, 20)
|
179
|
+
),
|
180
|
+
ThemeImageGroup.new(
|
181
|
+
$gglroot+"/null.png",
|
182
|
+
$gglroot+"/null.png",
|
183
|
+
$gglroot+"/null.png"
|
184
|
+
)
|
185
|
+
)
|
186
|
+
end
|
187
|
+
|
188
|
+
def Themes.tracePanel
|
189
|
+
ImageTheme.new(
|
190
|
+
"TraceTheme",
|
191
|
+
ThemeFontGroup.new(
|
192
|
+
Gosu::Font.new($window, Gosu::default_font_name, 17),
|
193
|
+
Gosu::Font.new($window, Gosu::default_font_name, 25),
|
194
|
+
Gosu::Font.new($window, Gosu::default_font_name, 20)
|
195
|
+
),
|
196
|
+
ThemeImageGroup.new(
|
197
|
+
$gglroot+"/media/trace.png",
|
198
|
+
$gglroot+"/null.png",
|
199
|
+
$gglroot+"/null.png"
|
200
|
+
)
|
201
|
+
)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
end #module GGLib
|
data/lib/tile.rb
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
module GGLib
|
2
|
+
|
3
|
+
#The Tile class represents a rectangular region on the screen.
|
4
|
+
#It is synonymous with the Rect structure used in many C programs.
|
5
|
+
class Tile
|
6
|
+
@@tiles = CArray.new
|
7
|
+
#@@tile = []
|
8
|
+
attr_accessor :x1,:y1,:x2,:y2,:inclusive,:id
|
9
|
+
#@inclusive decides whether or not tile edges are considered part of the tile
|
10
|
+
def initialize(x1=0,y1=0,x2=1,y2=1,inclusive=true,id=nil) #id parameter is for use by saveload ONLY!!!!
|
11
|
+
@x1,@y1,@x2,@y2=x1,y1,x2,y2
|
12
|
+
#begin
|
13
|
+
# @x1+=0;@y1+=0;@x2+=0;@y2+=0 #check if coordinate is actually a proc (damn dynamic typing...)
|
14
|
+
#rescue
|
15
|
+
# raise "Bad coord: ID#{@@tiles.size+1}"
|
16
|
+
#end
|
17
|
+
@inclusive=inclusive
|
18
|
+
#@name=name
|
19
|
+
if id==nil
|
20
|
+
@id=@@tiles.size #volatile, id overwritten by derived classes
|
21
|
+
@tileno=@id #secure copy of id
|
22
|
+
@@tiles << self
|
23
|
+
else
|
24
|
+
@id=id
|
25
|
+
@tileno=id
|
26
|
+
@@tiles[id]=self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#Find out if a point is located in the tile
|
31
|
+
def isInTile?(x,y)
|
32
|
+
if @inclusive
|
33
|
+
return iTile(x,y)
|
34
|
+
else
|
35
|
+
return xTile(x,y)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
alias contains? isInTile?
|
40
|
+
|
41
|
+
#Redefine the tile
|
42
|
+
def setCoordinates(x1,y1,x2,y2)
|
43
|
+
@x1,@y1,@x2,@y2=x1,y1,x2,y2
|
44
|
+
end
|
45
|
+
|
46
|
+
#Redefine the tile
|
47
|
+
def setTile(x1,y1,x2,y2)
|
48
|
+
@x1,@y1,@x2,@y2=x1,y1,x2,y2
|
49
|
+
end
|
50
|
+
|
51
|
+
#Translate the coordinates of the tile so that the thop left corner of the tile is at the given coordinates
|
52
|
+
def move(x,y=@y)
|
53
|
+
@x2=x+(@x2-@x1)
|
54
|
+
@y2=y+(@y2-@y1)
|
55
|
+
@y1=y
|
56
|
+
@x1=x
|
57
|
+
end
|
58
|
+
|
59
|
+
#translate the cordinates of the tile so that the center of the tile is at the given point
|
60
|
+
def centerOn(x, y)
|
61
|
+
hwidth=((@x2-@x1)/2).ceil.abs
|
62
|
+
hheight=((@y2-@y1)/2).ceil.abs
|
63
|
+
@x2=x+hwidth
|
64
|
+
@y2=y+hheight
|
65
|
+
@y1=y-hheight
|
66
|
+
@x1=x-hwidth
|
67
|
+
end
|
68
|
+
|
69
|
+
#Returns the width of the tile
|
70
|
+
def height
|
71
|
+
return (@y2-@y1).abs
|
72
|
+
end
|
73
|
+
|
74
|
+
#Returns the hiehgt of the tile
|
75
|
+
def width
|
76
|
+
return (@x2-@x1).abs
|
77
|
+
end
|
78
|
+
|
79
|
+
#Find out if a point is located in the tile, including the edges of the tile
|
80
|
+
def iTile(x,y)
|
81
|
+
return (x>=@x1 and x<=@x2 and y>=@y1 and y<=@y2)
|
82
|
+
end
|
83
|
+
|
84
|
+
#Find out if a point is located in the tile, *not* including the edges of the tile
|
85
|
+
def xTile(x,y)
|
86
|
+
return (x>@x1 and x<@x2 and y>@y1 and y<@y2)
|
87
|
+
end
|
88
|
+
|
89
|
+
#Iterates over all of the encompased by the tile
|
90
|
+
def each
|
91
|
+
@x1.upto(@x2) { |x|
|
92
|
+
@y1.upto(@y2) { |y|
|
93
|
+
yield x,y
|
94
|
+
}
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
#Iterates over all of the points on the edges of the tile
|
99
|
+
def eachBorder(xindent=0,yindent=0)
|
100
|
+
(@x1+xindent).upto(@x2-xindent) { |x|
|
101
|
+
yield x, @y1+yindent
|
102
|
+
}
|
103
|
+
|
104
|
+
(@x1+xindent).upto(@x2-xindent) { |x|
|
105
|
+
yield x, @y2+yindent
|
106
|
+
}
|
107
|
+
|
108
|
+
(@y1+xindent).upto(@y2-xindent) { |y|
|
109
|
+
yield @x1+xindent, y
|
110
|
+
}
|
111
|
+
|
112
|
+
(@y1+xindent).upto(@y2-xindent) { |y|
|
113
|
+
yield @x2+xindent, y
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
117
|
+
public
|
118
|
+
#See Tile::intersect?
|
119
|
+
def intersect?(tile)
|
120
|
+
return Tile::intersect?(self,tile)
|
121
|
+
end
|
122
|
+
|
123
|
+
#Find out if the given two tiles intersect.
|
124
|
+
def Tile.intersect?(tile1,tile2)
|
125
|
+
return ((tile2.x1 < tile1.x2) and (tile2.x2 > tile1.x1) and (tile2.y1 < tile1.y2) and (tile2.y2 > tile1.y1))
|
126
|
+
end
|
127
|
+
|
128
|
+
#Returns the tile with the given index
|
129
|
+
def Tile.getById(id)
|
130
|
+
if @@tiles[id]!=nil
|
131
|
+
return @@tiles[id]
|
132
|
+
else
|
133
|
+
return false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
#Deletes the tile with the given index
|
138
|
+
def Tile.deleteById(id)
|
139
|
+
if @@tiles[id]!=nil
|
140
|
+
@@tiles[id].del
|
141
|
+
@@tiles.delete_at(id)
|
142
|
+
return true
|
143
|
+
else
|
144
|
+
return false
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
#Returns an array of all tiles
|
149
|
+
def Tile.getAllInstances
|
150
|
+
return @@tiles
|
151
|
+
end
|
152
|
+
|
153
|
+
#Override the internal array of tiles with a new one
|
154
|
+
def Tile.setAllInstances(ntiles)
|
155
|
+
@@tiles=ntiles
|
156
|
+
end
|
157
|
+
|
158
|
+
#Delete all tiles int the program. (Includes classes derived from tiles)
|
159
|
+
def Tile.deleteAllInstances
|
160
|
+
@@tiles=CArray.new
|
161
|
+
end
|
162
|
+
|
163
|
+
#Deletes the calling tile
|
164
|
+
def del
|
165
|
+
@@tiles.delete_at(@tileno)
|
166
|
+
@x1,@y1,@x2,@y2,@inclusive,@id,@tileno=nil
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end #module GGLib
|