texplay 0.4 → 0.4.1
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/ext/texplay/bindings.c +80 -80
- data/lib/texplay/version.rb +1 -1
- metadata +2 -2
data/ext/texplay/bindings.c
CHANGED
@@ -67,19 +67,19 @@ process_x_y_pairs(VALUE image, int num_pairs, VALUE * argv, ...)
|
|
67
67
|
va_end(ap);
|
68
68
|
}
|
69
69
|
|
70
|
-
|
70
|
+
|
71
71
|
/* singleton methods */
|
72
72
|
|
73
73
|
/* responsible for creating macros */
|
74
74
|
VALUE
|
75
|
-
M_create_macro(VALUE self, VALUE method_name)
|
75
|
+
M_create_macro(VALUE self, VALUE method_name)
|
76
76
|
{
|
77
77
|
VALUE proc;
|
78
78
|
|
79
79
|
rb_need_block();
|
80
80
|
|
81
81
|
/* convert the block to a proc */
|
82
|
-
proc = rb_block_proc();
|
82
|
+
proc = rb_block_proc();
|
83
83
|
|
84
84
|
/* define the method in the TexPlay class so that it is accessible to 'instances' */
|
85
85
|
rb_funcall(self, rb_intern("define_method"), 2, method_name, proc);
|
@@ -90,7 +90,7 @@ M_create_macro(VALUE self, VALUE method_name)
|
|
90
90
|
|
91
91
|
/* responsible for removing macros */
|
92
92
|
VALUE
|
93
|
-
M_remove_macro(VALUE self, VALUE method_name)
|
93
|
+
M_remove_macro(VALUE self, VALUE method_name)
|
94
94
|
{
|
95
95
|
|
96
96
|
/* remove the method in the TexPlay class */
|
@@ -101,7 +101,7 @@ M_remove_macro(VALUE self, VALUE method_name)
|
|
101
101
|
|
102
102
|
/* responsible for refreshing all entries in cache */
|
103
103
|
VALUE
|
104
|
-
M_refresh_cache_all(VALUE self)
|
104
|
+
M_refresh_cache_all(VALUE self)
|
105
105
|
{
|
106
106
|
cache_refresh_all();
|
107
107
|
|
@@ -117,7 +117,7 @@ M_refresh_cache_all(VALUE self)
|
|
117
117
|
/* int rb_y = FIX2INT(y); */
|
118
118
|
/* int rb_width = FIX2INT(width); */
|
119
119
|
/* int rb_height = FIX2INT(height); */
|
120
|
-
|
120
|
+
|
121
121
|
/* VALUE blob = rb_str_new(NULL, 4 * rb_width * rb_height); */
|
122
122
|
|
123
123
|
/* glReadPixels(rb_x, rb_y, rb_width, rb_height, GL_RGBA, GL_UNSIGNED_BYTE, RSTRING_PTR(blob)); */
|
@@ -133,7 +133,7 @@ M_refresh_cache_all(VALUE self)
|
|
133
133
|
/* VALUE fresh_image; */
|
134
134
|
|
135
135
|
/* fresh_image = create_image(window, NUM2INT(width), NUM2INT(height)); */
|
136
|
-
|
136
|
+
|
137
137
|
/* return fresh_image; */
|
138
138
|
/* } */
|
139
139
|
/** end singleton methods **/
|
@@ -143,11 +143,11 @@ static void
|
|
143
143
|
rb_lazy_bounds_to_image_bounds(VALUE image, image_bounds * bounds)
|
144
144
|
{
|
145
145
|
VALUE lazy_bounds;
|
146
|
-
|
146
|
+
|
147
147
|
lazy_bounds = get_image_local(image, LAZY_BOUNDS);
|
148
|
-
|
148
|
+
|
149
149
|
Check_Type(lazy_bounds, T_ARRAY);
|
150
|
-
|
150
|
+
|
151
151
|
bounds->xmin = FIX2INT(get_from_array(lazy_bounds, 0));
|
152
152
|
bounds->ymin = FIX2INT(get_from_array(lazy_bounds, 1));
|
153
153
|
bounds->xmax = FIX2INT(get_from_array(lazy_bounds, 2));
|
@@ -158,9 +158,9 @@ static VALUE
|
|
158
158
|
parse_sync_mode(VALUE user_sync_mode)
|
159
159
|
{
|
160
160
|
sync mode;
|
161
|
-
|
161
|
+
|
162
162
|
Check_Type(user_sync_mode, T_SYMBOL);
|
163
|
-
|
163
|
+
|
164
164
|
if(user_sync_mode == string2sym("lazy_sync"))
|
165
165
|
mode = lazy_sync;
|
166
166
|
else if(user_sync_mode == string2sym("eager_sync"))
|
@@ -178,7 +178,7 @@ parse_sync_mode(VALUE user_sync_mode)
|
|
178
178
|
|
179
179
|
/* entry point for TexPlay paint actions */
|
180
180
|
VALUE
|
181
|
-
m_paint(int argc, VALUE * argv, VALUE self)
|
181
|
+
m_paint(int argc, VALUE * argv, VALUE self)
|
182
182
|
{
|
183
183
|
texture_info tex;
|
184
184
|
VALUE options;
|
@@ -205,7 +205,7 @@ m_paint(int argc, VALUE * argv, VALUE self)
|
|
205
205
|
rb_lazy_bounds_to_image_bounds(self, &bounds);
|
206
206
|
|
207
207
|
create_subtexture_and_sync_to_gl(&bounds, &tex);
|
208
|
-
|
208
|
+
|
209
209
|
/* reset the LAZY_BOUNDS now we've sync'd */
|
210
210
|
set_image_local(self, LAZY_BOUNDS, Qnil);
|
211
211
|
|
@@ -221,18 +221,18 @@ m_paint(int argc, VALUE * argv, VALUE self)
|
|
221
221
|
switch(arity) {
|
222
222
|
case -1:
|
223
223
|
case 0:
|
224
|
-
|
224
|
+
rb_instance_eval(0, 0, self);
|
225
225
|
break;
|
226
226
|
case 1:
|
227
227
|
rb_yield(self);
|
228
228
|
break;
|
229
|
-
default:
|
229
|
+
default:
|
230
230
|
rb_raise(rb_eArgError, "block arity must be either 1 or -1 or 0, received arity of: %d", arity);
|
231
231
|
}
|
232
232
|
|
233
233
|
/* if lazy sync is selected then sync now..as the paint block has finished executing the draw actions*/
|
234
234
|
if(sync_mode == lazy_sync) {
|
235
|
-
|
235
|
+
|
236
236
|
rb_lazy_bounds_to_image_bounds(self, &bounds);
|
237
237
|
|
238
238
|
create_subtexture_and_sync_to_gl(&bounds, &tex);
|
@@ -253,7 +253,7 @@ m_force_sync(VALUE self, VALUE ary)
|
|
253
253
|
{
|
254
254
|
image_bounds bounds;
|
255
255
|
texture_info tex;
|
256
|
-
|
256
|
+
|
257
257
|
Check_Type(ary, T_ARRAY);
|
258
258
|
|
259
259
|
get_texture_info(self, &tex);
|
@@ -307,7 +307,7 @@ m_clone_image(VALUE self)
|
|
307
307
|
|
308
308
|
return cloned_image;
|
309
309
|
}
|
310
|
-
|
310
|
+
|
311
311
|
VALUE
|
312
312
|
m_user_set_options(VALUE self, VALUE options)
|
313
313
|
{
|
@@ -340,7 +340,7 @@ get_image_chunk_with_size(char * data, texture_info * tex, char * blob)
|
|
340
340
|
for(int y = 0; y < tex->height; y++)
|
341
341
|
for(int x = 0; x < tex->width; x++) {
|
342
342
|
int buf_index = 4 * (x + y * tex->width);
|
343
|
-
|
343
|
+
|
344
344
|
int offset = calc_pixel_offset(tex, x, y);
|
345
345
|
|
346
346
|
memcpy(blob + buf_index, data + offset, 4);
|
@@ -354,7 +354,7 @@ m_to_blob(VALUE self)
|
|
354
354
|
{
|
355
355
|
texture_info tex;
|
356
356
|
int sidelength;
|
357
|
-
|
357
|
+
|
358
358
|
get_texture_info(self, &tex);
|
359
359
|
|
360
360
|
glEnable(GL_TEXTURE_2D);
|
@@ -370,7 +370,7 @@ m_to_blob(VALUE self)
|
|
370
370
|
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE,(void*)(new_array));
|
371
371
|
|
372
372
|
VALUE blob = rb_str_new(NULL, 4 * tex.width * tex.height);
|
373
|
-
|
373
|
+
|
374
374
|
get_image_chunk_with_size(new_array, &tex, RSTRING_PTR(blob));
|
375
375
|
|
376
376
|
glDisable(GL_TEXTURE_2D);
|
@@ -380,7 +380,7 @@ m_to_blob(VALUE self)
|
|
380
380
|
|
381
381
|
/* return the pixel colour for the given x, y */
|
382
382
|
VALUE
|
383
|
-
m_getpixel(int argc, VALUE * argv, VALUE self)
|
383
|
+
m_getpixel(int argc, VALUE * argv, VALUE self)
|
384
384
|
{
|
385
385
|
int x1, y1;
|
386
386
|
int last = argc - 1;
|
@@ -388,7 +388,7 @@ m_getpixel(int argc, VALUE * argv, VALUE self)
|
|
388
388
|
rgba pix;
|
389
389
|
bool gosu_color_mode = false;
|
390
390
|
VALUE options;
|
391
|
-
|
391
|
+
|
392
392
|
|
393
393
|
process_x_y_pairs(self, 1, argv, &x1, &y1);
|
394
394
|
|
@@ -415,13 +415,13 @@ m_getpixel(int argc, VALUE * argv, VALUE self)
|
|
415
415
|
|
416
416
|
/* circle action */
|
417
417
|
VALUE
|
418
|
-
m_circle(int argc, VALUE * argv, VALUE self)
|
418
|
+
m_circle(int argc, VALUE * argv, VALUE self)
|
419
419
|
{
|
420
420
|
int x1, y1, r;
|
421
421
|
int last = argc - 1;
|
422
422
|
VALUE options;
|
423
|
-
texture_info tex;
|
424
|
-
|
423
|
+
texture_info tex;
|
424
|
+
|
425
425
|
if(argc < 2) rb_raise(rb_eArgError, "circle action needs at least 2 parameter");
|
426
426
|
|
427
427
|
process_x_y_pairs(self, 1, argv, &x1, &y1);
|
@@ -464,7 +464,7 @@ m_ngon(int argc, VALUE * argv, VALUE self)
|
|
464
464
|
|
465
465
|
return self;
|
466
466
|
}
|
467
|
-
|
467
|
+
|
468
468
|
|
469
469
|
/* flood fill action */
|
470
470
|
VALUE
|
@@ -475,7 +475,7 @@ m_flood_fill(int argc, VALUE * argv, VALUE self)
|
|
475
475
|
VALUE options;
|
476
476
|
texture_info tex;
|
477
477
|
bool iter = false, glow = false;
|
478
|
-
|
478
|
+
|
479
479
|
if (argc < 1) rb_raise(rb_eArgError, "flood fill action needs at least 1 parameter");
|
480
480
|
|
481
481
|
process_x_y_pairs(self, 1, argv, &x1, &y1);
|
@@ -485,9 +485,9 @@ m_flood_fill(int argc, VALUE * argv, VALUE self)
|
|
485
485
|
get_texture_info(self, &tex);
|
486
486
|
|
487
487
|
if(is_a_hash(options)) {
|
488
|
-
if(RTEST(get_from_hash(options, "iter")))
|
488
|
+
if(RTEST(get_from_hash(options, "iter")))
|
489
489
|
iter = true;
|
490
|
-
if(RTEST(get_from_hash(options, "glow")))
|
490
|
+
if(RTEST(get_from_hash(options, "glow")))
|
491
491
|
glow = true;
|
492
492
|
}
|
493
493
|
|
@@ -502,7 +502,7 @@ m_flood_fill(int argc, VALUE * argv, VALUE self)
|
|
502
502
|
else {
|
503
503
|
scan_fill_do_action(x1, y1, &tex, options, sync_mode, true, NULL);
|
504
504
|
}
|
505
|
-
|
505
|
+
|
506
506
|
return self;
|
507
507
|
}
|
508
508
|
|
@@ -524,7 +524,7 @@ convert_trace_match_to_ruby_array(trace_match match, bool gosu_color_mode)
|
|
524
524
|
|
525
525
|
/* line action */
|
526
526
|
VALUE
|
527
|
-
m_line(int argc, VALUE * argv, VALUE self)
|
527
|
+
m_line(int argc, VALUE * argv, VALUE self)
|
528
528
|
{
|
529
529
|
int x1, y1, x2, y2;
|
530
530
|
int last = argc - 1;
|
@@ -552,13 +552,13 @@ m_line(int argc, VALUE * argv, VALUE self)
|
|
552
552
|
else
|
553
553
|
return convert_trace_match_to_ruby_array(match, gosu_color_mode);
|
554
554
|
}
|
555
|
-
|
555
|
+
|
556
556
|
return self;
|
557
557
|
}
|
558
558
|
|
559
559
|
/* box action */
|
560
560
|
VALUE
|
561
|
-
m_rect(int argc, VALUE * argv, VALUE self)
|
561
|
+
m_rect(int argc, VALUE * argv, VALUE self)
|
562
562
|
{
|
563
563
|
|
564
564
|
int x1, y1, x2, y2;
|
@@ -573,7 +573,7 @@ m_rect(int argc, VALUE * argv, VALUE self)
|
|
573
573
|
options = argv[last];
|
574
574
|
|
575
575
|
get_texture_info(self, &tex);
|
576
|
-
|
576
|
+
|
577
577
|
rect_do_action(x1, y1, x2, y2, &tex, options, sync_mode, true, NULL);
|
578
578
|
|
579
579
|
return self;
|
@@ -582,13 +582,13 @@ m_rect(int argc, VALUE * argv, VALUE self)
|
|
582
582
|
|
583
583
|
/* pixel action */
|
584
584
|
VALUE
|
585
|
-
m_pixel(int argc, VALUE * argv, VALUE self)
|
585
|
+
m_pixel(int argc, VALUE * argv, VALUE self)
|
586
586
|
{
|
587
587
|
int x1, y1;
|
588
588
|
int last = argc - 1;
|
589
589
|
VALUE options;
|
590
590
|
texture_info tex;
|
591
|
-
|
591
|
+
|
592
592
|
if(argc < 1) rb_raise(rb_eArgError, "pixel action needs 1 parameter");
|
593
593
|
|
594
594
|
process_x_y_pairs(self, 1, argv, &x1, &y1);
|
@@ -596,7 +596,7 @@ m_pixel(int argc, VALUE * argv, VALUE self)
|
|
596
596
|
options = argv[last];
|
597
597
|
|
598
598
|
get_texture_info(self, &tex);
|
599
|
-
|
599
|
+
|
600
600
|
pixel_do_action(x1, y1, &tex, options, sync_mode, true, NULL);
|
601
601
|
|
602
602
|
return self;
|
@@ -612,13 +612,13 @@ m_bezier(int argc, VALUE * argv, VALUE self)
|
|
612
612
|
texture_info tex;
|
613
613
|
|
614
614
|
if(argc < 1) rb_raise(rb_eArgError, "bezier action needs at least 1 parameter");
|
615
|
-
|
615
|
+
|
616
616
|
/* get array of points */
|
617
617
|
points = argv[0];
|
618
618
|
Check_Type(points, T_ARRAY);
|
619
|
-
|
619
|
+
|
620
620
|
options = argv[last];
|
621
|
-
|
621
|
+
|
622
622
|
get_texture_info(self, &tex);
|
623
623
|
|
624
624
|
bezier_do_action(points, &tex, options, sync_mode, true, NULL);
|
@@ -654,7 +654,7 @@ m_polyline(int argc, VALUE * argv, VALUE self)
|
|
654
654
|
|
655
655
|
/* splice action */
|
656
656
|
VALUE
|
657
|
-
m_splice(int argc, VALUE * argv, VALUE self)
|
657
|
+
m_splice(int argc, VALUE * argv, VALUE self)
|
658
658
|
{
|
659
659
|
int x0, y0;
|
660
660
|
int cx1 = 0, cy1 = 0, cx2 = XMAX_OOB, cy2 = YMAX_OOB;
|
@@ -678,9 +678,9 @@ m_splice(int argc, VALUE * argv, VALUE self)
|
|
678
678
|
options = argv[last];
|
679
679
|
|
680
680
|
get_texture_info(self, &tex);
|
681
|
-
|
681
|
+
|
682
682
|
/* get the crop boundaries */
|
683
|
-
if(is_a_hash(options))
|
683
|
+
if(is_a_hash(options))
|
684
684
|
if(RTEST(get_from_hash(options, "crop"))) {
|
685
685
|
VALUE c = get_from_hash(options, "crop");
|
686
686
|
Check_Type(c, T_ARRAY);
|
@@ -692,14 +692,14 @@ m_splice(int argc, VALUE * argv, VALUE self)
|
|
692
692
|
|
693
693
|
splice_do_action(x0, y0, cx1, cy1, cx2, cy2, &splice_tex,
|
694
694
|
&tex, options, sync_mode, true, NULL);
|
695
|
-
|
695
|
+
|
696
696
|
return self;
|
697
697
|
}
|
698
698
|
|
699
699
|
|
700
700
|
/* clear action - really just an alias for box */
|
701
701
|
VALUE
|
702
|
-
m_clear(int argc, VALUE * argv, VALUE self)
|
702
|
+
m_clear(int argc, VALUE * argv, VALUE self)
|
703
703
|
{
|
704
704
|
VALUE parms[4];
|
705
705
|
|
@@ -715,13 +715,13 @@ m_clear(int argc, VALUE * argv, VALUE self)
|
|
715
715
|
|
716
716
|
/* offset function */
|
717
717
|
VALUE
|
718
|
-
m_offset(int argc, VALUE * argv, VALUE self)
|
719
|
-
{
|
718
|
+
m_offset(int argc, VALUE * argv, VALUE self)
|
719
|
+
{
|
720
720
|
char * try_offset;
|
721
721
|
|
722
722
|
if(argc == 0)
|
723
723
|
return get_image_local(self, DRAW_OFFSET);
|
724
|
-
|
724
|
+
|
725
725
|
switch(TYPE(argv[0])) {
|
726
726
|
|
727
727
|
case T_ARRAY:
|
@@ -730,11 +730,11 @@ m_offset(int argc, VALUE * argv, VALUE self)
|
|
730
730
|
break;
|
731
731
|
case T_SYMBOL:
|
732
732
|
try_offset = sym2string(argv[0]);
|
733
|
-
|
733
|
+
|
734
734
|
if(!strcmp("default", try_offset)) {
|
735
735
|
set_image_local(self, DRAW_OFFSET, Qnil);
|
736
736
|
}
|
737
|
-
else {
|
737
|
+
else {
|
738
738
|
rb_raise(rb_eArgError, "no such offset defined: %s\n", try_offset);
|
739
739
|
}
|
740
740
|
|
@@ -747,37 +747,37 @@ m_offset(int argc, VALUE * argv, VALUE self)
|
|
747
747
|
|
748
748
|
/* color change */
|
749
749
|
VALUE
|
750
|
-
m_color(int argc, VALUE * argv, VALUE self)
|
750
|
+
m_color(int argc, VALUE * argv, VALUE self)
|
751
751
|
{
|
752
752
|
VALUE first;
|
753
753
|
rgba new_color;
|
754
754
|
|
755
755
|
/* if no params then return action current color */
|
756
|
-
if(argc == 0)
|
756
|
+
if(argc == 0)
|
757
757
|
return get_image_local(self, IMAGE_COLOR);
|
758
|
-
|
758
|
+
|
759
759
|
/* otherwise set the action color */
|
760
760
|
/* NB: we cannot just set image_local_color to 'first' because first may not be an array,
|
761
761
|
it could also be a symbol */
|
762
762
|
|
763
763
|
first = argv[0];
|
764
|
-
|
764
|
+
|
765
765
|
new_color = convert_rb_color_to_rgba(first);
|
766
766
|
|
767
767
|
/* im quite sure i DO want to set the color even if it is not_a_color.
|
768
768
|
why ? consistency only
|
769
769
|
(NB: not_a_color_v is skipped by the set_pixel_color routine */
|
770
|
-
|
770
|
+
|
771
771
|
/* if(is_a_color(new_color)) */
|
772
|
-
|
772
|
+
|
773
773
|
save_rgba_to_image_local_color(self, new_color);
|
774
|
-
|
774
|
+
|
775
775
|
return Qnil;
|
776
776
|
}
|
777
777
|
|
778
778
|
/* this function manages all other method calls */
|
779
779
|
VALUE
|
780
|
-
m_missing(int argc, VALUE * argv, VALUE self)
|
780
|
+
m_missing(int argc, VALUE * argv, VALUE self)
|
781
781
|
{
|
782
782
|
char * action_name = lowercase(sym2string(argv[0]));
|
783
783
|
|
@@ -795,7 +795,7 @@ m_missing(int argc, VALUE * argv, VALUE self)
|
|
795
795
|
|
796
796
|
/* refreshes the cache */
|
797
797
|
VALUE
|
798
|
-
m_cache_refresh(VALUE self)
|
798
|
+
m_cache_refresh(VALUE self)
|
799
799
|
{
|
800
800
|
texture_info tex;
|
801
801
|
|
@@ -808,7 +808,7 @@ m_cache_refresh(VALUE self)
|
|
808
808
|
|
809
809
|
/* check whether img quad is already cached */
|
810
810
|
VALUE
|
811
|
-
m_quad_cached(VALUE self)
|
811
|
+
m_quad_cached(VALUE self)
|
812
812
|
{
|
813
813
|
VALUE info, gc_state_off;
|
814
814
|
int tex_name;
|
@@ -823,7 +823,7 @@ m_quad_cached(VALUE self)
|
|
823
823
|
tex_name = FIX2INT(rb_funcall(info, rb_intern("tex_name"), 0));
|
824
824
|
|
825
825
|
entry = find_in_cache(tex_name);
|
826
|
-
|
826
|
+
|
827
827
|
/* only enable gc if was enabled on function entry */
|
828
828
|
if(!gc_state_off) rb_gc_enable();
|
829
829
|
|
@@ -852,7 +852,7 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
852
852
|
|
853
853
|
if(RARRAY_LEN(region) < 4)
|
854
854
|
rb_raise(rb_eArgError, "region requires 4 elements");
|
855
|
-
|
855
|
+
|
856
856
|
x1 = NUM2INT(get_from_array(region, 0));
|
857
857
|
y1 = NUM2INT(get_from_array(region, 1));
|
858
858
|
x2 = NUM2INT(get_from_array(region, 2));
|
@@ -866,7 +866,7 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
866
866
|
&x2, &y2, tex.width, tex.height);
|
867
867
|
|
868
868
|
proc = rb_block_proc();
|
869
|
-
|
869
|
+
|
870
870
|
each_pixel_do_action(x1, y1, x2, y2, proc, &tex, options, sync_mode, true, NULL);
|
871
871
|
|
872
872
|
return self;
|
@@ -886,13 +886,13 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
886
886
|
/* texture_info tex; */
|
887
887
|
|
888
888
|
/* if(argc < 1) rb_raise(rb_eArgError, "bezier action needs at least 1 parameter"); */
|
889
|
-
|
889
|
+
|
890
890
|
/* /\* get array of points *\/ */
|
891
891
|
/* points = argv[0]; */
|
892
892
|
/* Check_Type(points, T_ARRAY); */
|
893
|
-
|
893
|
+
|
894
894
|
/* options = argv[last]; */
|
895
|
-
|
895
|
+
|
896
896
|
/* get_texture_info(self, &tex); */
|
897
897
|
|
898
898
|
/* bezier_do_action(points, &tex, options, sync_mode, true, NULL); */
|
@@ -905,8 +905,8 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
905
905
|
|
906
906
|
/* below is yucky old code that needs to be updated */
|
907
907
|
/* each_pixel iterator */
|
908
|
-
|
909
|
-
|
908
|
+
|
909
|
+
|
910
910
|
/* VALUE */
|
911
911
|
/* m_each(int argc, VALUE * argv, VALUE self) */
|
912
912
|
/* { */
|
@@ -923,7 +923,7 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
923
923
|
/* rb_raise(rb_eRuntimeError, "block arity must be either 1 or 3"); */
|
924
924
|
|
925
925
|
/* /\* rb_scan_args(argc, argv, "01", &options); *\/ */
|
926
|
-
|
926
|
+
|
927
927
|
/* /\* /\\* get texture info *\\/ *\/ */
|
928
928
|
/* /\* get_texture_info(self, &tex); *\/ */
|
929
929
|
|
@@ -937,14 +937,14 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
937
937
|
/* /\* y0 = NUM2INT(get_from_array(region, 1)); *\/ */
|
938
938
|
/* /\* x1 = NUM2INT(get_from_array(region, 2)); *\/ */
|
939
939
|
/* /\* y1 = NUM2INT(get_from_array(region, 3)); *\/ */
|
940
|
-
|
940
|
+
|
941
941
|
/* /\* constrain_boundaries(&x0, &y0, &x1, &y1, tex.width, tex.height); *\/ */
|
942
942
|
/* /\* } *\/ */
|
943
943
|
|
944
944
|
/* /\* /\\* width and height of action *\\/ *\/ */
|
945
945
|
/* /\* xbound = x1 - x0; *\/ */
|
946
946
|
/* /\* ybound = y1 - y0; *\/ */
|
947
|
-
|
947
|
+
|
948
948
|
/* /\* yield_vals = rb_ary_new(); *\/ */
|
949
949
|
|
950
950
|
/* /\* for(y = 0; y < ybound; y++) *\/ */
|
@@ -954,10 +954,10 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
954
954
|
|
955
955
|
/* /\* /\\* adjusted x and y *\\/ *\/ */
|
956
956
|
/* /\* register int ax = x + x0, ay = y + y0; *\/ */
|
957
|
-
|
957
|
+
|
958
958
|
/* /\* pixel_data[0] = INT2FIX(ax); *\/ */
|
959
959
|
/* /\* pixel_data[1] = INT2FIX(ay); *\/ */
|
960
|
-
|
960
|
+
|
961
961
|
/* /\* pixel_color = m_getpixel(self, INT2FIX(ax), INT2FIX(ay)); *\/ */
|
962
962
|
|
963
963
|
/* /\* if(arity == 1) { *\/ */
|
@@ -967,7 +967,7 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
967
967
|
/* /\* rb_ary_store(yield_vals, 0, pixel_color); *\/ */
|
968
968
|
/* /\* rb_ary_store(yield_vals, 1, INT2FIX(x)); *\/ */
|
969
969
|
/* /\* rb_ary_store(yield_vals, 2, INT2FIX(y)); *\/ */
|
970
|
-
|
970
|
+
|
971
971
|
/* /\* rb_yield(yield_vals); *\/ */
|
972
972
|
/* /\* } *\/ */
|
973
973
|
|
@@ -1011,10 +1011,10 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
1011
1011
|
/* /\* else if(options != Qnil) { *\/ */
|
1012
1012
|
/* /\* rb_raise(rb_eArgError, "argument must be a hash"); *\/ */
|
1013
1013
|
/* /\* } *\/ */
|
1014
|
-
|
1014
|
+
|
1015
1015
|
/* /\* /\\* get texture info *\\/ *\/ */
|
1016
1016
|
/* /\* get_texture_info(self, &tex); *\/ */
|
1017
|
-
|
1017
|
+
|
1018
1018
|
/* /\* for(y = 0; y < tex.height; y++) { *\/ */
|
1019
1019
|
/* /\* for(x = 0; x < tex.width; x++) { *\/ */
|
1020
1020
|
/* /\* offset = calc_pixel_offset(&tex, x, y); *\/ */
|
@@ -1057,7 +1057,7 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
1057
1057
|
/* /\* image_bounds bounds; *\/ */
|
1058
1058
|
|
1059
1059
|
/* /\* rb_scan_args(argc, argv, "01", &options); *\/ */
|
1060
|
-
|
1060
|
+
|
1061
1061
|
/* /\* /\\* default values for other params *\\/ *\/ */
|
1062
1062
|
/* /\* step = 1; loop = Qfalse; *\/ */
|
1063
1063
|
|
@@ -1068,7 +1068,7 @@ m_each(int argc, VALUE * argv, VALUE self)
|
|
1068
1068
|
/* /\* else if(options != Qnil) { *\/ */
|
1069
1069
|
/* /\* rb_raise(rb_eArgError, "argument must be a hash"); *\/ */
|
1070
1070
|
/* /\* } *\/ */
|
1071
|
-
|
1071
|
+
|
1072
1072
|
/* /\* /\\* get texture info *\\/ *\/ */
|
1073
1073
|
/* /\* get_texture_info(self, &tex); *\/ */
|
1074
1074
|
|
data/lib/texplay/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: texplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 0.4.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John Mair (banisterfiend)
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-10 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gosu
|