This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
74 lines (59 loc) · 1.41 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
$gtk.reset
require 'lib/arrows.rb'
require 'lib/parallax.rb'
require 'lib/window.rb'
require 'lib/fps.rb'
require 'lib/platform.rb'
LAYERS = [
'layer1.png',
'layer2.png',
'layer3.png',
'layer4.png',
'layer5.png',
].map { |s| "assets/#{s}" }
def setup args
Platform.set
Window.set_args args
Utils.set_args args
Arrows.set_args args
Parallax.set_args args
Window.set_screen_size 1280, 720
Window.add_lock_line :left, 0, nil
Window.add_lock_line :right, 1280, nil
Window.add_lock_line :bottom, nil, 0
Window.add_lock_line :top, nil, 720
Window.add name: :root
Platform.except :emscripten {
Window.add(
name: :minimap,
w: 200,
position: :top_right,
shrink: true,
draggable: true,
focusable: true,
collision: true,
margin_left: -10,
margin_top: 10
)
}
args.state.setup_done = true
end
def tick args
setup args unless args.state.setup_done
# Renders the parallax
Parallax
.create(layers: LAYERS)
.update
.render_into(:root)
# Renders the arrow keys feedback visual
Arrows.create(size: 200, active_alpha: 50, inactive_alpha: 22)
Platform.except :emscripten { Arrows.update }
Arrows.render_into(:root)
Window.render :root
Platform.except :emscripten {
Window.render :minimap, from: :root
Window.mainloop
}
# Just a small helper to display FPS on top of everything
FPS.render_standalone :debug
end