-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello.rb
40 lines (38 loc) · 1.03 KB
/
hello.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
begin
# In case you use Gosu via RubyGems.
require 'rubygems'
rescue LoadError
# In case you don't.
end
require 'mainapp'
require 'subapp'
require 'dummy'
require 'dummy2'
# Constants
Buttons = {
:Fire => [
Button::KbReturn,
Button::KbEnter,
Button::GpButton0,
Button::MsLeft
],
:Escape => [
Button::KbEscape,
Button::GpButton4
]
}
game = nil
main = MainApp.new(800, 600, false, 20)
main.caption = "Gosu Katas"
# TODO: find out what Nightly Witch uses the lambda and game var for.
# I _think_ the lambda is used to execute the next subapp. So when the subapp ends, the lambda block does too.
dummy = Dummy.new(main, lambda { game }, lambda { |i| game = Game.new(main, i) })
# The first parameter is the previous subapp? the second is itself?
# This command line only shows Dummy2:
dummy2 = Dummy2.new(main, lambda {game}, lambda { |i| dummy.show })
# This one shows them overlaid.
# dummy2 = Dummy2.new(main, lambda {dummy}, lambda { |i| dummy.show })
# dummy = Dummy.new(main)
# Start the subapp.
dummy2.show
main.show