-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
56 lines (44 loc) · 1.2 KB
/
main.rb
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
54
55
56
require 'gosu'
require 'chipmunk'
require 'yaml'
require_relative 'audiomanager.rb'
require_relative 'gameoptions.rb'
require_relative 'zordinals.rb'
require_relative 'gamepadconfig.rb'
require_relative 'background.rb'
require_relative 'highscoresfile.rb'
require_relative 'shared.rb'
require_relative 'menustate.rb'
require_relative 'playerselectionstate.rb'
require_relative 'highscoresstate.rb'
require_relative 'gamestate.rb'
require_relative 'statemachine.rb'
SCREEN_WIDTH = 1024
SCREEN_HEIGHT = 768
class Main < Gosu::Window
def initialize
super(SCREEN_WIDTH, SCREEN_HEIGHT, false)
Shared::init(self)
HighScoresFile::set_window(self)
StateMachine.window = self
AudioManager.window = self
StateMachine.set_state :mainmenu, :restart# initial state
self.caption = "The Lost Battle"
end
def update
current_state.update if current_state.respond_to? 'update'
end
def draw
current_state.draw if current_state.respond_to? 'draw'
end
def button_down (id)
current_state.button_down id if current_state.respond_to? 'button_down'
end
def button_up (id)
current_state.button_up id if current_state.respond_to? 'button_up'
end
def current_state
StateMachine.state
end
end
Main.new.show