ruby-miyako 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +42 -5
- data/lib/Miyako/API/choices.rb +0 -2
- data/lib/Miyako/API/collision.rb +0 -4
- data/lib/Miyako/API/fixedmap.rb +0 -3
- data/lib/Miyako/API/i_yuki.rb +28 -46
- data/lib/Miyako/API/layout.rb +0 -1
- data/lib/Miyako/API/map.rb +0 -2
- data/lib/Miyako/API/map_event.rb +0 -3
- data/lib/Miyako/API/map_struct.rb +0 -2
- data/lib/Miyako/API/parts.rb +0 -11
- data/lib/Miyako/API/screen.rb +3 -4
- data/lib/Miyako/API/shape.rb +27 -27
- data/lib/Miyako/API/sprite.rb +0 -2
- data/lib/Miyako/API/story.rb +0 -2
- data/lib/Miyako/API/textbox.rb +9 -11
- data/lib/Miyako/API/utility.rb +2 -2
- data/lib/Miyako/API/yuki.rb +19 -8
- data/lib/Miyako/miyako.rb +3 -0
- data/miyako_basicdata.c +52 -5
- data/miyako_bitmap.c +351 -342
- data/miyako_collision.c +77 -67
- data/miyako_diagram.c +22 -21
- data/miyako_drawing.c +9 -6
- data/miyako_font.c +63 -53
- data/miyako_hsv.c +428 -436
- data/miyako_input_audio.c +17 -14
- data/miyako_layout.c +23 -18
- data/miyako_no_katana.c +284 -248
- data/miyako_sprite2.c +30 -18
- data/miyako_transform.c +95 -93
- data/miyako_utility.c +9 -18
- data/miyako_yuki.c +10 -6
- data/sample/Diagram_sample/diagram_sample_yuki2.rb +2 -2
- data/sample/Room3/room3.rb +8 -10
- data/sample/ball_action_sample.rb +8 -8
- data/sample/map_test/main_scene.rb +1 -1
- data/sample/map_test/map_test.rb +8 -8
- data/sample/takahashi.rb +14 -14
- data/win/miyako_no_katana.so +0 -0
- metadata +6 -4
data/miyako_collision.c
CHANGED
@@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
20
|
*/
|
21
21
|
|
22
22
|
/*
|
23
|
-
|
24
|
-
Authors::
|
23
|
+
=miyako_no_katana
|
24
|
+
Authors:: Cyross Makoto
|
25
25
|
Version:: 2.0
|
26
26
|
Copyright:: 2007-2009 Cyross Makoto
|
27
27
|
License:: LGPL2.1
|
@@ -82,16 +82,17 @@ static VALUE collision_c_collision(VALUE self, VALUE c1, VALUE pos1, VALUE c2, V
|
|
82
82
|
VALUE *prect1 = RSTRUCT_PTR(rb_iv_get(c1, "@rect"));
|
83
83
|
VALUE *prect2 = RSTRUCT_PTR(rb_iv_get(c2, "@rect"));
|
84
84
|
VALUE x1, y1, x2, y2;
|
85
|
+
double l1, l2, t1, t2, r1, r2, b1, b2;
|
85
86
|
collision_get_position(pos1, &x1, &y1);
|
86
87
|
collision_get_position(pos2, &x2, &y2);
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
88
|
+
l1 = NUM2DBL(x1) + NUM2DBL(*prect1);
|
89
|
+
t1 = NUM2DBL(y1) + NUM2DBL(*(prect1+1));
|
90
|
+
r1 = l1 + NUM2DBL(*(prect1+2)) - 1;
|
91
|
+
b1 = t1 + NUM2DBL(*(prect1+3)) - 1;
|
92
|
+
l2 = NUM2DBL(x2) + NUM2DBL(*prect2);
|
93
|
+
t2 = NUM2DBL(y2) + NUM2DBL(*(prect2+1));
|
94
|
+
r2 = l2 + NUM2DBL(*(prect2+2)) - 1;
|
95
|
+
b2 = t2 + NUM2DBL(*(prect2+3)) - 1;
|
95
96
|
|
96
97
|
if(l2 <= r1 && r1 <= r2)
|
97
98
|
{
|
@@ -116,16 +117,17 @@ static VALUE collision_c_meet(VALUE self, VALUE c1, VALUE pos1, VALUE c2, VALUE
|
|
116
117
|
VALUE *prect1 = RSTRUCT_PTR(rb_iv_get(c1, "@rect"));
|
117
118
|
VALUE *prect2 = RSTRUCT_PTR(rb_iv_get(c2, "@rect"));
|
118
119
|
VALUE x1, y1, x2, y2;
|
120
|
+
double l1, l2, t1, t2, r1, r2, b1, b2;
|
119
121
|
collision_get_position(pos1, &x1, &y1);
|
120
122
|
collision_get_position(pos2, &x2, &y2);
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
123
|
+
l1 = NUM2DBL(x1) + NUM2DBL(*prect1);
|
124
|
+
t1 = NUM2DBL(y1) + NUM2DBL(*(prect1+1));
|
125
|
+
r1 = l1 + NUM2DBL(*(prect1+2)) - 1;
|
126
|
+
b1 = t1 + NUM2DBL(*(prect1+3)) - 1;
|
127
|
+
l2 = NUM2DBL(x2) + NUM2DBL(*prect2);
|
128
|
+
t2 = NUM2DBL(y2) + NUM2DBL(*(prect2+1));
|
129
|
+
r2 = l2 + NUM2DBL(*(prect2+2)) - 1;
|
130
|
+
b2 = t2 + NUM2DBL(*(prect2+3)) - 1;
|
129
131
|
|
130
132
|
if(r1 == l2 || b1 == t2 || l1 == r2 || t1 == b2) return Qtrue;
|
131
133
|
return Qfalse;
|
@@ -138,17 +140,18 @@ static VALUE collision_c_cover(VALUE self, VALUE c1, VALUE pos1, VALUE c2, VALUE
|
|
138
140
|
{
|
139
141
|
VALUE *prect1 = RSTRUCT_PTR(rb_iv_get(c1, "@rect"));
|
140
142
|
VALUE *prect2 = RSTRUCT_PTR(rb_iv_get(c2, "@rect"));
|
143
|
+
double l1, l2, t1, t2, r1, r2, b1, b2;
|
141
144
|
VALUE x1, y1, x2, y2;
|
142
145
|
collision_get_position(pos1, &x1, &y1);
|
143
146
|
collision_get_position(pos2, &x2, &y2);
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
147
|
+
l1 = NUM2DBL(x1) + NUM2DBL(*prect1);
|
148
|
+
t1 = NUM2DBL(y1) + NUM2DBL(*(prect1+1));
|
149
|
+
r1 = l1 + NUM2DBL(*(prect1+2)) - 1;
|
150
|
+
b1 = t1 + NUM2DBL(*(prect1+3)) - 1;
|
151
|
+
l2 = NUM2DBL(x2) + NUM2DBL(*prect2);
|
152
|
+
t2 = NUM2DBL(y2) + NUM2DBL(*(prect2+1));
|
153
|
+
r2 = l2 + NUM2DBL(*(prect2+2)) - 1;
|
154
|
+
b2 = t2 + NUM2DBL(*(prect2+3)) - 1;
|
152
155
|
|
153
156
|
if(l1 >= l2 && r1 <= r2 && t1 >= t2 && b1 <= b2) return Qtrue;
|
154
157
|
if(l1 <= l2 && r1 >= r2 && t1 <= t2 && b1 >= b2) return Qtrue;
|
@@ -163,16 +166,17 @@ static VALUE collision_c_covers(VALUE self, VALUE c1, VALUE pos1, VALUE c2, VALU
|
|
163
166
|
VALUE *prect1 = RSTRUCT_PTR(rb_iv_get(c1, "@rect"));
|
164
167
|
VALUE *prect2 = RSTRUCT_PTR(rb_iv_get(c2, "@rect"));
|
165
168
|
VALUE x1, y1, x2, y2;
|
169
|
+
double l1, l2, t1, t2, r1, r2, b1, b2;
|
166
170
|
collision_get_position(pos1, &x1, &y1);
|
167
171
|
collision_get_position(pos2, &x2, &y2);
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
172
|
+
l1 = NUM2DBL(x1) + NUM2DBL(*prect1);
|
173
|
+
t1 = NUM2DBL(y1) + NUM2DBL(*(prect1+1));
|
174
|
+
r1 = l1 + NUM2DBL(*(prect1+2)) - 1;
|
175
|
+
b1 = t1 + NUM2DBL(*(prect1+3)) - 1;
|
176
|
+
l2 = NUM2DBL(x2) + NUM2DBL(*prect2);
|
177
|
+
t2 = NUM2DBL(y2) + NUM2DBL(*(prect2+1));
|
178
|
+
r2 = l2 + NUM2DBL(*(prect2+2)) - 1;
|
179
|
+
b2 = t2 + NUM2DBL(*(prect2+3)) - 1;
|
176
180
|
|
177
181
|
if(l1 <= l2 && r1 >= r2 && t1 <= t2 && b1 >= b2) return Qtrue;
|
178
182
|
return Qfalse;
|
@@ -186,16 +190,17 @@ static VALUE collision_c_covered(VALUE self, VALUE c1, VALUE pos1, VALUE c2, VAL
|
|
186
190
|
VALUE *prect1 = RSTRUCT_PTR(rb_iv_get(c1, "@rect"));
|
187
191
|
VALUE *prect2 = RSTRUCT_PTR(rb_iv_get(c2, "@rect"));
|
188
192
|
VALUE x1, y1, x2, y2;
|
193
|
+
double l1, l2, t1, t2, r1, r2, b1, b2;
|
189
194
|
collision_get_position(pos1, &x1, &y1);
|
190
195
|
collision_get_position(pos2, &x2, &y2);
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
196
|
+
l1 = NUM2DBL(x1) + NUM2DBL(*prect1);
|
197
|
+
t1 = NUM2DBL(y1) + NUM2DBL(*(prect1+1));
|
198
|
+
r1 = l1 + NUM2DBL(*(prect1+2)) - 1;
|
199
|
+
b1 = t1 + NUM2DBL(*(prect1+3)) - 1;
|
200
|
+
l2 = NUM2DBL(x2) + NUM2DBL(*prect2);
|
201
|
+
t2 = NUM2DBL(y2) + NUM2DBL(*(prect2+1));
|
202
|
+
r2 = l2 + NUM2DBL(*(prect2+2)) - 1;
|
203
|
+
b2 = t2 + NUM2DBL(*(prect2+3)) - 1;
|
199
204
|
|
200
205
|
if(l1 >= l2 && r1 <= r2 && t1 >= t2 && b1 <= b2) return Qtrue;
|
201
206
|
return Qfalse;
|
@@ -252,13 +257,14 @@ static VALUE circlecollision_c_collision(VALUE self, VALUE c1, VALUE pos1, VALUE
|
|
252
257
|
double r2 = NUM2DBL(rb_iv_get(c2, "@radius"));
|
253
258
|
double r = (r1 + r2) * (r1 + r2);
|
254
259
|
VALUE x1, y1, x2, y2;
|
260
|
+
double cx1, cy1, cx2, cy2, d;
|
255
261
|
collision_get_position(pos1, &x1, &y1);
|
256
262
|
collision_get_position(pos2, &x2, &y2);
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
263
|
+
cx1 = NUM2DBL(x1) + NUM2DBL(*pcenter1);
|
264
|
+
cy1 = NUM2DBL(y1) + NUM2DBL(*(pcenter1+1));
|
265
|
+
cx2 = NUM2DBL(x2) + NUM2DBL(*pcenter2);
|
266
|
+
cy2 = NUM2DBL(y2) + NUM2DBL(*(pcenter2+1));
|
267
|
+
d = (cx1-cx2) * (cx1-cx2) + (cy1-cy2) * (cy1-cy2);
|
262
268
|
|
263
269
|
if(d <= r) return Qtrue;
|
264
270
|
return Qfalse;
|
@@ -275,13 +281,14 @@ static VALUE circlecollision_c_meet(VALUE self, VALUE c1, VALUE pos1, VALUE c2,
|
|
275
281
|
double r2 = NUM2DBL(rb_iv_get(c2, "@radius"));
|
276
282
|
double r = (r1 + r2) * (r1 + r2);
|
277
283
|
VALUE x1, y1, x2, y2;
|
284
|
+
double cx1, cy1, cx2, cy2, d;
|
278
285
|
collision_get_position(pos1, &x1, &y1);
|
279
286
|
collision_get_position(pos2, &x2, &y2);
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
287
|
+
cx1 = NUM2DBL(x1) + NUM2DBL(*pcenter1);
|
288
|
+
cy1 = NUM2DBL(y1) + NUM2DBL(*(pcenter1+1));
|
289
|
+
cx2 = NUM2DBL(x2) + NUM2DBL(*pcenter2);
|
290
|
+
cy2 = NUM2DBL(y2) + NUM2DBL(*(pcenter2+1));
|
291
|
+
d = (cx1-cx2) * (cx1-cx2) + (cy1-cy2) * (cy1-cy2);
|
285
292
|
|
286
293
|
if(d == r) return Qtrue;
|
287
294
|
return Qfalse;
|
@@ -298,13 +305,14 @@ static VALUE circlecollision_c_cover(VALUE self, VALUE c1, VALUE pos1, VALUE c2,
|
|
298
305
|
double r2 = NUM2DBL(rb_iv_get(c2, "@radius"));
|
299
306
|
double r = (r1 - r2) * (r1 - r2); // y = (x-a)^2 -> y = x^2 - 2ax + a^2
|
300
307
|
VALUE x1, y1, x2, y2;
|
308
|
+
double cx1, cy1, cx2, cy2, d;
|
301
309
|
collision_get_position(pos1, &x1, &y1);
|
302
310
|
collision_get_position(pos2, &x2, &y2);
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
311
|
+
cx1 = NUM2DBL(x1) + NUM2DBL(*pcenter1);
|
312
|
+
cy1 = NUM2DBL(y1) + NUM2DBL(*(pcenter1+1));
|
313
|
+
cx2 = NUM2DBL(x2) + NUM2DBL(*pcenter2);
|
314
|
+
cy2 = NUM2DBL(y2) + NUM2DBL(*(pcenter2+1));
|
315
|
+
d = (cx1-cx2) * (cx1-cx2) + (cy1-cy2) * (cy1-cy2);
|
308
316
|
|
309
317
|
if(d <= r) return Qtrue;
|
310
318
|
return Qfalse;
|
@@ -321,13 +329,14 @@ static VALUE circlecollision_c_covers(VALUE self, VALUE c1, VALUE pos1, VALUE c2
|
|
321
329
|
double r2 = NUM2DBL(rb_iv_get(c2, "@radius"));
|
322
330
|
double r = (r1 - r2) * (r1 - r2); // y = (x-a)^2 -> y = x^2 - 2ax + a^2
|
323
331
|
VALUE x1, y1, x2, y2;
|
332
|
+
double cx1, cy1, cx2, cy2, d;
|
324
333
|
collision_get_position(pos1, &x1, &y1);
|
325
334
|
collision_get_position(pos2, &x2, &y2);
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
335
|
+
cx1 = NUM2DBL(x1) + NUM2DBL(*pcenter1);
|
336
|
+
cy1 = NUM2DBL(y1) + NUM2DBL(*(pcenter1+1));
|
337
|
+
cx2 = NUM2DBL(x2) + NUM2DBL(*pcenter2);
|
338
|
+
cy2 = NUM2DBL(y2) + NUM2DBL(*(pcenter2+1));
|
339
|
+
d = (cx1-cx2) * (cx1-cx2) + (cy1-cy2) * (cy1-cy2);
|
331
340
|
|
332
341
|
if(r1 >= r2 && d <= r) return Qtrue;
|
333
342
|
return Qfalse;
|
@@ -344,13 +353,14 @@ static VALUE circlecollision_c_covered(VALUE self, VALUE c1, VALUE pos1, VALUE c
|
|
344
353
|
double r2 = NUM2DBL(rb_iv_get(c2, "@radius"));
|
345
354
|
double r = (r1 - r2) * (r1 - r2); // y = (x-a)^2 -> y = x^2 - 2ax + a^2
|
346
355
|
VALUE x1, y1, x2, y2;
|
356
|
+
double cx1, cy1, cx2, cy2, d;
|
347
357
|
collision_get_position(pos1, &x1, &y1);
|
348
358
|
collision_get_position(pos2, &x2, &y2);
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
359
|
+
cx1 = NUM2DBL(x1) + NUM2DBL(*pcenter1);
|
360
|
+
cy1 = NUM2DBL(y1) + NUM2DBL(*(pcenter1+1));
|
361
|
+
cx2 = NUM2DBL(x2) + NUM2DBL(*pcenter2);
|
362
|
+
cy2 = NUM2DBL(y2) + NUM2DBL(*(pcenter2+1));
|
363
|
+
d = (cx1-cx2) * (cx1-cx2) + (cy1-cy2) * (cy1-cy2);
|
354
364
|
|
355
365
|
if(r1 <= r2 && d <= r) return Qtrue;
|
356
366
|
return Qfalse;
|
data/miyako_diagram.c
CHANGED
@@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
20
|
*/
|
21
21
|
|
22
22
|
/*
|
23
|
-
|
24
|
-
Authors::
|
23
|
+
=miyako_no_katana
|
24
|
+
Authors:: Cyross Makoto
|
25
25
|
Version:: 2.0
|
26
26
|
Copyright:: 2007-2008 Cyross Makoto
|
27
27
|
License:: LGPL2.1
|
@@ -74,10 +74,10 @@ static const char *str_arrow = "@arrow";
|
|
74
74
|
*/
|
75
75
|
static VALUE dbody_update_input(int argc, VALUE *argv, VALUE self)
|
76
76
|
{
|
77
|
-
VALUE params;
|
77
|
+
VALUE params, node;
|
78
78
|
rb_scan_args(argc, argv, "00*", ¶ms);
|
79
79
|
|
80
|
-
|
80
|
+
node = rb_iv_get(self, str_node);
|
81
81
|
if(node == Qnil) return Qnil;
|
82
82
|
rb_funcall2(node, id_update_input, argc, argv);
|
83
83
|
return Qnil;
|
@@ -88,18 +88,18 @@ static VALUE dbody_update_input(int argc, VALUE *argv, VALUE self)
|
|
88
88
|
*/
|
89
89
|
static VALUE dbody_update(int argc, VALUE *argv, VALUE self)
|
90
90
|
{
|
91
|
-
VALUE params;
|
91
|
+
VALUE params, trigger, ntrigger, node;
|
92
92
|
rb_scan_args(argc, argv, "00*", ¶ms);
|
93
93
|
|
94
|
-
|
94
|
+
trigger = rb_iv_get(self, str_trigger);
|
95
95
|
if(rb_funcall(trigger, id_is_update, 0) == Qfalse) return Qnil;
|
96
96
|
|
97
|
-
|
97
|
+
node = rb_iv_get(self, str_node);
|
98
98
|
rb_funcall2(node, id_update, argc, argv);
|
99
99
|
rb_funcall(trigger, id_post_update, 0);
|
100
100
|
rb_funcall(node, id_reset_input, 0);
|
101
101
|
|
102
|
-
|
102
|
+
ntrigger = rb_iv_get(self, str_next_trigger);
|
103
103
|
|
104
104
|
if(ntrigger == Qnil) return Qnil;
|
105
105
|
|
@@ -113,9 +113,10 @@ static VALUE dbody_update(int argc, VALUE *argv, VALUE self)
|
|
113
113
|
*/
|
114
114
|
static VALUE dbody_render(VALUE self)
|
115
115
|
{
|
116
|
+
VALUE node;
|
116
117
|
VALUE trigger = rb_iv_get(self, str_trigger);
|
117
118
|
if(rb_funcall(trigger, id_is_render, 0) == Qfalse) return Qnil;
|
118
|
-
|
119
|
+
node = rb_iv_get(self, str_node);
|
119
120
|
rb_funcall(node, id_render, 0);
|
120
121
|
rb_funcall(trigger, id_post_render, 0);
|
121
122
|
return Qnil;
|
@@ -126,13 +127,13 @@ static VALUE dbody_render(VALUE self)
|
|
126
127
|
*/
|
127
128
|
static VALUE dbody_go_next(VALUE self)
|
128
129
|
{
|
130
|
+
int i;
|
129
131
|
VALUE next_obj = self;
|
130
132
|
VALUE arrows = rb_iv_get(self, str_arrow);
|
131
133
|
VALUE *arrows_p = RARRAY_PTR(arrows);
|
132
134
|
VALUE node = rb_iv_get(self, str_node);
|
133
135
|
VALUE call_arg = rb_ary_new();
|
134
136
|
rb_ary_push(call_arg, node);
|
135
|
-
int i;
|
136
137
|
for(i=0;i<RARRAY_LEN(arrows);i++)
|
137
138
|
{
|
138
139
|
VALUE arrow = *(arrows_p+i);
|
@@ -186,10 +187,10 @@ static VALUE dbody_replace_trigger(int argc, VALUE *argv, VALUE self)
|
|
186
187
|
*/
|
187
188
|
static VALUE manager_update_input(int argc, VALUE *argv, VALUE self)
|
188
189
|
{
|
189
|
-
VALUE params;
|
190
|
+
VALUE params, ptr;
|
190
191
|
rb_scan_args(argc, argv, "00*", ¶ms);
|
191
192
|
|
192
|
-
|
193
|
+
ptr = rb_iv_get(self, str_ptr);
|
193
194
|
if(ptr == Qnil) return Qnil;
|
194
195
|
dbody_update_input(argc, argv, ptr);
|
195
196
|
return Qnil;
|
@@ -200,15 +201,15 @@ static VALUE manager_update_input(int argc, VALUE *argv, VALUE self)
|
|
200
201
|
*/
|
201
202
|
static VALUE manager_update(int argc, VALUE *argv, VALUE self)
|
202
203
|
{
|
203
|
-
VALUE params;
|
204
|
+
VALUE params, ptr, nxt;
|
204
205
|
rb_scan_args(argc, argv, "00*", ¶ms);
|
205
206
|
|
206
|
-
|
207
|
+
ptr = rb_iv_get(self, str_ptr);
|
207
208
|
if(ptr == Qnil) return Qnil;
|
208
209
|
|
209
210
|
dbody_update(argc, argv, ptr);
|
210
211
|
|
211
|
-
|
212
|
+
nxt = rb_funcall(ptr, id_go_next, 0);
|
212
213
|
|
213
214
|
if(!rb_eql(ptr, nxt))
|
214
215
|
{
|
@@ -236,13 +237,13 @@ static VALUE manager_render(VALUE self)
|
|
236
237
|
*/
|
237
238
|
static VALUE processor_update_input(int argc, VALUE *argv, VALUE self)
|
238
239
|
{
|
239
|
-
VALUE params;
|
240
|
+
VALUE params, states, diagram;
|
240
241
|
rb_scan_args(argc, argv, "00*", ¶ms);
|
241
242
|
|
242
|
-
|
243
|
+
states = rb_iv_get(self, str_states);
|
243
244
|
if(rb_hash_lookup(states, symPause) == Qtrue) return Qnil;
|
244
245
|
|
245
|
-
|
246
|
+
diagram = rb_iv_get(self, str_diagram);
|
246
247
|
manager_update_input(argc, argv, diagram);
|
247
248
|
return Qnil;
|
248
249
|
}
|
@@ -252,14 +253,14 @@ static VALUE processor_update_input(int argc, VALUE *argv, VALUE self)
|
|
252
253
|
*/
|
253
254
|
static VALUE processor_update(int argc, VALUE *argv, VALUE self)
|
254
255
|
{
|
255
|
-
VALUE params;
|
256
|
+
VALUE params, states, diagram;
|
256
257
|
rb_scan_args(argc, argv, "00*", ¶ms);
|
257
258
|
|
258
|
-
|
259
|
+
states = rb_iv_get(self, str_states);
|
259
260
|
|
260
261
|
if(rb_hash_lookup(states, symPause) == Qtrue) return Qnil;
|
261
262
|
|
262
|
-
|
263
|
+
diagram = rb_iv_get(self, str_diagram);
|
263
264
|
manager_update(argc, argv, diagram);
|
264
265
|
|
265
266
|
if(rb_funcall(diagram, id_finish, 0) == Qtrue){
|
data/miyako_drawing.c
CHANGED
@@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
20
|
*/
|
21
21
|
|
22
22
|
/*
|
23
|
-
|
24
|
-
Authors::
|
23
|
+
=miyako_no_katana
|
24
|
+
Authors:: Cyross Makoto
|
25
25
|
Version:: 2.0
|
26
26
|
Copyright:: 2007-2008 Cyross Makoto
|
27
27
|
License:: LGPL2.1
|
@@ -92,14 +92,17 @@ static VALUE drawing_draw_polygon(int argc, VALUE *argv, VALUE self)
|
|
92
92
|
VALUE mcolor;
|
93
93
|
VALUE fill;
|
94
94
|
VALUE aa;
|
95
|
+
VALUE methods;
|
95
96
|
Uint8 alpha;
|
96
97
|
Uint32 color;
|
98
|
+
Sint16 *px, *py;
|
97
99
|
int i, vertexes;
|
100
|
+
SDL_Surface *dst;
|
98
101
|
|
99
102
|
rb_scan_args(argc, argv, "32", &vdst, &pairs, &mcolor, &fill, &aa);
|
100
103
|
|
101
104
|
// bitmapメソッドを持っていれば、メソッドの値をvdstとする
|
102
|
-
|
105
|
+
methods = rb_funcall(vdst, rb_intern("methods"), 0);
|
103
106
|
if(rb_ary_includes(methods, rb_str_intern(rb_str_new2("to_unit"))) == Qfalse &&
|
104
107
|
rb_ary_includes(methods, rb_str_intern(rb_str_new2("bitmap"))) == Qfalse
|
105
108
|
)
|
@@ -121,15 +124,15 @@ static VALUE drawing_draw_polygon(int argc, VALUE *argv, VALUE self)
|
|
121
124
|
get_position(vertex, &x, &y);
|
122
125
|
}
|
123
126
|
|
124
|
-
|
127
|
+
dst = GetSurface(vdst)->surface;
|
125
128
|
|
126
129
|
color = value_2_color(rb_funcall(cColor, rb_intern("to_rgb"), 1, mcolor), dst->format, &alpha);
|
127
130
|
|
128
131
|
if(RTEST(fill) && RTEST(aa) && alpha < 255)
|
129
132
|
rb_raise(eMiyakoError, "can't draw filled antialiased alpha polygon");
|
130
133
|
|
131
|
-
|
132
|
-
|
134
|
+
px = (Sint16 *)malloc(sizeof(Sint16) * vertexes);
|
135
|
+
py = (Sint16 *)malloc(sizeof(Sint16) * vertexes);
|
133
136
|
for(i=0; i<vertexes; i++)
|
134
137
|
{
|
135
138
|
VALUE vertex = *(RARRAY_PTR(pairs)+i);
|