nyle 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +61 -0
- data/README.md +2 -2
- data/doc/.gitkeep +0 -0
- data/lib/nyle.rb +53 -44
- data/lib/nyle/frame.rb +18 -3
- data/lib/nyle/screen.rb +5 -4
- data/lib/nyle/version.rb +1 -1
- data/nyle.gemspec +2 -2
- data/samples/{nyle_block.rb → application/block.rb} +0 -1
- data/samples/{nyle_clock.rb → application/clock.rb} +0 -1
- data/samples/{nyle_falling.rb → application/falling.rb} +5 -7
- data/samples/{nyle_flight.rb → application/flight.rb} +6 -9
- data/samples/{nyle_sketch.rb → application/sketch.rb} +0 -1
- data/samples/{nyle_sugar.rb → application/sugar.rb} +1 -1
- data/samples/{nyle_tree.rb → application/tree.rb} +2 -3
- data/samples/basic/color_chart.rb +316 -0
- data/samples/{nyle_pixel.rb → basic/color_pixel.rb} +1 -1
- data/samples/basic/draw_circle.rb +52 -0
- data/samples/basic/draw_line.rb +82 -0
- data/samples/basic/draw_rect.rb +58 -0
- data/samples/{nyle_shape.rb → basic/draw_shape.rb} +70 -70
- data/samples/basic/draw_text.rb +55 -0
- data/samples/basic/image_click.rb +33 -0
- data/samples/basic/image_rotate.rb +42 -0
- data/samples/{nyle_rpg.rb → basic/image_rpg.rb} +15 -15
- data/samples/basic/keyboard.rb +84 -0
- data/samples/{nyle_walk_notrace.rb → basic/random_walk.rb} +3 -3
- data/samples/{nyle_walk_trace.rb → basic/random_walk_trace.rb} +3 -3
- data/samples/image/n_c_mogura.png +0 -0
- data/samples/launcher.rb +125 -0
- data/samples/tips/.gitkeep +0 -0
- data/samples/tutorial/img.jpg +0 -0
- data/samples/tutorial/tut_a10.rb +10 -0
- data/samples/tutorial/tut_a20.rb +13 -0
- data/samples/tutorial/tut_a30.rb +18 -0
- data/samples/tutorial/tut_a40.rb +19 -0
- data/samples/tutorial/tut_a45.rb +21 -0
- data/samples/tutorial/tut_a50.rb +25 -0
- data/samples/tutorial/tut_a60.rb +30 -0
- data/samples/tutorial/tut_a70.rb +34 -0
- data/samples/tutorial/tut_b10.rb +14 -0
- data/samples/tutorial/tut_b20.rb +14 -0
- data/samples/tutorial/tut_b30.rb +14 -0
- data/samples/tutorial/tut_b40.rb +18 -0
- metadata +42 -23
- data/doc/Nyle_reference.pdf +0 -0
- data/samples/image/n_b_river.gif +0 -0
- data/samples/nyle_basics.rb +0 -69
- data/samples/nyle_basics2.rb +0 -70
- data/samples/nyle_click.rb +0 -34
- data/samples/nyle_colors.rb +0 -315
- data/samples/readme_samples.txt +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dcd520326cf46949be1823ade42380cdd10da5f6018f6cad5bf9d699cb15e59
|
4
|
+
data.tar.gz: c5e0eb9530dfd5db88fbe4c04b4ca30c411f3344c299b03ae87ff24961fc2dbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f64c6526220dd9be63dafd38f55af02b73d1759252fdbd968bc36946c65712df3ff1816ed658525f53e6c210befdb0a704e73966ed75e0e4353958fcd25ff3
|
7
|
+
data.tar.gz: 545b7ca4dcbe72dad395ec6c6e364bed3f90ea0075f6743b1c855f2a9c9506edd518839484afadf6bf64e9ec45a1b7865a9ec3b01538d52d8b7c46b134c77aba
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
### 0.6.1 (2019/01/27)
|
2
|
+
#### New features
|
3
|
+
* add `Nyle.cursor_x` method
|
4
|
+
* add `Nyle.cursor_y` method
|
5
|
+
* enhance `Nyle.draw_image` to be able to specify option `pos`
|
6
|
+
|
7
|
+
#### Bug fixes, etc.
|
8
|
+
* adjust `Nyle.pixel` and `Nyle.pixel?` to apply 'to_i'
|
9
|
+
* change format of color code from #RRGGBBAA to #RRGGBB
|
10
|
+
* change maxinum value of @NYLE_INTERVAL` to '1000'
|
11
|
+
* change `Nyle.quit` to close `Nyle::Frame` instead of `Gtk.main_quit`
|
12
|
+
|
13
|
+
#### Reference manual
|
14
|
+
* change PDF to WEB(wiki)
|
15
|
+
|
16
|
+
#### Samples
|
17
|
+
* use `Nyle.cursor_x` and `Nyle.cursor_y`
|
18
|
+
* use option `pos` of `Nyle.draw_image`
|
19
|
+
* prepare `launcher.rb` to run samples
|
20
|
+
* ...and revise a lot
|
21
|
+
|
1
22
|
|
2
23
|
### 0.6.0 (2018/12/01)
|
3
24
|
#### New features
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nyle (0.6.0)
|
5
|
+
gtk3 (~> 3.2.0, >= 3.2.0)
|
6
|
+
rsvg2 (~> 3.2.0, >= 3.2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
atk (3.2.9-x86-mingw32)
|
12
|
+
glib2 (= 3.2.9)
|
13
|
+
cairo (1.15.13-x86-mingw32)
|
14
|
+
native-package-installer (>= 1.0.3)
|
15
|
+
pkg-config (>= 1.2.2)
|
16
|
+
cairo-gobject (3.2.9-x86-mingw32)
|
17
|
+
cairo
|
18
|
+
glib2 (= 3.2.9)
|
19
|
+
gdk3 (3.2.9-x86-mingw32)
|
20
|
+
cairo-gobject (= 3.2.9)
|
21
|
+
gdk_pixbuf2 (= 3.2.9)
|
22
|
+
pango (= 3.2.9)
|
23
|
+
gdk_pixbuf2 (3.2.9-x86-mingw32)
|
24
|
+
gio2 (= 3.2.9)
|
25
|
+
gio2 (3.2.9-x86-mingw32)
|
26
|
+
glib2 (= 3.2.9)
|
27
|
+
gobject-introspection (= 3.2.9)
|
28
|
+
glib2 (3.2.9-x86-mingw32)
|
29
|
+
cairo (>= 1.15.9)
|
30
|
+
native-package-installer (>= 1.0.3)
|
31
|
+
pkg-config (>= 1.2.2)
|
32
|
+
gobject-introspection (3.2.9-x86-mingw32)
|
33
|
+
glib2 (= 3.2.9)
|
34
|
+
gtk3 (3.2.9-x86-mingw32)
|
35
|
+
atk (= 3.2.9)
|
36
|
+
gdk3 (= 3.2.9)
|
37
|
+
gdk_pixbuf2 (= 3.2.9)
|
38
|
+
gio2 (= 3.2.9)
|
39
|
+
pango (= 3.2.9)
|
40
|
+
rsvg2 (= 3.2.9)
|
41
|
+
native-package-installer (1.0.6)
|
42
|
+
pango (3.2.9-x86-mingw32)
|
43
|
+
cairo-gobject (= 3.2.9)
|
44
|
+
gobject-introspection (= 3.2.9)
|
45
|
+
pkg-config (1.3.2)
|
46
|
+
rake (10.4.2)
|
47
|
+
rsvg2 (3.2.9-x86-mingw32)
|
48
|
+
cairo-gobject (= 3.2.9)
|
49
|
+
gdk_pixbuf2 (= 3.2.9)
|
50
|
+
pango (>= 3.2.9)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
x86-mingw32
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
bundler (~> 1.17)
|
57
|
+
nyle!
|
58
|
+
rake (~> 10.0)
|
59
|
+
|
60
|
+
BUNDLED WITH
|
61
|
+
1.17.1
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Nyle
|
2
2
|
|
3
|
-
'Nyle' is a minimal graphics framework using Ruby/GTK3 and
|
3
|
+
'Nyle' is a minimal graphics framework using Ruby/GTK3 and rcairo.
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
@@ -20,7 +20,7 @@ require 'nyle'
|
|
20
20
|
|
21
21
|
## Documents
|
22
22
|
|
23
|
-
Reference manual: https://github.com/spoolkitamura/nyle/
|
23
|
+
Reference manual: https://github.com/spoolkitamura/nyle/wiki
|
24
24
|
|
25
25
|
## Samples
|
26
26
|
|
data/doc/.gitkeep
ADDED
File without changes
|
data/lib/nyle.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
=begin
|
3
3
|
'Nyle'
|
4
|
-
minimal graphics framework using Ruby/GTK3 and
|
4
|
+
minimal graphics framework using Ruby/GTK3 and rcairo
|
5
5
|
|
6
6
|
Copyright (c) 2018 Koki Kitamura
|
7
7
|
Released under the MIT license
|
@@ -46,6 +46,8 @@ module Nyle
|
|
46
46
|
@__key_release = {}
|
47
47
|
@__mask_control = false
|
48
48
|
@__mask_shift = false
|
49
|
+
@__cursor_x = 0
|
50
|
+
@__cursor_y = 0
|
49
51
|
|
50
52
|
@__os = (
|
51
53
|
host_os = RbConfig::CONFIG['host_os']
|
@@ -60,11 +62,15 @@ module Nyle
|
|
60
62
|
:unknown
|
61
63
|
end
|
62
64
|
)
|
63
|
-
|
65
|
+
@__frame = nil # main frame
|
64
66
|
|
65
67
|
# Singleton class
|
66
68
|
class << self
|
67
69
|
# private methods for classes in module 'Nyle'
|
70
|
+
private def _set_frame(frame)
|
71
|
+
@__frame = frame
|
72
|
+
end
|
73
|
+
|
68
74
|
private def _set_cr(cr)
|
69
75
|
@__cr = cr
|
70
76
|
end
|
@@ -120,6 +126,23 @@ module Nyle
|
|
120
126
|
else
|
121
127
|
@__mask_shift = false # Set false to mask_shift status
|
122
128
|
end
|
129
|
+
|
130
|
+
if @__key_down[Gdk::Keyval::KEY_Right]
|
131
|
+
@__cursor_x = +1 # Set +1 to cursor_x value
|
132
|
+
elsif @__key_down[Gdk::Keyval::KEY_Left]
|
133
|
+
@__cursor_x = -1 # Set -1 to cursor_x value
|
134
|
+
else
|
135
|
+
@__cursor_x = 0
|
136
|
+
end
|
137
|
+
|
138
|
+
if @__key_down[Gdk::Keyval::KEY_Down]
|
139
|
+
@__cursor_y = +1 # Set +1 to cursor_y value
|
140
|
+
elsif @__key_down[Gdk::Keyval::KEY_Up]
|
141
|
+
@__cursor_y = -1 # Set -1 to cursor_y value
|
142
|
+
else
|
143
|
+
@__cursor_y = 0
|
144
|
+
end
|
145
|
+
|
123
146
|
end
|
124
147
|
end
|
125
148
|
end
|
@@ -140,6 +163,8 @@ module Nyle
|
|
140
163
|
module_function def key_release?(keyval) ; Nyle.module_eval{ @__key_release [keyval] == true } ; end
|
141
164
|
module_function def mask_control? ; Nyle.module_eval{ @__mask_control } ; end
|
142
165
|
module_function def mask_shift? ; Nyle.module_eval{ @__mask_shift } ; end
|
166
|
+
module_function def cursor_x ; Nyle.module_eval{ @__cursor_x } ; end
|
167
|
+
module_function def cursor_y ; Nyle.module_eval{ @__cursor_y } ; end
|
143
168
|
module_function def os ; Nyle.module_eval{ @__os } ; end
|
144
169
|
|
145
170
|
module_function def save
|
@@ -154,13 +179,9 @@ module Nyle
|
|
154
179
|
cr.save do
|
155
180
|
cr.line_width = weight
|
156
181
|
cr.line_cap = cap
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
161
|
-
Cairo::Color.parse(color).g,
|
162
|
-
Cairo::Color.parse(color).b, a)
|
163
|
-
end
|
182
|
+
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
183
|
+
Cairo::Color.parse(color).g,
|
184
|
+
Cairo::Color.parse(color).b, a)
|
164
185
|
cr.move_to(x1, y1)
|
165
186
|
cr.line_to(x2, y2)
|
166
187
|
cr.stroke
|
@@ -172,13 +193,9 @@ module Nyle
|
|
172
193
|
cr.save do
|
173
194
|
cr.line_width = weight
|
174
195
|
cr.line_cap = cap
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
179
|
-
Cairo::Color.parse(color).g,
|
180
|
-
Cairo::Color.parse(color).b, a)
|
181
|
-
end
|
196
|
+
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
197
|
+
Cairo::Color.parse(color).g,
|
198
|
+
Cairo::Color.parse(color).b, a)
|
182
199
|
if round
|
183
200
|
cr.rounded_rectangle(x, y, w, h, round, round)
|
184
201
|
else
|
@@ -196,13 +213,9 @@ module Nyle
|
|
196
213
|
cr = Nyle.module_eval{ @__cr }
|
197
214
|
cr.save do
|
198
215
|
cr.line_width = weight
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
203
|
-
Cairo::Color.parse(color).g,
|
204
|
-
Cairo::Color.parse(color).b, a)
|
205
|
-
end
|
216
|
+
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
217
|
+
Cairo::Color.parse(color).g,
|
218
|
+
Cairo::Color.parse(color).b, a)
|
206
219
|
cr.circle(x, y, r)
|
207
220
|
if fill
|
208
221
|
cr.fill
|
@@ -217,13 +230,9 @@ module Nyle
|
|
217
230
|
cr.save do
|
218
231
|
cr.line_width = weight
|
219
232
|
cr.line_cap = cap
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
224
|
-
Cairo::Color.parse(color).g,
|
225
|
-
Cairo::Color.parse(color).b, a)
|
226
|
-
end
|
233
|
+
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
234
|
+
Cairo::Color.parse(color).g,
|
235
|
+
Cairo::Color.parse(color).b, a)
|
227
236
|
vertex = points.dup
|
228
237
|
vertex << vertex.first if close # closed shape
|
229
238
|
vertex.each do |v|
|
@@ -242,13 +251,9 @@ module Nyle
|
|
242
251
|
cr.save do
|
243
252
|
cr.select_font_face("+") # Temporaly use "+" [TODO] (Need to confirm font name)
|
244
253
|
cr.font_size = size
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
249
|
-
Cairo::Color.parse(color).g,
|
250
|
-
Cairo::Color.parse(color).b, a)
|
251
|
-
end
|
254
|
+
cr.set_source_rgba(Cairo::Color.parse(color).r,
|
255
|
+
Cairo::Color.parse(color).g,
|
256
|
+
Cairo::Color.parse(color).b, a)
|
252
257
|
cr.move_to(x, y)
|
253
258
|
cr.show_text(str)
|
254
259
|
end
|
@@ -298,10 +303,14 @@ module Nyle
|
|
298
303
|
tiles
|
299
304
|
end
|
300
305
|
|
301
|
-
module_function def draw_image(x, y, pixbuf)
|
306
|
+
module_function def draw_image(x, y, pixbuf, pos: :CORNER)
|
302
307
|
cr = Nyle.module_eval{ @__cr }
|
303
308
|
cr.save do
|
304
|
-
|
309
|
+
if pos == :CENTER
|
310
|
+
cr.set_source_pixbuf(pixbuf, x - pixbuf.width / 2, y - pixbuf.height / 2)
|
311
|
+
else
|
312
|
+
cr.set_source_pixbuf(pixbuf, x, y) # :CORNER
|
313
|
+
end
|
305
314
|
cr.paint
|
306
315
|
end
|
307
316
|
end
|
@@ -317,13 +326,12 @@ module Nyle
|
|
317
326
|
private def _pixel(x, y)
|
318
327
|
cr = Nyle.module_eval{ @__cr }
|
319
328
|
surface = cr.target
|
320
|
-
address = surface.width * (y * 4) + (x * 4)
|
329
|
+
address = surface.width * (y.to_i * 4) + (x.to_i * 4)
|
321
330
|
color = surface.data.byteslice(address, 4).unpack("H*").first.upcase # e.g. '\xcc\x77\x00\xff -> ['cc7700ff'] -> 'CC7700FF'
|
322
331
|
color = '#' +
|
323
332
|
color.slice(4, 2) +
|
324
333
|
color.slice(2, 2) +
|
325
|
-
color.slice(0, 2)
|
326
|
-
color.slice(6, 2) # BBGGRRAA -> #RRGGBBAA
|
334
|
+
color.slice(0, 2) # #BBGGRR -> #RRGGBB
|
327
335
|
end
|
328
336
|
end
|
329
337
|
end
|
@@ -334,7 +342,7 @@ module Nyle
|
|
334
342
|
|
335
343
|
module_function def pixel?(x, y, color)
|
336
344
|
c = Nyle::INNER.module_eval{ _pixel(x, y) }
|
337
|
-
return (c == Cairo::Color.parse(color).to_s ? true : false)
|
345
|
+
return (c == Cairo::Color.parse(color).to_s[0, 7] ? true : false)
|
338
346
|
end
|
339
347
|
|
340
348
|
module_function def translate(tx, ty)
|
@@ -353,7 +361,8 @@ module Nyle
|
|
353
361
|
end
|
354
362
|
|
355
363
|
module_function def quit
|
356
|
-
|
364
|
+
@__frame.close if @__frame # destroy
|
365
|
+
# Gtk.main_quit
|
357
366
|
end
|
358
367
|
|
359
368
|
end
|
data/lib/nyle/frame.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
=begin
|
3
3
|
'Nyle'
|
4
|
-
minimal graphics framework using Ruby/GTK3 and
|
4
|
+
minimal graphics framework using Ruby/GTK3 and rcairo
|
5
5
|
|
6
6
|
Copyright (c) 2018 Koki Kitamura
|
7
7
|
Released under the MIT license
|
@@ -21,7 +21,7 @@ module Nyle
|
|
21
21
|
self.title = title
|
22
22
|
@transition = [] # Screen transition table
|
23
23
|
@interval_time = ENV['NYLE_INTERVAL'].to_i # milli seconds
|
24
|
-
@interval_time = 15 if @interval_time < 5 or @interval_time >
|
24
|
+
@interval_time = 15 if @interval_time < 5 or @interval_time > 1000
|
25
25
|
GLib::Timeout.add(@interval_time) do
|
26
26
|
if @current_screen
|
27
27
|
update
|
@@ -29,6 +29,12 @@ module Nyle
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
# Nyle main frame
|
33
|
+
me = self
|
34
|
+
Nyle.module_eval {
|
35
|
+
_set_frame(me)
|
36
|
+
}
|
37
|
+
|
32
38
|
# Mouse events
|
33
39
|
self.add_events([:button_press_mask,
|
34
40
|
:button_release_mask])
|
@@ -68,10 +74,14 @@ module Nyle
|
|
68
74
|
end
|
69
75
|
|
70
76
|
self.signal_connect(:destroy) do
|
71
|
-
|
77
|
+
_quit
|
72
78
|
end
|
73
79
|
end
|
74
80
|
|
81
|
+
def close
|
82
|
+
_quit
|
83
|
+
end
|
84
|
+
|
75
85
|
def set_current(screen)
|
76
86
|
_set_current(screen)
|
77
87
|
end
|
@@ -102,6 +112,11 @@ module Nyle
|
|
102
112
|
}
|
103
113
|
end
|
104
114
|
|
115
|
+
private def _quit
|
116
|
+
self.hide
|
117
|
+
Gtk.main_quit
|
118
|
+
end
|
119
|
+
|
105
120
|
private def update
|
106
121
|
@transition.each do |tr|
|
107
122
|
if tr[:current] == @current_screen and tr[:status] == @current_screen.status
|
data/lib/nyle/screen.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
=begin
|
3
3
|
'Nyle'
|
4
|
-
minimal graphics framework using Ruby/GTK3 and
|
4
|
+
minimal graphics framework using Ruby/GTK3 and rcairo
|
5
5
|
|
6
6
|
Copyright (c) 2018 Koki Kitamura
|
7
7
|
Released under the MIT license
|
@@ -25,6 +25,10 @@ module Nyle
|
|
25
25
|
|
26
26
|
@fill_done = false
|
27
27
|
|
28
|
+
Nyle.module_eval {
|
29
|
+
_set_screen_size(width, height)
|
30
|
+
}
|
31
|
+
|
28
32
|
# Draw to 'CairoContext' of ImageSurface once, and copy to 'CairoContext' of DrawingArea
|
29
33
|
@canvas = Cairo::ImageSurface.new(@width, @height)
|
30
34
|
|
@@ -96,6 +100,3 @@ module Nyle
|
|
96
100
|
|
97
101
|
end
|
98
102
|
|
99
|
-
|
100
|
-
# [TODO] :draw counter (for waiting, sleeping, idling)
|
101
|
-
|
data/lib/nyle/version.rb
CHANGED
data/nyle.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Koki Kitamura"]
|
10
10
|
spec.email = ["spool.kitamura@nifty.ne.jp"]
|
11
11
|
|
12
|
-
spec.summary = %q{minimal graphics framework using Ruby/GTK3 and
|
13
|
-
spec.description = %q{'Nyle' is a minimal graphics framework using Ruby/GTK3 and
|
12
|
+
spec.summary = %q{minimal graphics framework using Ruby/GTK3 and rcairo}
|
13
|
+
spec.description = %q{'Nyle' is a minimal graphics framework using Ruby/GTK3 and rcairo}
|
14
14
|
spec.homepage = "https://github.com/spoolkitamura/nyle"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'nyle'
|
3
2
|
|
4
3
|
class Field
|
@@ -91,13 +90,13 @@ end
|
|
91
90
|
|
92
91
|
class Weapon < Item
|
93
92
|
def initialize
|
94
|
-
super("image/n_f_weapon.png", 7, 0.4, 0.4)
|
93
|
+
super("../image/n_f_weapon.png", 7, 0.4, 0.4)
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
98
97
|
class Banana < Item
|
99
98
|
def initialize
|
100
|
-
super("image/n_f_banana.png", 0, 0.6, 0.6)
|
99
|
+
super("../image/n_f_banana.png", 0, 0.6, 0.6)
|
101
100
|
end
|
102
101
|
|
103
102
|
def get_score
|
@@ -107,7 +106,7 @@ end
|
|
107
106
|
|
108
107
|
class Strawberry < Item
|
109
108
|
def initialize
|
110
|
-
super("image/n_f_strawberry.png", 0, 0.6, 0.6)
|
109
|
+
super("../image/n_f_strawberry.png", 0, 0.6, 0.6)
|
111
110
|
end
|
112
111
|
|
113
112
|
def get_score
|
@@ -120,7 +119,7 @@ class Hero
|
|
120
119
|
MOVING_RANGE_X = 640
|
121
120
|
|
122
121
|
def initialize(x, y)
|
123
|
-
@image = Nyle.load_image("
|
122
|
+
@image = Nyle.load_image("../image/n_f_panda.png", {sx: 0.3, sy: 0.3, color_key: :WHITE})
|
124
123
|
@x = x - @image.width / 2
|
125
124
|
@y = y - @image.height
|
126
125
|
@speed = 3.5
|
@@ -227,8 +226,7 @@ class Screen_Play < Nyle::Screen
|
|
227
226
|
@bananas.each { |banana| banana.drop }
|
228
227
|
@strawberries.each { |strawberrie| strawberrie.drop }
|
229
228
|
_detect
|
230
|
-
@hero.move(
|
231
|
-
@hero.move(-1, 0) if Nyle.key_down?(KEY_Left)
|
229
|
+
@hero.move(Nyle.cursor_x, 0)
|
232
230
|
Nyle.quit if Nyle.key_press?(KEY_Escape)
|
233
231
|
end
|
234
232
|
|