-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
48 lines (37 loc) · 977 Bytes
/
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
# main game loop coldly stolen from http://rubygame.org/wiki/Generic_Game_Template
require 'rubygame'
require './mixmaster.rb'
class Game
def initialize
@screen = Rubygame::Screen.new [640,480], 0, [Rubygame::HWSURFACE, Rubygame::DOUBLEBUF]
@screen.title = "project ballin' dangerzone"
@queue = Rubygame::EventQueue.new
@clock = Rubygame::Clock.new
@clock.target_framerate = 60
@mixmaster = Mixmaster.new "./trax1.yml"
end
def run
@mixmaster.run
loop do
update
draw
@clock.tick
end
end
def update
@queue.each do |ev|
case ev
when Rubygame::QuitEvent
Rubygame.quit
exit
end
end
end
def draw
@screen.flip
end
end
game = Game.new
Rubygame.open_audio( {:frequency => 44100, :channels => 2} )
game.run
Rubygame.close_audio