texplay 0.2.983pre2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Rakefile +48 -56
  2. data/examples/common.rb +13 -2
  3. data/examples/example_alpha_blend.rb +1 -3
  4. data/examples/example_bezier.rb +1 -2
  5. data/examples/example_blank.rb +1 -3
  6. data/examples/example_cache.rb +1 -3
  7. data/examples/example_color_transform.rb +1 -3
  8. data/examples/example_color_transform_circle.rb +1 -3
  9. data/examples/example_darken.rb +1 -4
  10. data/examples/example_dup.rb +1 -4
  11. data/examples/example_each.rb +1 -4
  12. data/examples/example_effect.rb +1 -2
  13. data/examples/example_fill.rb +1 -2
  14. data/examples/example_fill_old.rb +1 -2
  15. data/examples/example_fluent.rb +1 -3
  16. data/examples/example_font.rb +1 -3
  17. data/examples/example_gen_eval.rb +1 -2
  18. data/examples/example_hash_arguments.rb +1 -2
  19. data/examples/example_ippa.rb +1 -3
  20. data/examples/example_light.rb +1 -3
  21. data/examples/example_light_multiply.rb +1 -3
  22. data/examples/example_lsystem.rb +1 -1
  23. data/examples/example_melt.rb +1 -3
  24. data/examples/example_meyet.rb +1 -3
  25. data/examples/example_polyline.rb +1 -2
  26. data/examples/example_scale.rb +1 -3
  27. data/examples/example_select.rb +1 -3
  28. data/examples/example_select2.rb +1 -4
  29. data/examples/example_simple.rb +1 -3
  30. data/examples/example_splice.rb +2 -4
  31. data/examples/example_sync.rb +1 -2
  32. data/examples/example_tiles.rb +1 -3
  33. data/examples/example_trace.rb +1 -2
  34. data/examples/example_transparent.rb +1 -3
  35. data/examples/example_transparent2.rb +1 -3
  36. data/examples/example_transparent3.rb +1 -3
  37. data/examples/example_turtle.rb +1 -2
  38. data/examples/example_weird.rb +1 -2
  39. data/examples/example_window_render_to_image.rb +41 -0
  40. data/examples/example_window_to_blob.rb +2 -5
  41. data/ext/texplay/utils.c +0 -5
  42. data/lib/texplay.rb +271 -165
  43. data/lib/texplay/c_function_docs.rb +189 -0
  44. data/lib/texplay/version.rb +1 -1
  45. metadata +13 -19
  46. data/examples/example_window_to_texture.rb +0 -55
  47. data/lib/texplay/patches.rb +0 -4
data/Rakefile CHANGED
@@ -5,73 +5,65 @@ require 'rake/gempackagetask'
5
5
  #require 'rake/extensiontask'
6
6
 
7
7
  # get the texplay version
8
- require 'lib/texplay/version'
8
+ require './lib/texplay/version'
9
9
 
10
- $dlext = Config::CONFIG['DLEXT']
10
+ dlext = Config::CONFIG['DLEXT']
11
11
 
12
- CLEAN.include("ext/**/*.#{$dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
13
- CLOBBER.include("**/*.#{$dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
12
+ CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
13
+ CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
14
14
 
15
- specification = Gem::Specification.new do |s|
16
- s.name = "texplay"
17
- s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
18
- s.version = TexPlay::VERSION
19
- s.date = Time.now.strftime '%Y-%m-%d'
20
- s.author = "John Mair (banisterfiend)"
21
- s.email = 'jrmair@gmail.com'
22
- s.description = s.summary
23
- s.require_path = 'lib'
24
- s.add_dependency("gosu",">=0.7.20")
25
- s.platform = Gem::Platform::RUBY
26
- s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
27
- s.has_rdoc = false
28
-
29
- s.extensions = ["ext/texplay/extconf.rb"]
30
- s.files = ["Rakefile", "README.markdown", "CHANGELOG",
31
- "lib/texplay.rb", "lib/texplay-contrib.rb", "lib/texplay/version.rb", "lib/texplay/patches.rb"] +
32
- FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "examples/*.rb", "examples/media/*", "spec/*.rb"].to_a
15
+ def apply_spec_defaults(s)
16
+ s.name = "texplay"
17
+ s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
18
+ s.version = TexPlay::VERSION
19
+ s.date = Time.now.strftime '%Y-%m-%d'
20
+ s.author = "John Mair (banisterfiend)"
21
+ s.email = 'jrmair@gmail.com'
22
+ s.description = s.summary
23
+ s.require_path = 'lib'
24
+ s.add_dependency("gosu",">=0.7.20")
25
+ s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
26
+ s.has_rdoc = 'yard'
27
+ s.files = FileList["Rakefile", "README.markdown", "CHANGELOG",
28
+ "lib/**/*.rb", "ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c",
29
+ "examples/*.rb", "examples/media/*", "spec/*.rb"].to_a
33
30
  end
34
31
 
35
- # Rake::ExtensionTask.new('texplay', specification) do |ext|
36
- # ext.config_script = 'extconf.rb'
37
- # ext.cross_compile = true
38
- # ext.cross_platform = 'i386-mswin32'
39
- # ext.platform = 'i386-mswin32'
40
- # end
41
32
 
33
+ [:mingw32, :mswin32].each do |v|
34
+ namespace v do
35
+ spec = Gem::Specification.new do |s|
36
+ apply_spec_defaults(s)
37
+ s.platform = "i386-#{v}"
38
+ s.files += FileList["lib/**/*.#{dlext}"].to_a
39
+ end
42
40
 
43
- #comment this when want to build normal gems.
44
- #only have this code uncommented when building mswin32 and mingw32
45
- #binary gems
46
- # specification = Gem::Specification.new do |s|
47
- # s.name = "texplay"
48
- # s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
49
- # s.version = TexPlay::VERSION
50
- # s.date = Time.now.strftime '%Y-%m-%d'
51
- # s.author = "John Mair (banisterfiend)"
52
- # s.email = 'jrmair@gmail.com'
53
- # s.description = s.summary
54
- # s.require_path = 'lib'
55
- # s.add_dependency("gosu",">=0.7.20")
56
- # s.platform = 'i386-mingw32'
57
- # s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
58
- # s.has_rdoc = false
41
+ Rake::GemPackageTask.new(spec) do |pkg|
42
+ pkg.need_zip = false
43
+ pkg.need_tar = false
44
+ end
45
+ end
46
+ end
59
47
 
60
- # s.files = ["Rakefile", "README.markdown", "CHANGELOG",
61
- # "lib/texplay.rb", "lib/texplay-contrib.rb",
62
- # "lib/texplay/version.rb",
63
- # "lib/texplay/patches.rb",
64
- # "lib/1.8/texplay.so",
65
- # "lib/1.9/texplay.so"] +
66
- # FileList["examples/*.rb", "examples/media/*", "spec/*.rb"].to_a
67
- # end
48
+ namespace :ruby do
49
+ spec = Gem::Specification.new do |s|
50
+ apply_spec_defaults(s)
51
+ s.platform = Gem::Platform::RUBY
52
+ s.extensions = ["ext/texplay/extconf.rb"]
53
+ end
68
54
 
69
- Rake::GemPackageTask.new(specification) do |package|
70
- package.need_zip = false
71
- package.need_tar = false
55
+ Rake::GemPackageTask.new(spec) do |pkg|
56
+ pkg.need_zip = false
57
+ pkg.need_tar = false
58
+ end
72
59
  end
73
-
60
+
74
61
  desc "Run rspec 2.0"
75
62
  task :rspec do
76
63
  system "rspec spec/**/*_spec.rb"
77
64
  end
65
+
66
+ desc "Create yard docs"
67
+ task :doc do
68
+ system "yard doc lib --output doc/yard --files doc/texplay_manual"
69
+ end
data/examples/common.rb CHANGED
@@ -1,7 +1,18 @@
1
- $LOAD_PATH.push(File.dirname(__FILE__) + '/../lib/')
1
+ EXAMPLES_DIR = File.dirname(File.expand_path(__FILE__))
2
2
 
3
+ # Ensure that the texplay loaded is the one in this repository, not any gem installed.
4
+ $LOAD_PATH.unshift File.expand_path(File.join(EXAMPLES_DIR, '..', 'lib'))
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError => ex
9
+ end
10
+
11
+ require 'gosu'
3
12
  require 'texplay'
4
13
 
5
14
  module Common
6
- MEDIA = File.dirname(__FILE__) + '/media'
15
+ MEDIA = File.join(EXAMPLES_DIR, 'media')
7
16
  end
17
+
18
+
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
-
5
3
 
6
4
  class W < Gosu::Window
7
5
  def initialize
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class W < Gosu::Window
7
5
  def initialize
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
  #require 'devil/gosu'
6
4
 
7
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class W < Gosu::Window
7
5
  def initialize
@@ -1,8 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
-
6
3
 
7
4
  class W < Gosu::Window
8
5
  def initialize
@@ -1,8 +1,5 @@
1
-
2
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
3
2
  require 'common'
4
- require 'gosu'
5
- require 'texplay'
6
3
 
7
4
 
8
5
  class W < Gosu::Window
@@ -1,8 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
-
6
3
 
7
4
  class W < Gosu::Window
8
5
  def initialize
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
  class W < Gosu::Window
6
5
  def initialize
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class W < Gosu::Window
7
5
  def initialize
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
 
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class Window < Gosu::Window
7
5
  def initialize
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class W < Gosu::Window
7
5
  def initialize
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class W < Gosu::Window
7
5
  def initialize
@@ -1,5 +1,5 @@
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
1
2
  require 'common'
2
- require 'gosu'
3
3
 
4
4
  Dragon = TexPlay::LSystem.new do
5
5
  rule "F" => "F"
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
 
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
  class W < Gosu::Window
@@ -1,8 +1,5 @@
1
-
2
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
3
2
  require 'common'
4
- require 'gosu'
5
- require 'texplay'
6
3
  require 'benchmark'
7
4
 
8
5
 
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
 
7
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
-
2
- require 'rubygems'
3
- require './common'
4
- require 'texplay'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
+ require 'common'
5
3
 
6
4
 
7
5
  class W < Gosu::Window
@@ -1,6 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'texplay'
4
3
 
5
4
 
6
5
  class W < Gosu::Window
@@ -1,7 +1,5 @@
1
- require 'rubygems'
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
2
2
  require 'common'
3
- require 'gosu'
4
- require 'texplay'
5
3
 
6
4
  class Gosu::Image
7
5
  # so we can use the old TexPlay to_blob -- appears to segfault?!