tea 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/README.rdoc +93 -0
- data/doc/example/bitmap_draw.rb +21 -0
- data/doc/example/bitmap_load.rb +14 -0
- data/doc/example/bitmap_new.rb +19 -0
- data/doc/example/circle.rb +24 -0
- data/doc/example/circle_alpha.rb +45 -0
- data/doc/example/circle_alpha_bitmap.rb +51 -0
- data/doc/example/circle_bitmap.rb +18 -0
- data/doc/example/clip.rb +46 -0
- data/doc/example/event_app.rb +45 -0
- data/doc/example/event_keyboard.rb +43 -0
- data/doc/example/event_mouse.rb +85 -0
- data/doc/example/font_hello.rb +22 -0
- data/doc/example/font_word_wrap.rb +44 -0
- data/doc/example/grab.rb +28 -0
- data/doc/example/init.rb +10 -0
- data/doc/example/lines.rb +49 -0
- data/doc/example/lines_aa.rb +44 -0
- data/doc/example/lines_alpha.rb +33 -0
- data/doc/example/point.rb +26 -0
- data/doc/example/rect.rb +15 -0
- data/doc/example/rect_alpha.rb +75 -0
- data/doc/example/screen_set_mode.rb +18 -0
- data/doc/example/screen_update.rb +14 -0
- data/doc/example/sfont_hello.rb +22 -0
- data/doc/example/smile.png +0 -0
- data/doc/example/smile_bounce.rb +44 -0
- data/doc/example/smile_move.rb +58 -0
- data/doc/example/smile_move_2.rb +78 -0
- data/doc/example/sound.rb +101 -0
- data/doc/example/state_app.rb +33 -0
- data/doc/example/state_keyboard.rb +23 -0
- data/doc/example/state_mouse.rb +60 -0
- data/doc/key_constants.textile +129 -0
- data/doc/key_modifiers.textile +19 -0
- data/doc/reference.textile +421 -0
- data/lib/tea.rb +34 -0
- data/lib/tea/c_bitmap.rb +122 -0
- data/lib/tea/c_error.rb +11 -0
- data/lib/tea/c_font.rb +302 -0
- data/lib/tea/c_sound.rb +144 -0
- data/lib/tea/m_color.rb +50 -0
- data/lib/tea/m_event.rb +65 -0
- data/lib/tea/m_event_app.rb +96 -0
- data/lib/tea/m_event_dispatch.rb +54 -0
- data/lib/tea/m_event_keyboard.rb +311 -0
- data/lib/tea/m_event_mouse.rb +189 -0
- data/lib/tea/mix_blitting.rb +31 -0
- data/lib/tea/mix_clipping.rb +71 -0
- data/lib/tea/mix_grabbing.rb +86 -0
- data/lib/tea/mix_image_saving.rb +70 -0
- data/lib/tea/mix_primitive.rb +613 -0
- data/lib/tea/o_screen.rb +98 -0
- metadata +137 -0
data/COPYING.LESSER
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.rdoc
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
= Tea
|
2
|
+
|
3
|
+
<i>For simpler games from a simpler age.</i>
|
4
|
+
|
5
|
+
Tea is a simple 2D game development library for Ruby. It's designed with these
|
6
|
+
things in mind:
|
7
|
+
|
8
|
+
* 0 is better than 1, and 1 is better than 2.
|
9
|
+
* Simplicity beats speed.
|
10
|
+
* Value and convenience can sometimes beat simplicity.
|
11
|
+
* Procedural beats object-oriented in a dead-heat.
|
12
|
+
|
13
|
+
The aim of Tea is to bring back some of the grass roots game development that
|
14
|
+
things like QBASIC fostered. By staying unobtrusive and out of the way, Tea
|
15
|
+
lets you focus on your game or demo, and not the pointy bits that are part of
|
16
|
+
many game engines and APIs.
|
17
|
+
|
18
|
+
|
19
|
+
== Installing
|
20
|
+
|
21
|
+
First, get Ruby (http://www.ruby-lang.org) if you don't have it already. Ruby
|
22
|
+
1.9 or later is recommended.
|
23
|
+
|
24
|
+
Tea is available as a gem on Gemcutter, so add http://gemcutter.org to your
|
25
|
+
~/.gemrc and type
|
26
|
+
|
27
|
+
gem install tea
|
28
|
+
|
29
|
+
|
30
|
+
== Using Tea
|
31
|
+
|
32
|
+
First, require 'tea'. This allows you to start using the rest of the Tea API.
|
33
|
+
|
34
|
+
From there, you have access to all of Tea's modules, objects and methods.
|
35
|
+
Below is a simple bouncing circle demo.
|
36
|
+
|
37
|
+
require 'tea'
|
38
|
+
|
39
|
+
Tea.init
|
40
|
+
Tea::Screen.set_mode 640, 480
|
41
|
+
|
42
|
+
x, y = 320, 240
|
43
|
+
dx, dy = rand() * 4 - 2, rand() * 4 - 2
|
44
|
+
r = 20
|
45
|
+
|
46
|
+
loop do
|
47
|
+
if e = Tea::Event.get
|
48
|
+
break if e.class == Tea::App::Exit
|
49
|
+
end
|
50
|
+
|
51
|
+
x += dx
|
52
|
+
y += dy
|
53
|
+
dx = -dx if x - r < 0 || x + r >= Tea::Screen.w
|
54
|
+
dy = -dy if y - r < 0 || y + r >= Tea::Screen.h
|
55
|
+
|
56
|
+
Tea::Screen.clear
|
57
|
+
Tea::Screen.circle x, y, r, Tea::Color::MAGENTA
|
58
|
+
Tea::Screen.update
|
59
|
+
|
60
|
+
sleep 0.001
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
== Status
|
65
|
+
|
66
|
+
All done.
|
67
|
+
|
68
|
+
* Events/Input - done
|
69
|
+
* Graphics - done
|
70
|
+
* Sound - done
|
71
|
+
* Fonts - done
|
72
|
+
|
73
|
+
|
74
|
+
== More information
|
75
|
+
|
76
|
+
Project page:: http://github.com/tung/tea
|
77
|
+
Wiki:: http://wiki.github.com/tung/tea
|
78
|
+
|
79
|
+
|
80
|
+
== License
|
81
|
+
|
82
|
+
Tea is free software: you can redistribute it and/or modify it under the terms
|
83
|
+
of the GNU Lesser General Public License as published by the Free Software
|
84
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
85
|
+
version. Tea is distributed in the hope that it will be useful, but WITHOUT
|
86
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
87
|
+
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
88
|
+
details.
|
89
|
+
|
90
|
+
You should have received a copy of the GNU Lesser General Public License along
|
91
|
+
with Tea. If not, see (http://www.gnu.org/licenses).
|
92
|
+
|
93
|
+
Copyright (c) 2009 Tung Nguyen.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Test if an image can be loaded and drawn to the screen.
|
2
|
+
# Expected result is a 320x240 display with a smile in the middle for 2
|
3
|
+
# seconds.
|
4
|
+
|
5
|
+
require 'tea'
|
6
|
+
|
7
|
+
puts <<TEST
|
8
|
+
You should see a 320x240 window with a smile in the centre.
|
9
|
+
TEST
|
10
|
+
|
11
|
+
Tea.init
|
12
|
+
Tea::Screen.set_mode 320, 240
|
13
|
+
|
14
|
+
image = Tea::Bitmap.new('smile.png')
|
15
|
+
x = (Tea::Screen.w - image.w) / 2
|
16
|
+
y = (Tea::Screen.h - image.h) / 2
|
17
|
+
|
18
|
+
Tea::Screen.blit image, x, y
|
19
|
+
Tea::Screen.update
|
20
|
+
|
21
|
+
sleep 2
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Test if a bitmap can be loaded.
|
2
|
+
# Expected result
|
3
|
+
#
|
4
|
+
# image size is 32x32
|
5
|
+
|
6
|
+
require 'tea'
|
7
|
+
|
8
|
+
puts <<TEST
|
9
|
+
The following line should read "image size is 32x32"
|
10
|
+
TEST
|
11
|
+
|
12
|
+
Tea.init
|
13
|
+
image = Tea::Bitmap.new('smile.png')
|
14
|
+
puts "image size is #{image.w}x#{image.h}"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Test that Bitmaps can be created without an image file.
|
2
|
+
# Expected results are a red square inside a cyan square.
|
3
|
+
|
4
|
+
require 'tea'
|
5
|
+
|
6
|
+
puts <<TEST
|
7
|
+
You should see a red square in a cyan square for 2 seconds.
|
8
|
+
TEST
|
9
|
+
|
10
|
+
Tea.init
|
11
|
+
a = Tea::Bitmap.new(200, 200, Tea::Color::CYAN)
|
12
|
+
Tea::Screen.set_mode 400, 300
|
13
|
+
b = Tea::Bitmap.new(150, 150, Tea::Color::RED)
|
14
|
+
|
15
|
+
Tea::Screen.blit a, 100, 50
|
16
|
+
Tea::Screen.blit b, 125, 75
|
17
|
+
Tea::Screen.update
|
18
|
+
|
19
|
+
sleep 2
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Test circle drawing.
|
2
|
+
# Expected results are a large white circle behind 2 smaller green and red
|
3
|
+
# circles, in a 400x300 window for 3 seconds.
|
4
|
+
|
5
|
+
require 'tea'
|
6
|
+
|
7
|
+
puts <<TEST
|
8
|
+
You should see a 400x300 window for 3 seconds with:
|
9
|
+
|
10
|
+
* A large white circle
|
11
|
+
* A small green circle on the left, antialiased
|
12
|
+
* A small red circle on the right, outlined
|
13
|
+
TEST
|
14
|
+
|
15
|
+
Tea.init
|
16
|
+
Tea::Screen.set_mode 400, 300
|
17
|
+
|
18
|
+
Tea::Screen.circle 200, 150, 100, Tea::Color::WHITE
|
19
|
+
Tea::Screen.circle 100, 150, 50, Tea::Color::GREEN, :antialias => true
|
20
|
+
Tea::Screen.circle 300, 150, 50, Tea::Color::RED, :outline => true
|
21
|
+
|
22
|
+
Tea::Screen.update
|
23
|
+
|
24
|
+
sleep 3
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Test that alpha blending works for circles.
|
2
|
+
# Expected results: 8 green circles drawn over the edges of a white rectangle,
|
3
|
+
# varying in outline, anti-aliasing and blend/replace alpha mixing.
|
4
|
+
|
5
|
+
require 'tea'
|
6
|
+
|
7
|
+
puts <<TEST
|
8
|
+
You should see a white rectangle and circles along the edges:
|
9
|
+
|
10
|
+
--b --r -ab
|
11
|
+
|
12
|
+
-ar o-b
|
13
|
+
|
14
|
+
o-r oab oar
|
15
|
+
|
16
|
+
o-- = outline
|
17
|
+
-a- = antialias
|
18
|
+
--b/r = blend/replace
|
19
|
+
|
20
|
+
Press any key to exit.
|
21
|
+
TEST
|
22
|
+
|
23
|
+
Tea.init
|
24
|
+
Tea::Screen.set_mode 400, 300
|
25
|
+
|
26
|
+
Tea::Screen.rect 100, 75, 200, 150, Tea::Color::WHITE
|
27
|
+
|
28
|
+
translucent_green = Tea::Color.mix(0, 255, 0, 128)
|
29
|
+
Tea::Screen.circle 100, 75, 25, translucent_green, :outline => false, :antialias => false, :mix => :blend
|
30
|
+
Tea::Screen.circle 200, 75, 25, translucent_green, :outline => false, :antialias => false, :mix => :replace
|
31
|
+
Tea::Screen.circle 300, 75, 25, translucent_green, :outline => false, :antialias => true, :mix => :blend
|
32
|
+
|
33
|
+
Tea::Screen.circle 100, 150, 25, translucent_green, :outline => false, :antialias => true, :mix => :replace
|
34
|
+
Tea::Screen.circle 300, 150, 25, translucent_green, :outline => true, :antialias => false, :mix => :blend
|
35
|
+
|
36
|
+
Tea::Screen.circle 100, 225, 25, translucent_green, :outline => true, :antialias => false, :mix => :replace
|
37
|
+
Tea::Screen.circle 200, 225, 25, translucent_green, :outline => true, :antialias => true, :mix => :blend
|
38
|
+
Tea::Screen.circle 300, 225, 25, translucent_green, :outline => true, :antialias => true, :mix => :replace
|
39
|
+
|
40
|
+
Tea::Screen.update
|
41
|
+
|
42
|
+
loop do
|
43
|
+
e = Tea::Event.get(true)
|
44
|
+
break if e.class == Tea::App::Exit || e.class == Tea::Kbd::Down
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Test that alpha blending works for circles.
|
2
|
+
# Expected results: 8 green circles drawn over the edges of a white-bordered
|
3
|
+
# blue rectangle, varying in outline, anti-aliasing and blend/replace alpha
|
4
|
+
# mixing.
|
5
|
+
|
6
|
+
require 'tea'
|
7
|
+
|
8
|
+
puts <<TEST
|
9
|
+
You should see a white-bordered blue rectangle and circles along the edges:
|
10
|
+
|
11
|
+
--b --r -ab
|
12
|
+
|
13
|
+
-ar o-b
|
14
|
+
|
15
|
+
o-r oab oar
|
16
|
+
|
17
|
+
o-- = outline
|
18
|
+
-a- = antialias
|
19
|
+
--b/r = blend/replace
|
20
|
+
|
21
|
+
Press any key to exit.
|
22
|
+
TEST
|
23
|
+
|
24
|
+
Tea.init
|
25
|
+
Tea::Screen.set_mode 400, 300
|
26
|
+
|
27
|
+
Tea::Screen.rect 100, 75, 200, 150, Tea::Color::WHITE
|
28
|
+
|
29
|
+
b = Tea::Bitmap.new(Tea::Screen.w, Tea::Screen.h, Tea::Color.mix(0, 0, 0, 0))
|
30
|
+
b.rect 105, 80, 190, 140, Tea::Color.mix(0, 0, 255)
|
31
|
+
|
32
|
+
translucent_green = Tea::Color.mix(0, 255, 0, 128)
|
33
|
+
b.circle 100, 75, 25, translucent_green, :outline => false, :antialias => false, :mix => :blend
|
34
|
+
b.circle 200, 75, 25, translucent_green, :outline => false, :antialias => false, :mix => :replace
|
35
|
+
b.circle 300, 75, 25, translucent_green, :outline => false, :antialias => true, :mix => :blend
|
36
|
+
|
37
|
+
b.circle 100, 150, 25, translucent_green, :outline => false, :antialias => true, :mix => :replace
|
38
|
+
b.circle 300, 150, 25, translucent_green, :outline => true, :antialias => false, :mix => :blend
|
39
|
+
|
40
|
+
b.circle 100, 225, 25, translucent_green, :outline => true, :antialias => false, :mix => :replace
|
41
|
+
b.circle 200, 225, 25, translucent_green, :outline => true, :antialias => true, :mix => :blend
|
42
|
+
b.circle 300, 225, 25, translucent_green, :outline => true, :antialias => true, :mix => :replace
|
43
|
+
|
44
|
+
Tea::Screen.blit b, 0, 0
|
45
|
+
|
46
|
+
Tea::Screen.update
|
47
|
+
|
48
|
+
loop do
|
49
|
+
e = Tea::Event.get(true)
|
50
|
+
break if e.class == Tea::App::Exit || e.class == Tea::Kbd::Down
|
51
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Test that a circle drawn to a bitmap is drawn correctly.
|
2
|
+
# Expected result is a filled white circle.
|
3
|
+
|
4
|
+
require 'tea'
|
5
|
+
|
6
|
+
puts <<TEST
|
7
|
+
You should see a filled white circle for 5 seconds.
|
8
|
+
TEST
|
9
|
+
|
10
|
+
Tea.init
|
11
|
+
Tea::Screen.set_mode 320, 240
|
12
|
+
|
13
|
+
b = Tea::Bitmap.new(320, 240, Tea::Color.mix(0, 0, 0, 0))
|
14
|
+
b.circle 160, 120, 100, Tea::Color::WHITE, :mix => :replace
|
15
|
+
Tea::Screen.blit b, 0, 0
|
16
|
+
|
17
|
+
Tea::Screen.update
|
18
|
+
sleep 5
|