texplay 0.2.800-i386-mswin32 → 0.2.900-i386-mswin32
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/CHANGELOG +138 -119
- data/README.markdown +43 -41
- data/Rakefile +68 -68
- data/examples/common.rb +8 -8
- data/examples/example_alpha_blend.rb +31 -31
- data/examples/example_bezier.rb +42 -42
- data/examples/example_color_control.rb +69 -69
- data/examples/example_color_transform.rb +64 -67
- data/examples/example_color_transform_circle.rb +65 -0
- data/examples/example_dup.rb +75 -75
- data/examples/example_each.rb +42 -42
- data/examples/example_effect.rb +35 -35
- data/examples/example_fill.rb +44 -44
- data/examples/example_fill_old.rb +49 -49
- data/examples/example_fluent.rb +31 -31
- data/examples/example_gen_eval.rb +34 -34
- data/examples/example_hash_arguments.rb +47 -47
- data/examples/example_light.rb +77 -0
- data/examples/example_lsystem.rb +61 -61
- data/examples/example_melt.rb +27 -27
- data/examples/example_meyet.rb +64 -0
- data/examples/example_polyline.rb +43 -43
- data/examples/example_scale.rb +29 -29
- data/examples/example_simple.rb +48 -38
- data/examples/example_sync.rb +60 -60
- data/examples/example_trace.rb +1 -1
- data/examples/example_turtle.rb +40 -40
- data/examples/example_weird.rb +3 -1
- data/examples/media/Thumbs.db +0 -0
- data/lib/1.8/texplay.so +0 -0
- data/lib/1.9/texplay.so +0 -0
- data/lib/texplay/version.rb +1 -1
- data/lib/texplay-contrib.rb +171 -171
- data/lib/texplay.rb +162 -137
- metadata +9 -5
data/CHANGELOG
CHANGED
@@ -1,119 +1,138 @@
|
|
1
|
-
|
2
|
-
version 0.2.
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
* fixed
|
29
|
-
* added
|
30
|
-
*
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
* fixed
|
48
|
-
*
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
2
|
53
|
-
|
54
|
-
*
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
*
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
*
|
64
|
-
*
|
65
|
-
|
66
|
-
*
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
*
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
*
|
79
|
-
*
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
*
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
28/
|
88
|
-
version 0.1.
|
89
|
-
*
|
90
|
-
*
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
version 0.1.
|
108
|
-
*
|
109
|
-
|
110
|
-
20
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
version 0.1.
|
118
|
-
*
|
119
|
-
|
1
|
+
7/6/10
|
2
|
+
version 0.2.900
|
3
|
+
* added source_select, source_ignore, dest_select, dest_ignore
|
4
|
+
* :chroma_key now deprecated (by above functionality)
|
5
|
+
* using Gosu::MAX_TEXTURE_SIZE, hopefully fixes crashes on some linux
|
6
|
+
distros
|
7
|
+
* Gosu::Color objects now accepted (and optionally returned by get_pixel)
|
8
|
+
* Monkey patched Gosu::Image.from_text() for auto-caching
|
9
|
+
* bitwise drawing modes no longer affect alpha
|
10
|
+
* rows and columns methods added to Gosu::Image, allowed Gosu::Image to be
|
11
|
+
reopened by Gosu::Image.new (works with Gosu::Image#to_blob)
|
12
|
+
|
13
|
+
|
14
|
+
23/03/10
|
15
|
+
version 0.2.800
|
16
|
+
* added 28 drawing modes (using :mode option)
|
17
|
+
* added linear interpolation (:lerp)
|
18
|
+
* added 'trace' option to line for efficient pixel-based collision detection
|
19
|
+
|
20
|
+
12/03/10
|
21
|
+
version 0.2.721
|
22
|
+
* fixed bug in alpha_blend (now blends alpha channels too)
|
23
|
+
|
24
|
+
6/12/09
|
25
|
+
version 0.2.710
|
26
|
+
* fixed bug in line drawing code (wasn't drawing final pixel)
|
27
|
+
* fixed bug in filled rect code (wasn't drawing final row)
|
28
|
+
* fixed bug in flood fill (wasn't drawing on first column)
|
29
|
+
* added glDisable(GL_TEXTURE_2D) calls to cache.c, and removed 'restore previous texture binding' (i doubt there is any previous binding to restore)
|
30
|
+
* using version.rb to help manage versions
|
31
|
+
|
32
|
+
23/11/09
|
33
|
+
* fixed bug in texplay.rb. Replaced TexPlay::TP_MAX_QUAD_SIZE - 2 with
|
34
|
+
just TexPlay::TP_MAX_QUAD_SIZE (the -2 is now built into the constant)
|
35
|
+
|
36
|
+
16/10/09
|
37
|
+
version 0.2.700
|
38
|
+
* removed memory leak from Gosu::Image#to_blob, now writing directly to RSTRING_PTR
|
39
|
+
|
40
|
+
12/10/09
|
41
|
+
version 0.2.666
|
42
|
+
* added Gosu::Image#to_blob
|
43
|
+
* to_blob functionality enables Gosu::Images to work with DevIL library
|
44
|
+
|
45
|
+
6/10/09
|
46
|
+
version 0.2.5
|
47
|
+
* fixed quad_draw flicker bug
|
48
|
+
* added splice_and_scale (to texplay-contrib.rb)
|
49
|
+
* now using rake-compiler to run build process
|
50
|
+
|
51
|
+
15/9/09
|
52
|
+
version 0.2.4
|
53
|
+
* added lsystem
|
54
|
+
* made lsystem both 1.9.1 and 1.8.6 compatible
|
55
|
+
|
56
|
+
11/9/09
|
57
|
+
version 0.2.3
|
58
|
+
* added Ruby 1.8.7 compatibility by modifying extconf.rb to define RUBY_19 macro
|
59
|
+
* and modified compat.h to get rid of feature test (fails on 1.8.7)
|
60
|
+
|
61
|
+
8/9/09
|
62
|
+
version 0.2.2
|
63
|
+
* fixed color_control bug, action_struct->color was being overwritten (now using a temp).
|
64
|
+
* fixed faulty error msg where max tex size was being displayed as 1024 but is actually 1022
|
65
|
+
* added :start_angle parameter to ngon action
|
66
|
+
* fixed example screen height from 769 to 768
|
67
|
+
* arity of -1 and 0 now supported for color_control procs
|
68
|
+
* fixed parameter checks for circle and ngon
|
69
|
+
* updated documentation to reflect changes, and added details on caching
|
70
|
+
|
71
|
+
2/9/09
|
72
|
+
version 0.2.1
|
73
|
+
* releasing a gem for TexPlay
|
74
|
+
* bumped version number so can add add gosu 0.7.14 dependency to github gem
|
75
|
+
* hopefully gem works on both github and rubyforge
|
76
|
+
31/8/09
|
77
|
+
version 0.2.0
|
78
|
+
* added each iterator
|
79
|
+
* added alternative to proc for :color_control proc (allowing static linear transforms to pixels)
|
80
|
+
* no longer segfaulting on windows (no idea why not)
|
81
|
+
* rewrote EmptyImageStub in ruby, using philomory's code. now alot faster.
|
82
|
+
* implemented 'shadow' in terms of static :color_control pixel transform
|
83
|
+
* added more example code demonstrating each iterator (example_each.rb) and new color_control behaviour
|
84
|
+
i.e example_color_transform.rb
|
85
|
+
* should be relatively stable now!
|
86
|
+
|
87
|
+
28/8/09
|
88
|
+
version 0.1.9.1 (still BETA)
|
89
|
+
* experimental features: Gosu::Image#dup and Gosu::Image#clone
|
90
|
+
* also TexPlay::create_blank_image(window, width, height)
|
91
|
+
* I noticed these features SEG FAULT on my setup in windows, so be warned
|
92
|
+
* This is a BETA release
|
93
|
+
|
94
|
+
14/8/09
|
95
|
+
version 0.1.9.0 (BETA)
|
96
|
+
* major rewrite. TP now supports beziers, polylines, polygons, and more
|
97
|
+
* also supports alpha_blending (though still tempermental)
|
98
|
+
* This is a BETA release
|
99
|
+
|
100
|
+
1/7/09
|
101
|
+
version 0.1.6.2
|
102
|
+
* fixed another subtle bug in constrain_local_boundaries(). Function was
|
103
|
+
unable to deal with drawing actions that were 100% outside the image
|
104
|
+
boundaries.
|
105
|
+
|
106
|
+
28/6/09
|
107
|
+
version 0.1.6
|
108
|
+
* gen_eval now working as a replacement for instance_eval in the #paint block. Allows for more user-friendly interface.
|
109
|
+
* #paint can now be called without a block; if invoked this way it executes any commands in the action queue, e.g
|
110
|
+
@img.circle 20, 20, 40
|
111
|
+
@img.pixel 30, 30
|
112
|
+
@img.paint
|
113
|
+
* above will function as if: @img.paint { circle 20, 20, 40; pixel 30, 30 }
|
114
|
+
* collected 1.8.6/1.9.1 compatibility into compat.h
|
115
|
+
|
116
|
+
16/6/09
|
117
|
+
version 0.1.4.6
|
118
|
+
* allowed arity of 0 (as well as -1) for ruby 1.9 compatibility
|
119
|
+
|
120
|
+
13/6/09
|
121
|
+
version 0.1.4.5
|
122
|
+
* major bugfix with TexPlay#splice method (segfaut). Also added new color format parameter: color [1, 1, 0, 1] (e.g purple with full alpha).
|
123
|
+
Also fixed subtle edge-case bug in constrain_local_boundaries().
|
124
|
+
|
125
|
+
9/6/09
|
126
|
+
version 0.1.4
|
127
|
+
* improved error checking. should work better with later gosu releases
|
128
|
+
|
129
|
+
20/2/09
|
130
|
+
version 0.1.1
|
131
|
+
* rerelease of this version fixing the oversized image bug for refresh_cache (i.e images over 500 x 500
|
132
|
+
|
133
|
+
version 0.1.1
|
134
|
+
* oops, bug in leftshift/rightshift functions, fixed!
|
135
|
+
|
136
|
+
version 0.1.0
|
137
|
+
* release!
|
138
|
+
|
data/README.markdown
CHANGED
@@ -1,41 +1,43 @@
|
|
1
|
-

|
2
|
-
|
3
|
-
*an image manipulation tool for ruby and gosu*
|
4
|
-
|
5
|
-
INSTRUCTIONS
|
6
|
-
============
|
7
|
-
|
8
|
-
**TexPlay version 0.2.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
+
|
19
|
-
+
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
+
|
35
|
-
+
|
36
|
-
|
37
|
-
+
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
1
|
+

|
2
|
+
|
3
|
+
*an image manipulation tool for ruby and gosu*
|
4
|
+
|
5
|
+
INSTRUCTIONS
|
6
|
+
============
|
7
|
+
|
8
|
+
**TexPlay version 0.2.900**
|
9
|
+
|
10
|
+
[Read The Documentation](http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/)
|
11
|
+
|
12
|
+
Gem installation:
|
13
|
+
|
14
|
+
+ sudo gem install texplay
|
15
|
+
|
16
|
+
How to build the gems? (maintainers only)
|
17
|
+
|
18
|
+
+ Install rake-compiler (http://github.com/luislavena/rake-compiler)
|
19
|
+
+ Install 1.9.1 and 1.8.6 mingw ruby versions (instructions above)
|
20
|
+
+ Type: rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1
|
21
|
+
+ Upload new gems to rubyforge and gemcutter.
|
22
|
+
|
23
|
+
How to build from source?
|
24
|
+
+ rake compile
|
25
|
+
|
26
|
+
OR
|
27
|
+
|
28
|
+
+ rake19 compile (assuming this is the name of your 1.9.1 version of rake)
|
29
|
+
|
30
|
+
**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!
|
31
|
+
|
32
|
+
If all goes well, run the example programs:
|
33
|
+
|
34
|
+
+ cd examples
|
35
|
+
+ ruby example_melt.rb
|
36
|
+
+ ruby example_simple.rb
|
37
|
+
+ ..etc
|
38
|
+
|
39
|
+
+ like any gosu application, gosu.so must be in the current directory (or the gosu gem installed) when running the examples.
|
40
|
+
|
41
|
+
|
42
|
+
---
|
43
|
+
Enjoy!
|
data/Rakefile
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/gempackagetask'
|
4
|
-
require 'rake/extensiontask'
|
5
|
-
|
6
|
-
# get the texplay version
|
7
|
-
require 'lib/texplay/version'
|
8
|
-
|
9
|
-
$dlext = Config::CONFIG['DLEXT']
|
10
|
-
|
11
|
-
CLEAN.include("ext/**/*.#{$dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
|
12
|
-
CLOBBER.include("**/*.#{$dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
|
13
|
-
|
14
|
-
specification = Gem::Specification.new do |s|
|
15
|
-
s.name = "texplay"
|
16
|
-
s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
|
17
|
-
s.version = TexPlay::VERSION
|
18
|
-
s.date = Time.now.strftime '%Y-%m-%d'
|
19
|
-
s.author = "John Mair (banisterfiend)"
|
20
|
-
s.email = 'jrmair@gmail.com'
|
21
|
-
s.description = s.summary
|
22
|
-
s.require_path = 'lib'
|
23
|
-
s.add_dependency("gosu",">=0.7.
|
24
|
-
s.platform = Gem::Platform::RUBY
|
25
|
-
s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
|
26
|
-
s.has_rdoc = false
|
27
|
-
|
28
|
-
s.extensions = ["ext/texplay/extconf.rb"]
|
29
|
-
s.files = ["Rakefile", "README.markdown", "CHANGELOG",
|
30
|
-
"lib/texplay.rb", "lib/texplay-contrib.rb", "lib/texplay/version.rb"] +
|
31
|
-
FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "examples/*.rb", "examples/media/*"].to_a
|
32
|
-
end
|
33
|
-
|
34
|
-
Rake::ExtensionTask.new('texplay', specification) do |ext|
|
35
|
-
# ext.config_script = 'extconf.rb'
|
36
|
-
# ext.cross_compile = true
|
37
|
-
#ext.cross_platform = 'i386-mswin32'
|
38
|
-
# ext.platform = 'i386-mswin32'
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
#comment this when want to build normal gems.
|
43
|
-
#only have this code uncommented when building mswin32 and mingw32
|
44
|
-
#binary gems
|
45
|
-
specification = Gem::Specification.new do |s|
|
46
|
-
s.name = "texplay"
|
47
|
-
s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
|
48
|
-
s.version = TexPlay::VERSION
|
49
|
-
s.date = Time.now.strftime '%Y-%m-%d'
|
50
|
-
s.author = "John Mair (banisterfiend)"
|
51
|
-
s.email = 'jrmair@gmail.com'
|
52
|
-
s.description = s.summary
|
53
|
-
s.require_path = 'lib'
|
54
|
-
s.add_dependency("gosu",">=0.7.
|
55
|
-
s.platform = 'i386-mswin32'
|
56
|
-
s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
|
57
|
-
s.has_rdoc = false
|
58
|
-
|
59
|
-
s.files = ["Rakefile", "README.markdown", "CHANGELOG",
|
60
|
-
"lib/texplay.rb", "lib/texplay-contrib.rb", "lib/texplay/version.rb", "lib/1.8/texplay.so",
|
61
|
-
"lib/1.9/texplay.so"] +
|
62
|
-
FileList["examples/*.rb", "examples/media/*"].to_a
|
63
|
-
|
64
|
-
|
65
|
-
Rake::GemPackageTask.new(specification) do |package|
|
66
|
-
package.need_zip = false
|
67
|
-
package.need_tar = false
|
68
|
-
end
|
1
|
+
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
require 'rake/extensiontask'
|
5
|
+
|
6
|
+
# get the texplay version
|
7
|
+
require 'lib/texplay/version'
|
8
|
+
|
9
|
+
$dlext = Config::CONFIG['DLEXT']
|
10
|
+
|
11
|
+
CLEAN.include("ext/**/*.#{$dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
|
12
|
+
CLOBBER.include("**/*.#{$dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
|
13
|
+
|
14
|
+
specification = Gem::Specification.new do |s|
|
15
|
+
s.name = "texplay"
|
16
|
+
s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
|
17
|
+
s.version = TexPlay::VERSION
|
18
|
+
s.date = Time.now.strftime '%Y-%m-%d'
|
19
|
+
s.author = "John Mair (banisterfiend)"
|
20
|
+
s.email = 'jrmair@gmail.com'
|
21
|
+
s.description = s.summary
|
22
|
+
s.require_path = 'lib'
|
23
|
+
s.add_dependency("gosu",">=0.7.20")
|
24
|
+
s.platform = Gem::Platform::RUBY
|
25
|
+
s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
|
26
|
+
s.has_rdoc = false
|
27
|
+
|
28
|
+
s.extensions = ["ext/texplay/extconf.rb"]
|
29
|
+
s.files = ["Rakefile", "README.markdown", "CHANGELOG",
|
30
|
+
"lib/texplay.rb", "lib/texplay-contrib.rb", "lib/texplay/version.rb"] +
|
31
|
+
FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "examples/*.rb", "examples/media/*"].to_a
|
32
|
+
end
|
33
|
+
|
34
|
+
Rake::ExtensionTask.new('texplay', specification) do |ext|
|
35
|
+
# ext.config_script = 'extconf.rb'
|
36
|
+
# ext.cross_compile = true
|
37
|
+
#ext.cross_platform = 'i386-mswin32'
|
38
|
+
# ext.platform = 'i386-mswin32'
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
#comment this when want to build normal gems.
|
43
|
+
#only have this code uncommented when building mswin32 and mingw32
|
44
|
+
#binary gems
|
45
|
+
specification = Gem::Specification.new do |s|
|
46
|
+
s.name = "texplay"
|
47
|
+
s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
|
48
|
+
s.version = TexPlay::VERSION
|
49
|
+
s.date = Time.now.strftime '%Y-%m-%d'
|
50
|
+
s.author = "John Mair (banisterfiend)"
|
51
|
+
s.email = 'jrmair@gmail.com'
|
52
|
+
s.description = s.summary
|
53
|
+
s.require_path = 'lib'
|
54
|
+
s.add_dependency("gosu",">=0.7.20")
|
55
|
+
s.platform = 'i386-mswin32'
|
56
|
+
s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
|
57
|
+
s.has_rdoc = false
|
58
|
+
|
59
|
+
s.files = ["Rakefile", "README.markdown", "CHANGELOG",
|
60
|
+
"lib/texplay.rb", "lib/texplay-contrib.rb", "lib/texplay/version.rb", "lib/1.8/texplay.so",
|
61
|
+
"lib/1.9/texplay.so"] +
|
62
|
+
FileList["examples/*.rb", "examples/media/*"].to_a
|
63
|
+
end
|
64
|
+
|
65
|
+
Rake::GemPackageTask.new(specification) do |package|
|
66
|
+
package.need_zip = false
|
67
|
+
package.need_tar = false
|
68
|
+
end
|
data/examples/common.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
$LOAD_PATH.push(File.dirname(__FILE__) + '/../lib/')
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'texplay'
|
5
|
-
|
6
|
-
module Common
|
7
|
-
MEDIA = File.dirname(__FILE__) + '/media'
|
8
|
-
end
|
1
|
+
$LOAD_PATH.push(File.dirname(__FILE__) + '/../lib/')
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'texplay'
|
5
|
+
|
6
|
+
module Common
|
7
|
+
MEDIA = File.dirname(__FILE__) + '/media'
|
8
|
+
end
|
@@ -1,31 +1,31 @@
|
|
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}/empty2.png")
|
10
|
-
@tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
|
11
|
-
|
12
|
-
# put a border on the image
|
13
|
-
@img.rect 0,0, @img.width - 1, @img.height - 1
|
14
|
-
|
15
|
-
@img.rect 1, 1, @img.width - 2, @img.height - 2, :fill => true, :texture => @tp
|
16
|
-
|
17
|
-
# NOTE: the current implementation of alpha blending is a bit tempermental, i need to think it
|
18
|
-
# through a bit more...
|
19
|
-
@img.rect 100, 100, 300, 300, :color => [1, 1, 1, 0.8], :alpha_blend => true, :fill => true
|
20
|
-
end
|
21
|
-
|
22
|
-
def draw
|
23
|
-
@img.draw 100, 50,1
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
w = W.new
|
30
|
-
w.show
|
31
|
-
|
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}/empty2.png")
|
10
|
+
@tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
|
11
|
+
|
12
|
+
# put a border on the image
|
13
|
+
@img.rect 0,0, @img.width - 1, @img.height - 1
|
14
|
+
|
15
|
+
@img.rect 1, 1, @img.width - 2, @img.height - 2, :fill => true, :texture => @tp
|
16
|
+
|
17
|
+
# NOTE: the current implementation of alpha blending is a bit tempermental, i need to think it
|
18
|
+
# through a bit more...
|
19
|
+
@img.rect 100, 100, 300, 300, :color => [1, 1, 1, 0.8], :alpha_blend => true, :fill => true
|
20
|
+
end
|
21
|
+
|
22
|
+
def draw
|
23
|
+
@img.draw 100, 50,1
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
w = W.new
|
30
|
+
w.show
|
31
|
+
|
data/examples/example_bezier.rb
CHANGED
@@ -1,42 +1,42 @@
|
|
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 = TexPlay::create_blank_image(self, 500, 500)
|
10
|
-
|
11
|
-
# put a border on the image
|
12
|
-
@img.rect 0,0, @img.width - 1, @img.height - 1
|
13
|
-
|
14
|
-
points = []
|
15
|
-
|
16
|
-
# NOTE: TexPlay also accepts points. a 'point' is any object that responds to 'x' or 'y'
|
17
|
-
# NOTE: current maximum points for a bezier is 13
|
18
|
-
(0..@img.width + 100).step(40) { |x|
|
19
|
-
p = TexPlay::TPPoint.new
|
20
|
-
p.x = x
|
21
|
-
p.y = @img.height * rand
|
22
|
-
|
23
|
-
points << p
|
24
|
-
}
|
25
|
-
|
26
|
-
# making the bezier
|
27
|
-
@img.bezier points, :color => :red
|
28
|
-
|
29
|
-
# NOTE: can 'close' a bezier curve too (as with polylines)
|
30
|
-
end
|
31
|
-
|
32
|
-
def draw
|
33
|
-
|
34
|
-
@img.draw 100, 50,1
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
w = W.new
|
41
|
-
w.show
|
42
|
-
|
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 = TexPlay::create_blank_image(self, 500, 500)
|
10
|
+
|
11
|
+
# put a border on the image
|
12
|
+
@img.rect 0,0, @img.width - 1, @img.height - 1
|
13
|
+
|
14
|
+
points = []
|
15
|
+
|
16
|
+
# NOTE: TexPlay also accepts points. a 'point' is any object that responds to 'x' or 'y'
|
17
|
+
# NOTE: current maximum points for a bezier is 13
|
18
|
+
(0..@img.width + 100).step(40) { |x|
|
19
|
+
p = TexPlay::TPPoint.new
|
20
|
+
p.x = x
|
21
|
+
p.y = @img.height * rand
|
22
|
+
|
23
|
+
points << p
|
24
|
+
}
|
25
|
+
|
26
|
+
# making the bezier
|
27
|
+
@img.bezier points, :color => :red
|
28
|
+
|
29
|
+
# NOTE: can 'close' a bezier curve too (as with polylines)
|
30
|
+
end
|
31
|
+
|
32
|
+
def draw
|
33
|
+
|
34
|
+
@img.draw 100, 50,1
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
w = W.new
|
41
|
+
w.show
|
42
|
+
|