Class: GamesAndRpgParadise::MovingTriangle
- Inherits:
-
Gosu::Window
show all
- Includes:
- Gosu
- Defined in:
- lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb
Constant Summary
collapse
- WIDTH =
800
- HEIGHT =
600
- TITLE =
'Moving triangle example'
Constants included
from Gosu
Gosu::COLOUR_AQUA, Gosu::COLOUR_BLACK, Gosu::COLOUR_BLUE, Gosu::COLOUR_CYAN, Gosu::COLOUR_FUCHSIA, Gosu::COLOUR_GOLD, Gosu::COLOUR_GRAY, Gosu::COLOUR_GREEN, Gosu::COLOUR_NONE, Gosu::COLOUR_RED, Gosu::COLOUR_STEELBLUE, Gosu::COLOUR_WHITE, Gosu::COLOUR_YELLOW
Instance Method Summary
collapse
-
#draw ⇒ Object
# === draw ========================================================================= #.
-
#draw_the_triangle ⇒ Object
# === draw_the_triangle ========================================================================= #.
-
#initialize(run_already = true) ⇒ MovingTriangle
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
-
#update ⇒ Object
# === update ========================================================================= #.
Methods included from Gosu
#gosu_tilable_image
#gosu_button_down?, #image, #image10?, #image1?, #image2?, #image3?, #image4?, #image5?, #image6?, #image7?, #image8?, #image9?, #on_left_arrow_pressed?, #on_right_arrow_pressed?, #q_means_quit, #set_font, #set_title, #sqrt, #tab_key?, #write_this_text
Constructor Details
#initialize(run_already = true) ⇒ MovingTriangle
34
35
36
37
38
39
40
41
|
# File 'lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb', line 34
def initialize(
run_already = true
)
super(WIDTH, HEIGHT)
set_title(TITLE)
reset
run if run_already
end
|
Instance Method Details
#draw ⇒ Object
70
71
72
|
# File 'lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb', line 70
def draw
draw_the_triangle
end
|
#draw_the_triangle ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb', line 77
def draw_the_triangle
draw_triangle(
2+@x_modifier, 2, @use_this_colour,
62+@x_modifier,
62,
@use_this_colour,
2+@x_modifier,
125,
@use_this_colour,
0, :default )
end
|
#reset ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb', line 46
def reset
@use_this_colour = COLOUR_RED
@x_modifier = 0
@current_time = ::Gosu.milliseconds / 1000.0
end
|
#run ⇒ Object
64
65
|
# File 'lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb', line 64
def run
end
|
#update ⇒ Object
96
97
98
99
100
101
102
103
|
# File 'lib/games_and_rpg_paradise/games/examples/gosu/moving_triangle.rb', line 96
def update
exit_on_q_button_press_event
@current_time += (Gosu.milliseconds / 1000.0)
if @current_time >= 1
@current_time -= 1
@x_modifier += 1
end
end
|