-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpause.rb
More file actions
35 lines (26 loc) · 717 Bytes
/
Copy pathpause.rb
File metadata and controls
35 lines (26 loc) · 717 Bytes
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
class Pause < State
def initialize game, old_state
@game = game
@screen = game.screen
@queue = game.queue
@old_state = old_state
@text = Text.new 0, 0, "Paused", 100
@text.center_x @screen.width
@text.center_y @screen.height
end
def update
@queue.each do |ev|
case ev
when Rubygame::KeyDownEvent
if ev.key == Rubygame::K_P or ev.key == Rubygame::K_ESCAPE
@game.switch_state @old_state
end
end
end
end
def draw
@screen.fill [0, 0, 0]
@text.draw @screen
@screen.flip
end
end