glimmer-dsl-libui 0.2.0 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/README.md +975 -23
  4. data/VERSION +1 -1
  5. data/examples/area_gallery.rb +7 -1
  6. data/examples/area_gallery2.rb +14 -4
  7. data/examples/area_gallery3.rb +8 -2
  8. data/examples/area_gallery4.rb +15 -5
  9. data/examples/basic_draw_text.rb +65 -0
  10. data/examples/basic_draw_text2.rb +68 -0
  11. data/examples/color_the_circles.rb +220 -0
  12. data/examples/custom_draw_text.rb +84 -0
  13. data/examples/custom_draw_text2.rb +95 -0
  14. data/examples/midi_player.rb +2 -2
  15. data/examples/timer.rb +135 -0
  16. data/glimmer-dsl-libui.gemspec +0 -0
  17. data/lib/glimmer/dsl/libui/control_expression.rb +0 -1
  18. data/lib/glimmer/dsl/libui/property_expression.rb +3 -1
  19. data/lib/glimmer/dsl/libui/string_expression.rb +48 -0
  20. data/lib/glimmer/libui/attributed_string.rb +135 -0
  21. data/lib/glimmer/libui/control_proxy/area_proxy.rb +14 -3
  22. data/lib/glimmer/libui/control_proxy/color_button_proxy.rb +0 -1
  23. data/lib/glimmer/libui/control_proxy/combobox_proxy.rb +18 -0
  24. data/lib/glimmer/libui/control_proxy/font_button_proxy.rb +3 -3
  25. data/lib/glimmer/libui/control_proxy/menu_item_proxy/radio_menu_item_proxy.rb +69 -0
  26. data/lib/glimmer/libui/control_proxy/menu_proxy.rb +3 -0
  27. data/lib/glimmer/libui/control_proxy/path_proxy.rb +0 -2
  28. data/lib/glimmer/libui/control_proxy/text_proxy.rb +172 -0
  29. data/lib/glimmer/libui/control_proxy/window_proxy.rb +0 -6
  30. data/lib/glimmer/libui/control_proxy.rb +7 -1
  31. data/lib/glimmer/libui/shape/arc.rb +6 -3
  32. data/lib/glimmer/libui/shape/circle.rb +50 -0
  33. data/lib/glimmer/libui/shape/rectangle.rb +4 -0
  34. data/lib/glimmer/libui/shape/square.rb +4 -0
  35. data/lib/glimmer/libui.rb +73 -6
  36. metadata +13 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.2.4
@@ -41,11 +41,17 @@ window('Area Gallery', 400, 400) {
41
41
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
42
42
  }
43
43
  path { # declarative stable path
44
- arc(200, 200, 90, 0, 360, false)
44
+ circle(200, 200, 90)
45
45
 
46
46
  fill r: 202, g: 102, b: 204, a: 0.5
47
47
  stroke r: 0, g: 0, b: 0, thickness: 2
48
48
  }
49
+ path { # declarative stable path
50
+ arc(400, 220, 180, 90, 90, false)
51
+
52
+ fill r: 204, g: 102, b: 204, a: 0.5
53
+ stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
54
+ }
49
55
 
50
56
  on_mouse_event do |area_mouse_event|
51
57
  p area_mouse_event
@@ -95,18 +95,28 @@ window('Area Gallery', 400, 400) {
95
95
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
96
96
  }
97
97
  path { # declarative stable path
98
- arc {
98
+ circle {
99
99
  x_center 200
100
100
  y_center 200
101
101
  radius 90
102
- start_angle 0
103
- sweep 360
104
- is_negative false
105
102
  }
106
103
 
107
104
  fill r: 202, g: 102, b: 204, a: 0.5
108
105
  stroke r: 0, g: 0, b: 0, thickness: 2
109
106
  }
107
+ path { # declarative stable path
108
+ arc {
109
+ x_center 400
110
+ y_center 220
111
+ radius 180
112
+ start_angle 90
113
+ sweep 90
114
+ is_negative false
115
+ }
116
+
117
+ fill r: 204, g: 102, b: 204, a: 0.5
118
+ stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
119
+ }
110
120
 
111
121
  on_mouse_event do |area_mouse_event|
112
122
  p area_mouse_event
@@ -42,11 +42,17 @@ window('Area Gallery', 400, 400) {
42
42
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
43
43
  }
44
44
  path { # a dynamic path is added semi-declaratively inside on_draw block
45
- arc(200, 200, 90, 0, 360, false)
46
-
45
+ circle(200, 200, 90)
46
+
47
47
  fill r: 202, g: 102, b: 204, a: 0.5
48
48
  stroke r: 0, g: 0, b: 0, thickness: 2
49
49
  }
50
+ path { # a dynamic path is added semi-declaratively inside on_draw block
51
+ arc(400, 220, 180, 90, 90, false)
52
+
53
+ fill r: 204, g: 102, b: 204, a: 0.5
54
+ stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
55
+ }
50
56
  end
51
57
 
52
58
  on_mouse_event do |area_mouse_event|
@@ -96,18 +96,28 @@ window('Area Gallery', 400, 400) {
96
96
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
97
97
  }
98
98
  path { # a dynamic path is added semi-declaratively inside on_draw block
99
- arc {
99
+ circle {
100
100
  x_center 200
101
101
  y_center 200
102
102
  radius 90
103
- start_angle 0
104
- sweep 360
105
- is_negative false
106
103
  }
107
-
104
+
108
105
  fill r: 202, g: 102, b: 204, a: 0.5
109
106
  stroke r: 0, g: 0, b: 0, thickness: 2
110
107
  }
108
+ path { # a dynamic path is added semi-declaratively inside on_draw block
109
+ arc {
110
+ x_center 400
111
+ y_center 220
112
+ radius 180
113
+ start_angle 90
114
+ sweep 90
115
+ is_negative false
116
+ }
117
+
118
+ fill r: 204, g: 102, b: 204, a: 0.5
119
+ stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
120
+ }
111
121
  end
112
122
 
113
123
  on_mouse_event do |area_mouse_event|
@@ -0,0 +1,65 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ # Michael Ende (1929-1995)
4
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
5
+ # The English version, translated by Ralph Manheim, was published in 1983.
6
+ class BasicDrawText
7
+ include Glimmer
8
+
9
+ def alternating_color_string(initial: false, &block)
10
+ @index = 0 if initial
11
+ @index += 1
12
+ string {
13
+ if @index.odd?
14
+ color r: 128, g: 0, b: 64, a: 0.7
15
+ else
16
+ color r: 0, g: 128, b: 0, a: 0.7
17
+ end
18
+
19
+ block.call + "\n\n"
20
+ }
21
+ end
22
+
23
+ def launch
24
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
25
+ margined true
26
+
27
+ area {
28
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
29
+ # align :left # default alignment
30
+ default_font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
31
+
32
+ alternating_color_string(initial: true) {
33
+ ' At last Ygramul sensed that something was coming toward ' \
34
+ 'her. With the speed of lightning, she turned about, confronting ' \
35
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
36
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. '
37
+ }
38
+ alternating_color_string {
39
+ ' A cry of fear escaped Bastian. '
40
+ }
41
+ alternating_color_string {
42
+ ' A cry of terror passed through the ravine and echoed from ' \
43
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
44
+ 'someone else had arrived, for that sound could not have been ' \
45
+ 'made by the boy who stood there as though paralyzed with ' \
46
+ 'horror. '
47
+ }
48
+ alternating_color_string {
49
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
50
+ "But that's not possible. "
51
+ }
52
+ alternating_color_string {
53
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
54
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
55
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
56
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
57
+ 'words. '
58
+ }
59
+ }
60
+ }
61
+ }.show
62
+ end
63
+ end
64
+
65
+ BasicDrawText.new.launch
@@ -0,0 +1,68 @@
1
+
2
+ require 'glimmer-dsl-libui'
3
+
4
+ # Michael Ende (1929-1995)
5
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
6
+ # The English version, translated by Ralph Manheim, was published in 1983.
7
+ class BasicDrawText
8
+ include Glimmer
9
+
10
+ def alternating_color_string(initial: false, &block)
11
+ @index = 0 if initial
12
+ @index += 1
13
+ string {
14
+ if @index.odd?
15
+ color r: 128, g: 0, b: 64, a: 0.7
16
+ else
17
+ color r: 0, g: 128, b: 0, a: 0.7
18
+ end
19
+
20
+ block.call + "\n\n"
21
+ }
22
+ end
23
+
24
+ def launch
25
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
26
+ margined true
27
+
28
+ area {
29
+ on_draw do |area_draw_params|
30
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
31
+ # align :left # default alignment
32
+ default_font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
33
+
34
+ alternating_color_string(initial: true) {
35
+ ' At last Ygramul sensed that something was coming toward ' \
36
+ 'her. With the speed of lightning, she turned about, confronting ' \
37
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
38
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. '
39
+ }
40
+ alternating_color_string {
41
+ ' A cry of fear escaped Bastian. '
42
+ }
43
+ alternating_color_string {
44
+ ' A cry of terror passed through the ravine and echoed from ' \
45
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
46
+ 'someone else had arrived, for that sound could not have been ' \
47
+ 'made by the boy who stood there as though paralyzed with ' \
48
+ 'horror. '
49
+ }
50
+ alternating_color_string {
51
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
52
+ "But that's not possible. "
53
+ }
54
+ alternating_color_string {
55
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
56
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
57
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
58
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
59
+ 'words. '
60
+ }
61
+ }
62
+ end
63
+ }
64
+ }.show
65
+ end
66
+ end
67
+
68
+ BasicDrawText.new.launch
@@ -0,0 +1,220 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ class ColorTheCircles
4
+ include Glimmer
5
+
6
+ WINDOW_WIDTH = 800
7
+ WINDOW_HEIGHT = 600
8
+ CIRCLE_MIN_RADIUS = 15
9
+ CIRCLE_MAX_RADIUS = 50
10
+ MARGIN_WIDTH = 55
11
+ MARGIN_HEIGHT = 155
12
+ TIME_MAX_EASY = 4
13
+ TIME_MAX_MEDIUM = 3
14
+ TIME_MAX_HARD = 2
15
+ TIME_MAX_INSANE = 1
16
+
17
+ attr_accessor :score
18
+
19
+ def initialize
20
+ @circles_data = []
21
+ @score = 0
22
+ @time_max = TIME_MAX_HARD
23
+ @game_over = false
24
+ register_observers
25
+ setup_circle_factory
26
+ end
27
+
28
+ def register_observers
29
+ observer = Glimmer::DataBinding::Observer.proc do |new_score|
30
+ @score_label.text = new_score.to_s
31
+ if new_score == -20
32
+ @game_over = true
33
+ msg_box('You Lost!', 'Sorry! Your score reached -20')
34
+ restart_game
35
+ elsif new_score == 0
36
+ @game_over = true
37
+ msg_box('You Won!', 'Congratulations! Your score reached 0')
38
+ restart_game
39
+ end
40
+ end
41
+ observer.observe(self, :score) # automatically enhances self to become Glimmer::DataBinding::ObservableModel and notify observer on score attribute changes
42
+ end
43
+
44
+ def setup_circle_factory
45
+ consumer = Proc.new do
46
+ unless @game_over
47
+ if @circles_data.empty?
48
+ # start with 3 circles to make more challenging
49
+ add_circle until @circles_data.size > 3
50
+ else
51
+ add_circle
52
+ end
53
+ end
54
+ delay = rand * @time_max
55
+ Glimmer::LibUI.timer(delay, repeat: false, &consumer)
56
+ end
57
+ Glimmer::LibUI.queue_main(&consumer)
58
+ end
59
+
60
+ def add_circle
61
+ circle_x_center = rand * (WINDOW_WIDTH - MARGIN_WIDTH - CIRCLE_MAX_RADIUS) + CIRCLE_MAX_RADIUS
62
+ circle_y_center = rand * (WINDOW_HEIGHT - MARGIN_HEIGHT - CIRCLE_MAX_RADIUS) + CIRCLE_MAX_RADIUS
63
+ circle_radius = rand * (CIRCLE_MAX_RADIUS - CIRCLE_MIN_RADIUS) + CIRCLE_MIN_RADIUS
64
+ stroke_color = Glimmer::LibUI.x11_colors.sample
65
+ @circles_data << {
66
+ args: [circle_x_center, circle_y_center, circle_radius],
67
+ fill: nil,
68
+ stroke: stroke_color
69
+ }
70
+ @area.queue_redraw_all
71
+ self.score -= 1 # notifies score observers automatically of change
72
+ end
73
+
74
+ def restart_game
75
+ @score = 0 # update variable directly to avoid notifying observers
76
+ @circles_data.clear
77
+ @game_over = false
78
+ end
79
+
80
+ def color_circle(x, y)
81
+ clicked_circle_data = @circles_data.find do |circle_data|
82
+ circle_data[:fill].nil? && circle_data[:circle].include?(x, y)
83
+ end
84
+ if clicked_circle_data
85
+ clicked_circle_data[:fill] = clicked_circle_data[:stroke]
86
+ push_colored_circle_behind_uncolored_circles(clicked_circle_data)
87
+ @area.queue_redraw_all
88
+ self.score += 1 # notifies score observers automatically of change
89
+ end
90
+ end
91
+
92
+ def push_colored_circle_behind_uncolored_circles(colored_circle_data)
93
+ removed_colored_circle_data = @circles_data.delete(colored_circle_data)
94
+ last_colored_circle_data = @circles_data.select {|cd| cd[:fill]}.last
95
+ last_colored_circle_data_index = @circles_data.index(last_colored_circle_data) || -1
96
+ @circles_data.insert(last_colored_circle_data_index + 1, removed_colored_circle_data)
97
+ end
98
+
99
+ def launch
100
+ menu('Actions') {
101
+ menu_item('Restart') {
102
+ on_clicked do
103
+ restart_game
104
+ end
105
+ }
106
+
107
+ quit_menu_item
108
+ }
109
+
110
+ menu('Difficulty') {
111
+ radio_menu_item('Easy') {
112
+ on_clicked do
113
+ @time_max = TIME_MAX_EASY
114
+ end
115
+ }
116
+
117
+ radio_menu_item('Medium') {
118
+ on_clicked do
119
+ @time_max = TIME_MAX_MEDIUM
120
+ end
121
+ }
122
+
123
+ radio_menu_item('Hard') {
124
+ checked true
125
+
126
+ on_clicked do
127
+ @time_max = TIME_MAX_HARD
128
+ end
129
+ }
130
+
131
+ radio_menu_item('Insane') {
132
+ on_clicked do
133
+ @time_max = TIME_MAX_INSANE
134
+ end
135
+ }
136
+ }
137
+
138
+ menu('Help') {
139
+ menu_item('Instructions') {
140
+ on_clicked do
141
+ msg_box('Instructions', "Score goes down as circles are added.\nIf it reaches -20, you lose!\n\nClick circles to color and score!\nOnce score reaches 0, you win!\n\nBeware of concealed light-colored circles!\nThey are revealed once darker circles intersect them.\n\nThere are four levels of difficulty.\nChange via difficulty menu if the game gets too tough.")
142
+ end
143
+ }
144
+ }
145
+
146
+ window('Color The Circles', WINDOW_WIDTH, WINDOW_HEIGHT) {
147
+ margined true
148
+
149
+ grid {
150
+ button('Restart') {
151
+ left 0
152
+ top 0
153
+ halign :center
154
+
155
+ on_clicked do
156
+ restart_game
157
+ end
158
+ }
159
+
160
+ label('Score goes down as circles are added. If it reaches -20, you lose!') {
161
+ left 0
162
+ top 1
163
+ halign :center
164
+ }
165
+
166
+ label('Click circles to color and score! Once score reaches 0, you win!') {
167
+ left 0
168
+ top 2
169
+ halign :center
170
+ }
171
+
172
+ horizontal_box {
173
+ left 0
174
+ top 3
175
+ halign :center
176
+
177
+ label('Score:') {
178
+ stretchy false
179
+ }
180
+
181
+ @score_label = label(@score.to_s) {
182
+ stretchy false
183
+ }
184
+ }
185
+
186
+ @area = area {
187
+ left 0
188
+ top 4
189
+ hexpand true
190
+ vexpand true
191
+ halign :fill
192
+ valign :fill
193
+
194
+ on_draw do |area_draw_params|
195
+ path {
196
+ rectangle(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
197
+
198
+ fill :white
199
+ }
200
+
201
+ @circles_data.each do |circle_data|
202
+ path {
203
+ circle_data[:circle] = circle(*circle_data[:args])
204
+
205
+ fill circle_data[:fill]
206
+ stroke circle_data[:stroke]
207
+ }
208
+ end
209
+ end
210
+
211
+ on_mouse_down do |area_mouse_event|
212
+ color_circle(area_mouse_event[:x], area_mouse_event[:y])
213
+ end
214
+ }
215
+ }
216
+ }.show
217
+ end
218
+ end
219
+
220
+ ColorTheCircles.new.launch
@@ -0,0 +1,84 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ # Michael Ende (1929-1995)
4
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
5
+ # The English version, translated by Ralph Manheim, was published in 1983.
6
+ class CustomDrawText
7
+ include Glimmer
8
+
9
+ def launch
10
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
11
+ margined true
12
+
13
+ vertical_box {
14
+ form {
15
+ stretchy false
16
+
17
+ font_button { |fb|
18
+ label 'Font'
19
+
20
+ on_changed do
21
+ @string.font = fb.font
22
+ end
23
+ }
24
+ color_button { |cb|
25
+ label 'Color'
26
+
27
+ on_changed do
28
+ @string.color = cb.color
29
+ end
30
+ }
31
+ color_button { |cb|
32
+ label 'Background'
33
+
34
+ on_changed do
35
+ @string.background = cb.color
36
+ end
37
+ }
38
+ combobox { |c|
39
+ label 'Underline'
40
+ items Glimmer::LibUI.enum_symbols(:underline).map(&:to_s).map {|word| word.split('_').map(&:capitalize).join(' ')}
41
+ selected 'None'
42
+
43
+ on_selected do
44
+ @string.underline = c.selected_item.underscore
45
+ end
46
+ }
47
+ }
48
+
49
+ area {
50
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
51
+ # align :left # default alignment
52
+
53
+ @string = string {
54
+ ' At last Ygramul sensed that something was coming toward ' \
55
+ 'her. With the speed of lightning, she turned about, confronting ' \
56
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
57
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. ' \
58
+ "\n\n" \
59
+ ' A cry of fear escaped Bastian. ' \
60
+ "\n\n" \
61
+ ' A cry of terror passed through the ravine and echoed from ' \
62
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
63
+ 'someone else had arrived, for that sound could not have been ' \
64
+ 'made by the boy who stood there as though paralyzed with ' \
65
+ 'horror. ' \
66
+ "\n\n" \
67
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
68
+ "But that's not possible. " \
69
+ "\n\n" \
70
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
71
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
72
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
73
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
74
+ 'words. ' \
75
+ "\n\n"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }.show
81
+ end
82
+ end
83
+
84
+ CustomDrawText.new.launch
@@ -0,0 +1,95 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ # Michael Ende (1929-1995)
4
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
5
+ # The English version, translated by Ralph Manheim, was published in 1983.
6
+ class CustomDrawText
7
+ include Glimmer
8
+
9
+ def launch
10
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
11
+ margined true
12
+
13
+ vertical_box {
14
+ form {
15
+ stretchy false
16
+
17
+ font_button { |fb|
18
+ label 'Font'
19
+
20
+ on_changed do
21
+ @font = fb.font
22
+ @area.queue_redraw_all
23
+ end
24
+ }
25
+ color_button { |cb|
26
+ label 'Color'
27
+
28
+ on_changed do
29
+ @color = cb.color
30
+ @area.queue_redraw_all
31
+ end
32
+ }
33
+ color_button { |cb|
34
+ label 'Background'
35
+
36
+ on_changed do
37
+ @background = cb.color
38
+ @area.queue_redraw_all
39
+ end
40
+ }
41
+ combobox { |c|
42
+ label 'Underline'
43
+ items Glimmer::LibUI.enum_symbols(:underline).map(&:to_s).map {|word| word.split('_').map(&:capitalize).join(' ')}
44
+ selected 'None'
45
+
46
+ on_selected do
47
+ @underline = c.selected_item.underscore
48
+ @area.queue_redraw_all
49
+ end
50
+ }
51
+ }
52
+
53
+ @area = area {
54
+ on_draw do |area_draw_params|
55
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
56
+ # align :left # default alignment
57
+
58
+ @string = string {
59
+ font @font
60
+ color @color
61
+ background @background
62
+ underline @underline
63
+
64
+ ' At last Ygramul sensed that something was coming toward ' \
65
+ 'her. With the speed of lightning, she turned about, confronting ' \
66
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
67
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. ' \
68
+ "\n\n" \
69
+ ' A cry of fear escaped Bastian. ' \
70
+ "\n\n" \
71
+ ' A cry of terror passed through the ravine and echoed from ' \
72
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
73
+ 'someone else had arrived, for that sound could not have been ' \
74
+ 'made by the boy who stood there as though paralyzed with ' \
75
+ 'horror. ' \
76
+ "\n\n" \
77
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
78
+ "But that's not possible. " \
79
+ "\n\n" \
80
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
81
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
82
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
83
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
84
+ 'words. ' \
85
+ "\n\n"
86
+ }
87
+ }
88
+ end
89
+ }
90
+ }
91
+ }.show
92
+ end
93
+ end
94
+
95
+ CustomDrawText.new.launch
@@ -9,7 +9,7 @@ class TinyMidiPlayer
9
9
 
10
10
  def initialize
11
11
  @pid = nil
12
- @music_directory = File.expand_path(ARGV[0] || '~/Music/')
12
+ @music_directory = File.expand_path('../sounds', __dir__)
13
13
  @midi_files = Dir.glob(File.join(@music_directory, '**/*.mid'))
14
14
  .sort_by { |path| File.basename(path) }
15
15
  at_exit { stop_midi }
@@ -48,7 +48,7 @@ class TinyMidiPlayer
48
48
  end
49
49
 
50
50
  def create_gui
51
- menu('Help') { |m|
51
+ menu('Help') {
52
52
  menu_item('Version') {
53
53
  on_clicked do
54
54
  show_version