gosu 0.7.22 → 0.7.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Gosu/Audio.hpp +2 -0
  2. data/Gosu/Fwd.hpp +0 -1
  3. data/Gosu/Gosu.hpp +1 -1
  4. data/Gosu/Graphics.hpp +12 -11
  5. data/Gosu/GraphicsBase.hpp +5 -0
  6. data/Gosu/Image.hpp +0 -14
  7. data/Gosu/Input.hpp +32 -18
  8. data/Gosu/Text.hpp +3 -2
  9. data/Gosu/Version.hpp +2 -2
  10. data/Gosu/Window.hpp +21 -8
  11. data/GosuImpl/Audio/AudioOpenAL.mm +74 -8
  12. data/GosuImpl/Graphics/Common.hpp +25 -1
  13. data/GosuImpl/Graphics/DrawOp.hpp +54 -222
  14. data/GosuImpl/Graphics/DrawOpQueue.hpp +127 -0
  15. data/GosuImpl/Graphics/FormattedString.hpp +63 -20
  16. data/GosuImpl/Graphics/GosuView.hpp +5 -8
  17. data/GosuImpl/Graphics/GosuView.mm +36 -65
  18. data/GosuImpl/Graphics/Graphics.cpp +121 -110
  19. data/GosuImpl/Graphics/Image.cpp +0 -51
  20. data/GosuImpl/Graphics/Macro.hpp +1 -0
  21. data/GosuImpl/Graphics/RenderState.hpp +107 -0
  22. data/GosuImpl/Graphics/TexChunk.cpp +1 -10
  23. data/GosuImpl/Graphics/Text.cpp +22 -10
  24. data/GosuImpl/Graphics/TextMac.cpp +2 -4
  25. data/GosuImpl/Graphics/TextTouch.mm +14 -21
  26. data/GosuImpl/Graphics/TextWin.cpp +5 -2
  27. data/GosuImpl/Graphics/Texture.cpp +11 -10
  28. data/GosuImpl/Graphics/Transform.cpp +3 -1
  29. data/GosuImpl/Input/AccelerometerReader.hpp +10 -0
  30. data/GosuImpl/Input/AccelerometerReader.mm +31 -0
  31. data/GosuImpl/InputMac.mm +51 -24
  32. data/GosuImpl/InputTouch.mm +112 -1
  33. data/GosuImpl/InputWin.cpp +27 -3
  34. data/GosuImpl/InputX.cpp +21 -0
  35. data/GosuImpl/MacUtility.hpp +33 -0
  36. data/GosuImpl/Orientation.hpp +15 -0
  37. data/GosuImpl/Orientation.mm +34 -0
  38. data/GosuImpl/RubyGosu.swg +7 -9
  39. data/GosuImpl/RubyGosu_wrap.cxx +328 -82
  40. data/GosuImpl/RubyGosu_wrap.h +3 -0
  41. data/GosuImpl/TextInputWin.cpp +2 -0
  42. data/GosuImpl/Utility.cpp +2 -0
  43. data/GosuImpl/WindowMac.mm +13 -19
  44. data/GosuImpl/WindowTouch.mm +44 -32
  45. data/GosuImpl/WindowWin.cpp +20 -12
  46. data/GosuImpl/WindowX.cpp +33 -23
  47. data/examples/CptnRuby.rb +8 -9
  48. data/lib/gosu.rb +0 -0
  49. data/lib/gosu/swig_patches.rb +0 -12
  50. data/linux/extconf.rb +2 -2
  51. metadata +11 -7
  52. data/Gosu/RotFlip.hpp +0 -125
  53. data/GosuImpl/Graphics/RotFlip.cpp +0 -184
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 45
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 22
10
- version: 0.7.22
9
+ - 23
10
+ version: 0.7.23
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julian Raschke
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-06-17 00:00:00 +08:00
19
+ date: 2010-08-23 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -76,7 +76,6 @@ files:
76
76
  - Gosu/IO.hpp
77
77
  - Gosu/Math.hpp
78
78
  - Gosu/Platform.hpp
79
- - Gosu/RotFlip.hpp
80
79
  - Gosu/Sockets.hpp
81
80
  - Gosu/Text.hpp
82
81
  - Gosu/TextInput.hpp
@@ -110,6 +109,7 @@ files:
110
109
  - GosuImpl/Graphics/Color.cpp
111
110
  - GosuImpl/Graphics/Common.hpp
112
111
  - GosuImpl/Graphics/DrawOp.hpp
112
+ - GosuImpl/Graphics/DrawOpQueue.hpp
113
113
  - GosuImpl/Graphics/Font.cpp
114
114
  - GosuImpl/Graphics/FormattedString.hpp
115
115
  - GosuImpl/Graphics/GosuView.hpp
@@ -119,7 +119,7 @@ files:
119
119
  - GosuImpl/Graphics/LargeImageData.cpp
120
120
  - GosuImpl/Graphics/LargeImageData.hpp
121
121
  - GosuImpl/Graphics/Macro.hpp
122
- - GosuImpl/Graphics/RotFlip.cpp
122
+ - GosuImpl/Graphics/RenderState.hpp
123
123
  - GosuImpl/Graphics/TexChunk.cpp
124
124
  - GosuImpl/Graphics/TexChunk.hpp
125
125
  - GosuImpl/Graphics/Text.cpp
@@ -132,6 +132,8 @@ files:
132
132
  - GosuImpl/Graphics/TextWin.cpp
133
133
  - GosuImpl/Graphics/Transform.cpp
134
134
  - GosuImpl/Iconv.hpp
135
+ - GosuImpl/Input/AccelerometerReader.hpp
136
+ - GosuImpl/Input/AccelerometerReader.mm
135
137
  - GosuImpl/InputMac.mm
136
138
  - GosuImpl/InputTouch.mm
137
139
  - GosuImpl/InputWin.cpp
@@ -139,6 +141,8 @@ files:
139
141
  - GosuImpl/IO.cpp
140
142
  - GosuImpl/MacUtility.hpp
141
143
  - GosuImpl/Math.cpp
144
+ - GosuImpl/Orientation.hpp
145
+ - GosuImpl/Orientation.mm
142
146
  - GosuImpl/RubyGosu.swg
143
147
  - GosuImpl/RubyGosu_DllMain.cxx
144
148
  - GosuImpl/RubyGosu_SWIG_GC_PATCH.patch
@@ -166,7 +170,7 @@ files:
166
170
  - GosuImpl/X11vroot.h
167
171
  - linux/extconf.rb
168
172
  has_rdoc: true
169
- homepage: http://code.google.com/p/gosu/
173
+ homepage: http://libgosu.org/
170
174
  licenses: []
171
175
 
172
176
  post_install_message:
@@ -1,125 +0,0 @@
1
- //! \file RotFlip.hpp
2
- //! Interface of the RotFlip class.
3
-
4
- #ifndef GOSU_ROTFLIP_HPP
5
- #define GOSU_ROTFLIP_HPP
6
-
7
- namespace Gosu
8
- {
9
- //! Human-understandable descriptions of the variants of rotations and flips
10
- //! that can be constructed.
11
- enum RotFlipName
12
- {
13
- rfDefault,
14
- rfRotate90,
15
- rfRotate180,
16
- rfRotate270,
17
-
18
- rfFlipX,
19
- rfRotate90FlipX,
20
- rfRotate180FlipX,
21
- rfRotate270FlipX,
22
-
23
- rfFlipY = rfRotate180FlipX,
24
- rfRotate90FlipY = rfRotate270FlipX,
25
- rfRotate180FlipY = rfFlipX,
26
- rfRotate270FlipY = rfRotate90FlipX,
27
-
28
- rfFlipXRotate90 = rfRotate270FlipX,
29
- rfFlipXRotate180 = rfRotate180FlipX,
30
- rfFlipXRotate270 = rfRotate90FlipX,
31
-
32
- rfFlipYRotate90 = rfRotate90FlipX,
33
- rfFlipYRotate180 = rfFlipX,
34
- rfFlipYRotate270 = rfRotate270FlipX
35
- };
36
-
37
- //! Light-weight class that encodes a rotation by 0, 90, 180, or 270
38
- //! degrees as well as optional horizontal and/or vertical flips.
39
- //! In short, this convieniently encodes the eight ways in which a
40
- //! aligned rectangle can be linearly transformed to result in an aligned
41
- //! rectangle again.
42
- //! Especially useful for games with tile-based maps.
43
- class RotFlip
44
- {
45
- RotFlipName name_;
46
-
47
- typedef RotFlipName TransTable[8];
48
- static const TransTable flipXTable, flipYTable, rotate90Table,
49
- rotate180Table, rotate270Table;
50
-
51
- typedef unsigned CornerTable[8][4];
52
- static const CornerTable mapCornerTable, realCornerTable;
53
-
54
- public:
55
- RotFlip(RotFlipName name = rfDefault)
56
- : name_(name)
57
- {
58
- }
59
-
60
- RotFlipName name() const
61
- {
62
- return name_;
63
- }
64
-
65
- void flipX()
66
- {
67
- name_ = flipXTable[name_];
68
- }
69
-
70
- void flipY()
71
- {
72
- name_ = flipYTable[name_];
73
- }
74
-
75
- void rotate90()
76
- {
77
- name_ = rotate90Table[name_];
78
- }
79
-
80
- void rotate180()
81
- {
82
- name_ = rotate180Table[name_];
83
- }
84
-
85
- void rotate270()
86
- {
87
- name_ = rotate270Table[name_];
88
- }
89
-
90
- bool flipped() const
91
- {
92
- return name_ >= rfFlipX;
93
- }
94
-
95
- bool rotated() const
96
- {
97
- return name_ % 2 == 1;
98
- }
99
-
100
- unsigned mapCorner(unsigned n) const
101
- {
102
- return mapCornerTable[name_][n];
103
- }
104
-
105
- unsigned realCorner(unsigned n) const
106
- {
107
- return realCornerTable[name_][n];
108
- }
109
- };
110
-
111
- inline bool operator==(RotFlip a, RotFlip b)
112
- {
113
- return a.name() == b.name();
114
- }
115
-
116
- inline bool operator!=(RotFlip a, RotFlip b)
117
- {
118
- return a.name() != b.name();
119
- }
120
-
121
- //! Applies a RotFlip to a point x/y in a square of side length max.
122
- void applyToPoint(RotFlip rotFlip, int& x, int& y, int max);
123
- }
124
-
125
- #endif
@@ -1,184 +0,0 @@
1
- #include <Gosu/RotFlip.hpp>
2
- #include <algorithm>
3
-
4
- const Gosu::RotFlip::TransTable Gosu::RotFlip::flipXTable =
5
- {
6
- // rfDefault ->
7
- rfFlipX,
8
- // rfRotate90 ->
9
- rfRotate90FlipX,
10
- // rfRotate180 ->
11
- rfRotate180FlipX,
12
- // rfRotate270 ->
13
- rfRotate270FlipX,
14
- // rfFlipX ->
15
- rfDefault,
16
- // rfRotate90FlipX ->
17
- rfRotate90,
18
- // rfRotate180FlipX ->
19
- rfRotate180,
20
- // rfRotate270FlipX ->
21
- rfRotate270
22
- };
23
-
24
- const Gosu::RotFlip::TransTable Gosu::RotFlip::flipYTable =
25
- {
26
- // rfDefault ->
27
- rfFlipY,
28
- // rfRotate90 ->
29
- rfRotate90FlipY,
30
- // rfRotate180 ->
31
- rfRotate180FlipY,
32
- // rfRotate270 ->
33
- rfRotate270FlipY,
34
- // rfFlipX ->
35
- rfRotate180,
36
- // rfRotate90FlipX ->
37
- rfRotate270,
38
- // rfRotate180FlipX ->
39
- rfDefault,
40
- // rfRotate270FlipX ->
41
- rfRotate90
42
- };
43
-
44
- const Gosu::RotFlip::TransTable Gosu::RotFlip::rotate90Table =
45
- {
46
- // rfDefault ->
47
- rfRotate90,
48
- // rfRotate90 ->
49
- rfRotate180,
50
- // rfRotate180 ->
51
- rfRotate270,
52
- // rfRotate270 ->
53
- rfDefault,
54
- // rfFlipX ->
55
- rfFlipXRotate90,
56
- // rfRotate90FlipX ->
57
- rfFlipX,
58
- // rfRotate180FlipX ->
59
- rfFlipYRotate90,
60
- // rfRotate270FlipX ->
61
- rfFlipY
62
- };
63
-
64
- const Gosu::RotFlip::TransTable Gosu::RotFlip::rotate180Table =
65
- {
66
- // rfDefault ->
67
- rotate90Table[rotate90Table[rfDefault]],
68
- // rfRotate90 ->
69
- rotate90Table[rotate90Table[rfRotate90]],
70
- // rfRotate180 ->
71
- rotate90Table[rotate90Table[rfRotate180]],
72
- // rfRotate270 ->
73
- rotate90Table[rotate90Table[rfRotate270]],
74
- // rfFlipX ->
75
- rotate90Table[rotate90Table[rfFlipX]],
76
- // rfRotate90FlipX ->
77
- rotate90Table[rotate90Table[rfRotate90FlipX]],
78
- // rfRotate180FlipX ->
79
- rotate90Table[rotate90Table[rfRotate180FlipX]],
80
- // rfRotate270FlipX ->
81
- rotate90Table[rotate90Table[rfRotate270FlipX]],
82
- };
83
-
84
- const Gosu::RotFlip::TransTable Gosu::RotFlip::rotate270Table =
85
- {
86
- // rfDefault ->
87
- rotate90Table[rotate180Table[rfDefault]],
88
- // rfRotate90 ->
89
- rotate90Table[rotate180Table[rfRotate90]],
90
- // rfRotate180 ->
91
- rotate90Table[rotate180Table[rfRotate180]],
92
- // rfRotate270 ->
93
- rotate90Table[rotate180Table[rfRotate270]],
94
- // rfFlipX ->
95
- rotate90Table[rotate180Table[rfFlipX]],
96
- // rfRotate90FlipX ->
97
- rotate90Table[rotate180Table[rfRotate90FlipX]],
98
- // rfRotate180FlipX ->
99
- rotate90Table[rotate180Table[rfRotate180FlipX]],
100
- // rfRotate270FlipX ->
101
- rotate90Table[rotate180Table[rfRotate270FlipX]],
102
- };
103
-
104
- const Gosu::RotFlip::CornerTable Gosu::RotFlip::mapCornerTable =
105
- {
106
- // rfDefault ->
107
- { 0, 1, 2, 3 },
108
- // rfRotate90 ->
109
- { 1, 3, 0, 2 },
110
- // rfRotate180 ->
111
- { 3, 2, 1, 0 },
112
- // rfRotate270 ->
113
- { 2, 0, 3, 1 },
114
- // rfFlipX ->
115
- { 1, 0, 3, 2 },
116
- // rfRotate90FlipX ->
117
- { 0, 2, 1, 3 },
118
- // rfRotate180FlipX ->
119
- { 2, 3, 0, 1 },
120
- // rfRotate270FlipX ->
121
- { 3, 1, 2, 0 }
122
- };
123
-
124
- const Gosu::RotFlip::CornerTable Gosu::RotFlip::realCornerTable =
125
- {
126
- // rfDefault ->
127
- { 0, 1, 2, 3 },
128
- // rfRotate90 ->
129
- { 1, 3, 0, 2 },
130
- // rfRotate180 ->
131
- { 3, 2, 1, 0 },
132
- // rfRotate270 ->
133
- { 1, 3, 0, 2 },
134
- // rfFlipX ->
135
- { 1, 0, 3, 2 },
136
- // rfRotate90FlipX ->
137
- { 3, 1, 2, 0 },
138
- // rfRotate180FlipX ->
139
- { 2, 3, 0, 1 },
140
- // rfRotate270FlipX ->
141
- { 0, 2, 1, 3 }
142
- };
143
-
144
- void Gosu::applyToPoint(Gosu::RotFlip rotFlip, int& x, int& y, int max)
145
- {
146
- switch (rotFlip.name())
147
- {
148
- case rfDefault:
149
- return;
150
-
151
- case rfRotate90:
152
- std::swap(x, y);
153
- y = max - y;
154
- return;
155
-
156
- case rfRotate180:
157
- x = max - x;
158
- y = max - y;
159
- return;
160
-
161
- case rfRotate270:
162
- std::swap(x, y);
163
- x = max - x;
164
- return;
165
-
166
- case rfFlipX:
167
- x = max - x;
168
- return;
169
-
170
- case rfRotate90FlipX:
171
- std::swap(x, y);
172
- return;
173
-
174
- case rfRotate180FlipX: // == rfFlipY
175
- y = max - y;
176
- return;
177
-
178
- case rfRotate270FlipX:
179
- int temp = x;
180
- x = max - y;
181
- y = max - temp;
182
- return;
183
- }
184
- }