texplay 0.2.910 → 0.2.920
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/README.markdown +1 -1
- data/examples/example_blank.rb +22 -0
- data/examples/example_trace.rb +2 -2
- data/ext/texplay/bindings.c +11 -3
- data/lib/texplay/version.rb +1 -1
- metadata +4 -3
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'common'
|
3
|
+
require 'gosu'
|
4
|
+
require 'texplay'
|
5
|
+
|
6
|
+
|
7
|
+
class W < Gosu::Window
|
8
|
+
def initialize
|
9
|
+
super(500, 500, false, 20)
|
10
|
+
@img = TexPlay.create_image(self, 500, 500, :color => Gosu::Color::BLUE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def draw
|
14
|
+
@img.draw 100, 50,1
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
w = W.new
|
21
|
+
w.show
|
22
|
+
|
data/examples/example_trace.rb
CHANGED
@@ -5,10 +5,10 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = TexPlay.create_image(self, 500, 500).fill(3,3, :color => :alpha)
|
10
10
|
@img.rect 100, 100, 300 , 300, :color => :blue, :fill => true
|
11
|
-
puts (@img.line 400, 200, 100, 200, :trace => { :until_color => :blue })
|
11
|
+
puts (@img.line 400, 200, 100, 200, :trace => { :until_color => :blue }, :color_mode => :gosu)
|
12
12
|
end
|
13
13
|
|
14
14
|
def draw
|
data/ext/texplay/bindings.c
CHANGED
@@ -520,13 +520,17 @@ m_flood_fill(int argc, VALUE * argv, VALUE self)
|
|
520
520
|
}
|
521
521
|
|
522
522
|
static inline VALUE
|
523
|
-
convert_trace_match_to_ruby_array(trace_match match)
|
523
|
+
convert_trace_match_to_ruby_array(trace_match match, bool gosu_color_mode)
|
524
524
|
{
|
525
525
|
VALUE ary = rb_ary_new();
|
526
526
|
|
527
527
|
rb_ary_store(ary, 0, INT2FIX(match.x));
|
528
528
|
rb_ary_store(ary, 1, INT2FIX(match.y));
|
529
|
-
|
529
|
+
|
530
|
+
if (gosu_color_mode)
|
531
|
+
rb_ary_store(ary, 2, convert_rgba_to_gosu_color(&match.color));
|
532
|
+
else
|
533
|
+
rb_ary_store(ary, 2, convert_rgba_to_rb_color(&match.color));
|
530
534
|
|
531
535
|
return ary;
|
532
536
|
}
|
@@ -537,6 +541,7 @@ m_line(int argc, VALUE * argv, VALUE self)
|
|
537
541
|
{
|
538
542
|
int x1, y1, x2, y2;
|
539
543
|
int last = argc - 1;
|
544
|
+
bool gosu_color_mode = false;
|
540
545
|
VALUE options;
|
541
546
|
texture_info tex;
|
542
547
|
trace_match match;
|
@@ -549,6 +554,9 @@ m_line(int argc, VALUE * argv, VALUE self)
|
|
549
554
|
|
550
555
|
options = argv[last];
|
551
556
|
|
557
|
+
if (hash_value_is(options, "color_mode", string2sym("gosu")))
|
558
|
+
gosu_color_mode = true;
|
559
|
+
|
552
560
|
get_texture_info(self, &tex);
|
553
561
|
|
554
562
|
match = line_do_action(x1, y1, x2, y2, &tex, options, sync_mode, true, NULL);
|
@@ -557,7 +565,7 @@ m_line(int argc, VALUE * argv, VALUE self)
|
|
557
565
|
if (match.x == -1)
|
558
566
|
return Qnil;
|
559
567
|
else
|
560
|
-
return convert_trace_match_to_ruby_array(match);
|
568
|
+
return convert_trace_match_to_ruby_array(match, gosu_color_mode);
|
561
569
|
}
|
562
570
|
|
563
571
|
return self;
|
data/lib/texplay/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 920
|
9
|
+
version: 0.2.920
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Mair (banisterfiend)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-08 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- examples/common.rb
|
68
68
|
- examples/example_alpha_blend.rb
|
69
69
|
- examples/example_bezier.rb
|
70
|
+
- examples/example_blank.rb
|
70
71
|
- examples/example_color_control.rb
|
71
72
|
- examples/example_color_transform.rb
|
72
73
|
- examples/example_color_transform_circle.rb
|