texplay 0.2.1-x86-mswin32-60 → 0.2.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/CHANGELOG +10 -0
  2. data/README.markdown +35 -0
  3. data/README1st +1 -1
  4. data/Rakefile +87 -85
  5. data/examples/example_alpha_blend.rb +1 -1
  6. data/examples/example_bezier.rb +4 -13
  7. data/examples/example_color_control.rb +3 -2
  8. data/examples/example_color_transform.rb +3 -3
  9. data/examples/example_dup.rb +1 -1
  10. data/examples/example_each.rb +1 -1
  11. data/examples/example_effect.rb +1 -1
  12. data/examples/example_fill.rb +4 -9
  13. data/examples/example_fill_old.rb +1 -1
  14. data/examples/example_fluent.rb +1 -1
  15. data/examples/example_gen_eval.rb +1 -1
  16. data/examples/example_hash_arguments.rb +1 -1
  17. data/examples/example_melt.rb +1 -1
  18. data/examples/example_polyline.rb +1 -1
  19. data/examples/example_simple.rb +4 -1
  20. data/examples/example_splice.rb +33 -0
  21. data/examples/example_sync.rb +1 -1
  22. data/examples/example_turtle.rb +2 -2
  23. data/lib/ctexplay.18.so +0 -0
  24. data/lib/ctexplay.19.so +0 -0
  25. data/lib/texplay-contrib.rb +8 -8
  26. data/lib/texplay.rb +7 -7
  27. data/src/Makefile +93 -62
  28. data/src/actions.c +80 -55
  29. data/src/actions.obj +0 -0
  30. data/src/bindings.c +2 -2
  31. data/src/bindings.obj +0 -0
  32. data/src/cache.obj +0 -0
  33. data/src/ctexplay-i386-mswin32.exp +0 -0
  34. data/src/ctexplay-i386-mswin32.lib +0 -0
  35. data/src/ctexplay-i386-mswin32.pdb +0 -0
  36. data/src/ctexplay.so +0 -0
  37. data/src/gen_eval.obj +0 -0
  38. data/src/mkmf.log +33 -18
  39. data/src/object2module.obj +0 -0
  40. data/src/texplay.c +1 -1
  41. data/src/texplay.obj +0 -0
  42. data/src/utils.c +6 -5
  43. data/src/utils.obj +0 -0
  44. data/src/vc60.pdb +0 -0
  45. metadata +4 -9
  46. data/README +0 -21
  47. data/examples/basic.rb +0 -48
  48. data/examples/basic2.rb +0 -37
  49. data/examples/benchmark.rb +0 -299
  50. data/examples/specs.rb +0 -240
  51. data/examples/test.rb +0 -70
  52. data/examples/test2.rb +0 -72
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ 8/9/09
2
+ version 0.2.2
3
+ * fixed color_control bug, action_struct->color was being overwritten (now using a temp).
4
+ * fixed faulty error msg where max tex size was being displayed as 1024 but is actually 1022
5
+ * added :start_angle parameter to ngon action
6
+ * fixed example screen height from 769 to 768
7
+ * arity of -1 and 0 now supported for color_control procs
8
+ * fixed parameter checks for circle and ngon
9
+ * updated documentation to reflect changes, and added details on caching
10
+
1
11
  2/9/09
2
12
  version 0.2.1
3
13
  * releasing a gem for TexPlay
data/README.markdown ADDED
@@ -0,0 +1,35 @@
1
+ ![Alt text](https://dl.getdropbox.com/u/239375/texplay.png)
2
+
3
+ *an image manipulation tool for ruby and gosu*
4
+
5
+ INSTRUCTIONS
6
+ ============
7
+
8
+ **TexPlay version 0.2.2**
9
+
10
+ Gem installation:
11
+
12
+ + sudo gem install texplay
13
+
14
+ To compile TexPlay from source, ensure you are in the directory with the Rakefile and type:
15
+
16
+ + rake
17
+
18
+ OR
19
+
20
+ + rake19 (assuming this is the name of your 1.9.1 version of rake)
21
+
22
+ **NB:** be sure to run the version of rake that corresponds to the ruby version you wish to use! on my system I use rake19 for ruby 1.9.1!
23
+
24
+ If all goes well, run the example programs:
25
+
26
+ + cd examples
27
+ + ruby example_melt.rb
28
+ + ruby example_simple.rb
29
+ + ..etc
30
+
31
+ + like any gosu application, gosu.so must be in the current directory (or the gosu gem installed) when running the examples.
32
+
33
+
34
+ ---
35
+ Enjoy!
data/README1st CHANGED
@@ -1,6 +1,6 @@
1
1
  INSTRUCTIONS
2
2
 
3
- TexPlay version 0.2.1
3
+ TexPlay version 0.2.2
4
4
 
5
5
  *Ensure that ctexplay.so and gosu.so, and texplay.rb and texplay-contrib.rb are in the working directory for your project
6
6
  *require 'texplay' in your ruby program to access the TexPlay module
data/Rakefile CHANGED
@@ -1,85 +1,87 @@
1
- require 'rake/clean'
2
- require 'rake/gempackagetask'
3
-
4
- $dlext = Config::CONFIG['DLEXT']
5
-
6
- CLEAN.include("src/*.#{$dlext}", "src/*.log", "src/*.o", "src/*~", "src/*#*", "src/*.obj", "src/*.def", "src/*.pdb")
7
- CLOBBER.include("**/*.#{$dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
8
-
9
- $make_program = if RUBY_PLATFORM =~ /win/
10
- "nmake"
11
- else
12
- "make"
13
- end
14
-
15
- task :default => [:build]
16
-
17
- desc "Build TexPlay"
18
- task :build => :clean do
19
- puts "(2) building Makefile..."
20
- chdir("./src/") do
21
- ruby "extconf.rb"
22
- puts "(3) building ctexplay.#{$dlext}..."
23
- sh "#{$make_program}"
24
- puts "(4) copying ctexplay.#{$dlext} to current directory..."
25
- cp "ctexplay.#{$dlext}", "../lib" , :verbose => true
26
-
27
- if RUBY_PLATFORM =~ /mswin/
28
- if RUBY_VERSION =~ /1.9/
29
- File.rename("../lib/ctexplay.#{$dlext}", "../lib/ctexplay.19.#{$dlext}")
30
- else
31
- File.rename("../lib/ctexplay.#{$dlext}", "../lib/ctexplay.18.#{$dlext}")
32
- end
33
- end
34
- puts "(5) ...done!"
35
- end
36
- end
37
-
38
- specification = Gem::Specification.new do |s|
39
- s.name = "texplay"
40
- s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
41
- s.version = "0.2.1"
42
- s.date = "2009-09-02"
43
- s.author = "John Mair (banisterfiend)"
44
- s.email = 'jrmair@gmail.com'
45
- s.description = s.summary
46
- s.require_path = 'lib'
47
- s.add_dependency("gosu",">=0.7.14")
48
- s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
49
- s.has_rdoc = false
50
- s.files = ["Rakefile", "README", "CHANGELOG", "README1st",
51
- "lib/texplay.rb", "lib/texplay-contrib.rb"] +
52
- FileList["src/*", "examples/*.rb", "examples/media/*"].to_a
53
-
54
- if RUBY_PLATFORM =~ /mswin/
55
- s.platform = Gem::Platform::CURRENT
56
- s.files += ["lib/ctexplay.18.so", "lib/ctexplay.19.so"]
57
-
58
- else
59
- s.platform = Gem::Platform::RUBY
60
- s.extensions = ["src/extconf.rb"]
61
- end
62
- end
63
- Rake::GemPackageTask.new(specification) do |package|
64
- package.need_zip = false
65
- package.need_tar = false
66
- end
67
-
68
- SELENE = '/home/john/ruby/projects/selene'
69
- desc "update selene's version of texplay"
70
- task :selene => ["#{SELENE}/lib/texplay.rb", "#{SELENE}/lib/texplay-contrib.rb",
71
- "#{SELENE}/lib/ctexplay.so"] do
72
- puts "...done!"
73
- end
74
-
75
- file "#{SELENE}/lib/texplay.rb" => "texplay.rb" do |t|
76
- cp t.prerequisites.first, t.name, :verbose => true
77
- end
78
-
79
- file "#{SELENE}/lib/texplay-contrib.rb" => "texplay-contrib.rb" do |t|
80
- cp t.prerequisites.first, t.name, :verbose => true
81
- end
82
-
83
- file "#{SELENE}/lib/ctexplay.#{$dlext}" => "ctexplay.#{$dlext}" do |t|
84
- cp t.prerequisites.first, t.name, :verbose => true
85
- end
1
+ require 'rake/clean'
2
+ require 'rake/gempackagetask'
3
+
4
+ TEXPLAY_VERSION = "0.2.2"
5
+
6
+ $dlext = Config::CONFIG['DLEXT']
7
+
8
+ CLEAN.include("src/*.#{$dlext}", "src/*.log", "src/*.o", "src/*~", "src/*#*", "src/*.obj", "src/*.def", "src/*.pdb")
9
+ CLOBBER.include("**/*.#{$dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
10
+
11
+ $make_program = if RUBY_PLATFORM =~ /win/
12
+ "nmake"
13
+ else
14
+ "make"
15
+ end
16
+
17
+ task :default => [:build]
18
+
19
+ desc "Build TexPlay"
20
+ task :build => :clean do
21
+ puts "(2) building Makefile..."
22
+ chdir("./src/") do
23
+ ruby "extconf.rb"
24
+ puts "(3) building ctexplay.#{$dlext}..."
25
+ sh "#{$make_program}"
26
+ puts "(4) copying ctexplay.#{$dlext} to current directory..."
27
+ cp "ctexplay.#{$dlext}", "../lib" , :verbose => true
28
+
29
+ if RUBY_PLATFORM =~ /mswin/
30
+ if RUBY_VERSION =~ /1.9/
31
+ File.rename("../lib/ctexplay.#{$dlext}", "../lib/ctexplay.19.#{$dlext}")
32
+ else
33
+ File.rename("../lib/ctexplay.#{$dlext}", "../lib/ctexplay.18.#{$dlext}")
34
+ end
35
+ end
36
+ puts "(5) ...done!"
37
+ end
38
+ end
39
+
40
+ specification = Gem::Specification.new do |s|
41
+ s.name = "texplay"
42
+ s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
43
+ s.version = TEXPLAY_VERSION
44
+ s.date = "2009-09-09"
45
+ s.author = "John Mair (banisterfiend)"
46
+ s.email = 'jrmair@gmail.com'
47
+ s.description = s.summary
48
+ s.require_path = 'lib'
49
+ s.add_dependency("gosu",">=0.7.14")
50
+ s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
51
+ s.has_rdoc = false
52
+ s.files = ["Rakefile", "README.markdown", "CHANGELOG", "README1st",
53
+ "lib/texplay.rb", "lib/texplay-contrib.rb"] +
54
+ FileList["src/*", "examples/*.rb", "examples/media/*"].to_a
55
+
56
+ if RUBY_PLATFORM =~ /mswin/
57
+ s.platform = Gem::Platform::CURRENT
58
+ s.files += ["lib/ctexplay.18.so", "lib/ctexplay.19.so"]
59
+
60
+ else
61
+ s.platform = Gem::Platform::RUBY
62
+ s.extensions = ["src/extconf.rb"]
63
+ end
64
+ end
65
+ Rake::GemPackageTask.new(specification) do |package|
66
+ package.need_zip = false
67
+ package.need_tar = false
68
+ end
69
+
70
+ SELENE = '/home/john/ruby/projects/selene'
71
+ desc "update selene's version of texplay"
72
+ task :selene => ["#{SELENE}/lib/texplay.rb", "#{SELENE}/lib/texplay-contrib.rb",
73
+ "#{SELENE}/lib/ctexplay.so"] do
74
+ puts "...done!"
75
+ end
76
+
77
+ file "#{SELENE}/lib/texplay.rb" => "texplay.rb" do |t|
78
+ cp t.prerequisites.first, t.name, :verbose => true
79
+ end
80
+
81
+ file "#{SELENE}/lib/texplay-contrib.rb" => "texplay-contrib.rb" do |t|
82
+ cp t.prerequisites.first, t.name, :verbose => true
83
+ end
84
+
85
+ file "#{SELENE}/lib/ctexplay.#{$dlext}" => "ctexplay.#{$dlext}" do |t|
86
+ cp t.prerequisites.first, t.name, :verbose => true
87
+ end
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
  @tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
11
11
 
@@ -5,8 +5,8 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
9
- @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
8
+ super(1024, 768, false, 20)
9
+ @img = TexPlay::create_blank_image(self, 500, 500)
10
10
 
11
11
  # put a border on the image
12
12
  @img.rect 0,0, @img.width - 1, @img.height - 1
@@ -23,18 +23,9 @@ class W < Gosu::Window
23
23
  points << p
24
24
  }
25
25
 
26
- @img.move_to(points.first.x, points.first.y)
26
+ # making the bezier
27
+ @img.bezier points, :color => :red
27
28
 
28
- # making the bezier more interesting by using turtle graphics :) (a rough bezier)
29
- @img.bezier points, :color => :red, :color_control => proc { |c, x, y|
30
- if((x % 10) == 0) then
31
- @img.line_to(x, y + rand * 20 - 10)
32
- end
33
- :none
34
- }
35
-
36
- #@img.fill 100, 400, :color => :yellow
37
-
38
29
  # NOTE: can 'close' a bezier curve too (as with polylines)
39
30
  end
40
31
 
@@ -4,7 +4,7 @@ require 'texplay'
4
4
 
5
5
  class W < Gosu::Window
6
6
  def initialize
7
- super(1024, 769, false, 20)
7
+ super(1024, 768, false, 20)
8
8
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
9
9
  @tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
10
10
  @gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
@@ -18,6 +18,7 @@ class W < Gosu::Window
18
18
  # a valid color symbol)
19
19
 
20
20
  # color_control accepts procs of 4 types:
21
+ # arity of 0: nothing is yielded and color is set by return value of block
21
22
  # arity of 1: just the destination pixel color is yielded
22
23
  # arity of 2: both the destination and the source pixel colors are yielded (in that order)
23
24
  # arity of 3: the destination pixel color is yielded along with the x and y coords of the current pixel
@@ -52,7 +53,7 @@ class W < Gosu::Window
52
53
  }
53
54
 
54
55
  # this just fills a rect with random colours
55
- @img.rect 400, 400, 470, 470, :fill => true, :color_control => proc { |c| :rand }
56
+ @img.rect 400, 400, 470, 470, :fill => true, :color_control => proc { :rand }
56
57
  end
57
58
 
58
59
  def draw
@@ -6,7 +6,7 @@ require 'texplay'
6
6
 
7
7
  class W < Gosu::Window
8
8
  def initialize
9
- super(1024, 769, false, 20)
9
+ super(1024, 768, false, 20)
10
10
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
11
11
  end
12
12
 
@@ -14,9 +14,9 @@ class W < Gosu::Window
14
14
  x = (@img.width - 100/2) * rand
15
15
  y = (@img.height - 100/2) * rand
16
16
 
17
- @img.rect x, y, x + 50, y + 50, :fill => true, :color_control => { :mult => [0.9 , 0.3, 0.3, 1] }
17
+ @img.rect x, y, x + 50, y + 50, :fill => true,
18
+ :color_control => { :mult => [0.9 , 0.3, 0.3, 1] }
18
19
 
19
-
20
20
 
21
21
  @img.draw 100, 50,1
22
22
  end
@@ -6,7 +6,7 @@ require 'texplay'
6
6
 
7
7
  class W < Gosu::Window
8
8
  def initialize
9
- super(1024, 769, false, 20)
9
+ super(1024, 768, false, 20)
10
10
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
11
11
  @img.rect 0,0, @img.width - 1, @img.height - 1
12
12
 
@@ -6,7 +6,7 @@ require 'texplay'
6
6
 
7
7
  class W < Gosu::Window
8
8
  def initialize
9
- super(1024, 769, false, 20)
9
+ super(1024, 768, false, 20)
10
10
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
11
11
 
12
12
  # each can accept a block of two types of arity:
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
 
11
11
  # put a border on the image
@@ -6,16 +6,15 @@ require 'texplay'
6
6
  class W < Gosu::Window
7
7
  def initialize
8
8
  super(1024, 768, false, 20)
9
- @img = TexPlay::create_blank_image(self, 1000, 1000)
10
- # @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
11
- @tp = Gosu::Image.new(self, "#{Common::MEDIA}/maria.png")
9
+ @img = TexPlay::create_blank_image(self, 1022, 1022)
10
+ @tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
12
11
  @gosu = Gosu::Image.new(self, "#{Common::MEDIA}/sand1.png")
13
12
 
14
13
  points = []
15
14
 
16
15
  # NOTE: TexPlay also accepts points. a 'point' is any object that responds to 'x' or y
17
16
  # NOTE: current maximum points for a bezier is 13
18
- (0..@img.width + 90).step(85) { |x|
17
+ (0..@img.width + 90).step(185) { |x|
19
18
  p = TexPlay::TPPoint.new
20
19
  p.x = x
21
20
  p.y = @img.height * rand
@@ -25,19 +24,15 @@ class W < Gosu::Window
25
24
 
26
25
  @img.bezier points
27
26
 
28
-
29
27
  # NOTE: the :texture hash argument works on ALL drawing actions; not just fills
30
- @img.fill 300, 400, :color => :red, :texture => @gosu
31
- # @img.circle 300, 400, 40
28
+ @img.fill 300, 600, :texture => @gosu
32
29
 
33
30
  # let's demonstrate by drawing a circle using the gosu.png texture
34
31
  # NOTE: :texture even works on lines, boxes, polylines, beziers etc.
35
32
  @img.circle 400, 50, 40, :fill => true, :texture => @tp
36
-
37
33
  end
38
34
 
39
35
  def draw
40
-
41
36
  @img.draw 10, 10,1
42
37
  end
43
38
 
@@ -4,7 +4,7 @@ require 'texplay'
4
4
 
5
5
  class W < Gosu::Window
6
6
  def initialize
7
- super(1024, 769, false, 20)
7
+ super(1024, 768, false, 20)
8
8
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
9
9
  @tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
10
10
  @gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
10
10
  @img.rect 0,0, @img.width - 1, @img.height - 1
11
11
 
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
 
11
11
  @width = @img.width
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
  @tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
11
11
 
@@ -6,7 +6,7 @@ require 'texplay'
6
6
 
7
7
  class W < Gosu::Window
8
8
  def initialize
9
- super(1024, 769, false, 20)
9
+ super(1024, 768, false, 20)
10
10
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
11
11
  end
12
12
 
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
 
11
11
  # put a border on the image
@@ -6,7 +6,7 @@ require 'texplay'
6
6
 
7
7
  class W < Gosu::Window
8
8
  def initialize
9
- super(1024, 769, false, 20)
9
+ super(1024, 768, false, 20)
10
10
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
11
11
  @gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
12
12
 
@@ -18,6 +18,9 @@ class W < Gosu::Window
18
18
  @img.circle 400, 100, 40, :fill => true, :color => [rand, rand, rand, 1]
19
19
  @img.rect 200, 300, 300, 400, :fill => true, :color => :red
20
20
 
21
+ @img.ngon 400,300,50, 5, :start_angle => 90
22
+ @img.ngon 300,300,50, 5, :start_angle => 45
23
+
21
24
  # NOTE: chroma_key means NOT to splice in that color (pixels with that color are skipped)
22
25
  # (chroma_key_not does the opposite, it skips pixels that do NOT have that color)
23
26
  @img.splice @gosu, 210, 330, :chroma_key => :alpha
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'common'
3
+ require 'texplay'
4
+
5
+
6
+ class W < Gosu::Window
7
+ def initialize
8
+ super(1024, 768, false, 20)
9
+ @img = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
10
+ @gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
11
+
12
+ @img.splice @gosu, 140,20,
13
+ :color_control => proc { |c1, c2, x, y|
14
+ factor = 1 - (y - 25) / @gosu.height.to_f
15
+ c2[0] *= factor
16
+ c2[1] *= factor
17
+ c2[2] *= factor
18
+ c2
19
+ }
20
+
21
+ @img.splice @gosu, 50,20, :chroma_key => :alpha
22
+ end
23
+
24
+ def draw
25
+ @img.draw 100, 50,1
26
+ end
27
+
28
+ end
29
+
30
+
31
+ w = W.new
32
+ w.show
33
+
@@ -5,7 +5,7 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
 
11
11
  # sets the 'global' color for all actions in this image
@@ -5,11 +5,11 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 769, false, 20)
8
+ super(1024, 768, false, 20)
9
9
  @img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
10
10
 
11
11
  # put a border on the image
12
- @img.rect 0,0, @img.width - 1, @img.height - 1
12
+ @img.rect 0, 0, @img.width - 1, @img.height - 1
13
13
 
14
14
  @length = 0
15
15
  end
data/lib/ctexplay.18.so CHANGED
Binary file
data/lib/ctexplay.19.so CHANGED
Binary file
@@ -6,26 +6,26 @@ end
6
6
  require 'texplay'
7
7
 
8
8
  # setup will be executed straight after Gosu::Image instantiation
9
- TexPlay.on_setup do
9
+ TexPlay::on_setup do
10
10
  @turtle_pos = TexPlay::TPPoint.new(width / 2, height / 2 )
11
11
  @turtle_angle = 0
12
12
  end
13
13
 
14
- TexPlay.create_macro(:move_to) do |x, y|
14
+ TexPlay::create_macro(:move_to) do |x, y|
15
15
  capture {
16
16
  @turtle_pos.x = x
17
17
  @turtle_pos.y = y
18
18
  }
19
19
  end
20
20
 
21
- TexPlay.create_macro(:move_rel) do |dx, dy|
21
+ TexPlay::create_macro(:move_rel) do |dx, dy|
22
22
  capture {
23
23
  @turtle_pos.x += dx
24
24
  @turtle_pos.y += dy
25
25
  }
26
26
  end
27
27
 
28
- TexPlay.create_macro(:line_to) do |x, y, *other|
28
+ TexPlay::create_macro(:line_to) do |x, y, *other|
29
29
  capture {
30
30
  line(@turtle_pos.x, @turtle_pos.y, x, y, *other)
31
31
 
@@ -33,7 +33,7 @@ TexPlay.create_macro(:line_to) do |x, y, *other|
33
33
  }
34
34
  end
35
35
 
36
- TexPlay.create_macro(:line_rel) do |dx, dy, *other|
36
+ TexPlay::create_macro(:line_rel) do |dx, dy, *other|
37
37
  capture {
38
38
  x = @turtle_pos.x + dx
39
39
  y = @turtle_pos.y + dy
@@ -44,19 +44,19 @@ TexPlay.create_macro(:line_rel) do |dx, dy, *other|
44
44
  }
45
45
  end
46
46
 
47
- TexPlay.create_macro(:turn_to) do |a|
47
+ TexPlay::create_macro(:turn_to) do |a|
48
48
  capture {
49
49
  @turtle_angle = a
50
50
  }
51
51
  end
52
52
 
53
- TexPlay.create_macro(:turn) do |da|
53
+ TexPlay::create_macro(:turn) do |da|
54
54
  capture {
55
55
  @turtle_angle += da
56
56
  }
57
57
  end
58
58
 
59
- TexPlay.create_macro(:forward) do |dist, *other|
59
+ TexPlay::create_macro(:forward) do |dist, *other|
60
60
  capture {
61
61
  visible = other.shift
62
62
 
data/lib/texplay.rb CHANGED
@@ -10,16 +10,16 @@ require 'rbconfig'
10
10
  require 'gosu'
11
11
 
12
12
  module TexPlay
13
- TEXPLAY_VERSION = "0.2.1"
13
+ TEXPLAY_VERSION = "0.2.2"
14
14
 
15
- def self.on_setup(&block)
15
+ def self::on_setup(&block)
16
16
  raise "need a block" if !block
17
17
 
18
18
  @__init_procs__ ||= []
19
19
  @__init_procs__.push(block)
20
20
  end
21
21
 
22
- def self.setup(receiver)
22
+ def self::setup(receiver)
23
23
  if @__init_procs__ then
24
24
  @__init_procs__.each do |init_proc|
25
25
  receiver.instance_eval(&init_proc)
@@ -27,7 +27,7 @@ module TexPlay
27
27
  end
28
28
  end
29
29
 
30
- def self.create_blank_image(window, width, height)
30
+ def self::create_blank_image(window, width, height)
31
31
  Gosu::Image.new(window, EmptyImageStub.new(width, height))
32
32
  end
33
33
 
@@ -37,7 +37,7 @@ module TexPlay
37
37
  Blue = [0, 0, 1, 1]
38
38
  Black = [0, 0, 0, 1]
39
39
  White = [1, 1, 1, 1]
40
- Grey = [0.5, 0.5, 0.5, 0.5]
40
+ Grey = [0.5, 0.5, 0.5, 1]
41
41
  Alpha = [0, 0, 0, 0]
42
42
  Purple = [1, 0, 1, 1]
43
43
  Yellow = [1, 1, 0, 1]
@@ -52,8 +52,8 @@ end
52
52
 
53
53
  # credit to philomory for this class
54
54
  class EmptyImageStub
55
- def initialize(w,h)
56
- @w, @h = w, h;
55
+ def initialize(w, h)
56
+ @w, @h = w, h
57
57
  end
58
58
 
59
59
  def to_blob