forked from NoahMilam/ruby_shootemup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_menu.rb
More file actions
53 lines (39 loc) · 1.03 KB
/
Copy pathstart_menu.rb
File metadata and controls
53 lines (39 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class StartMenu < State
def state_initialize
@selected_option = :game
@images = {
:title => Gosu::Image.new(@gosu, 'title.png', false),
}
@font = Gosu::Font.new(@gosu, "Helvetica Bold", 72)
@selected_color = 0xffff0000
@unselected_color = 0xffffffff
end
def update
end
def draw
@images[:title].draw(100, 50, UILayer)
play_text = @unselected_color
password_text = @unselected_color
if @selected_option == :game
play_text = @selected_color
else
password_text = @selected_color
end
@font.draw("Play", 100, 200, UILayer, 1.0, 1.0, play_text)
@font.draw("Password", 100, 300, UILayer, 1.0, 1.0, password_text)
end
def button_down(id)
if id == Gosu::KbEscape
@gosu.close
end
if id == Gosu::KbDown
@selected_option = :password
end
if id == Gosu::KbUp
@selected_option = :game
end
if id == Gosu::KbEnter || id == Gosu::KbReturn || id == Gosu:: KbSpace
@gosu.next_state(@selected_option)
end
end
end