gosu 0.8.6-x86-mingw32 → 0.8.7-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Audio.hpp +171 -171
  3. data/Gosu/Bitmap.hpp +96 -96
  4. data/Gosu/Color.hpp +204 -204
  5. data/Gosu/Directories.hpp +36 -36
  6. data/Gosu/Font.hpp +83 -83
  7. data/Gosu/Gosu.hpp +34 -34
  8. data/Gosu/Graphics.hpp +115 -115
  9. data/Gosu/GraphicsBase.hpp +110 -110
  10. data/Gosu/IO.hpp +269 -269
  11. data/Gosu/Image.hpp +122 -122
  12. data/Gosu/ImageData.hpp +61 -61
  13. data/Gosu/Input.hpp +149 -149
  14. data/Gosu/Inspection.hpp +14 -14
  15. data/Gosu/Math.hpp +135 -135
  16. data/Gosu/Platform.hpp +93 -93
  17. data/Gosu/Sockets.hpp +156 -156
  18. data/Gosu/TR1.hpp +56 -56
  19. data/Gosu/Text.hpp +71 -71
  20. data/Gosu/TextInput.hpp +70 -70
  21. data/Gosu/Utility.hpp +28 -28
  22. data/Gosu/Version.hpp +19 -19
  23. data/Gosu/Window.hpp +145 -145
  24. data/examples/ChipmunkIntegration.rb +275 -275
  25. data/examples/CptnRuby.rb +223 -223
  26. data/examples/GosuZen.rb +68 -68
  27. data/examples/MoreChipmunkAndRMagick.rb +155 -155
  28. data/examples/OpenGLIntegration.rb +225 -225
  29. data/examples/RMagickIntegration.rb +417 -417
  30. data/examples/TextInput.rb +154 -154
  31. data/examples/Tutorial.rb +130 -130
  32. data/examples/media/Beep.wav +0 -0
  33. data/examples/media/CptnRuby Map.txt b/data/examples/media/CptnRuby → Map.txt +0 -0
  34. data/examples/media/Explosion.wav +0 -0
  35. data/examples/media/Landscape.svg +9 -9
  36. data/examples/media/Space.png +0 -0
  37. data/examples/media/Star.png +0 -0
  38. data/examples/media/Starfighter.bmp +0 -0
  39. data/lib/1.8/gosu.so +0 -0
  40. data/lib/1.9/gosu.so +0 -0
  41. data/lib/2.0/gosu.so +0 -0
  42. data/lib/2.1/gosu.so +0 -0
  43. data/lib/FreeImage.dll +0 -0
  44. data/lib/OpenAL32.dll +0 -0
  45. data/lib/gosu.rb +19 -16
  46. data/lib/gosu/patches.rb +81 -81
  47. data/lib/gosu/preview.rb +143 -139
  48. data/lib/gosu/run.rb +11 -11
  49. data/lib/gosu/swig_patches.rb +60 -60
  50. data/lib/gosu/zen.rb +89 -89
  51. metadata +5 -5
@@ -1,204 +1,204 @@
1
- //! \file Color.hpp
2
- //! Interface of the Color class.
3
-
4
- #ifndef GOSU_COLOR_HPP
5
- #define GOSU_COLOR_HPP
6
-
7
- #include <Gosu/Platform.hpp>
8
- #include <Gosu/TR1.hpp>
9
-
10
- namespace Gosu
11
- {
12
- //! Represents an RGBA color value with 8 bits for each channel. Can be
13
- //! implicitly constructed from literals of the form 0xaarrggbb. Has fast
14
- //! value semantics.
15
- //! The four-byte layout in memory is RGBA. On Big-Endian machines the
16
- //! unsigned int interpretation is 0xrrggbbaa, on Little-Endian machines
17
- //! it is 0xaabbggrr.
18
- class Color
19
- {
20
- std::tr1::uint32_t rep;
21
- #ifdef GOSU_IS_LITTLE_ENDIAN
22
- enum { RED_OFFSET = 0, GREEN_OFFSET = 8, BLUE_OFFSET = 16, ALPHA_OFFSET = 24 };
23
- #else
24
- enum { RED_OFFSET = 24, GREEN_OFFSET = 16, BLUE_OFFSET = 8, ALPHA_OFFSET = 0 };
25
- #endif
26
-
27
- public:
28
- typedef std::tr1::uint8_t Channel;
29
- static const unsigned GL_FORMAT = 0x1908; // GL_RGBA
30
-
31
- //! The default constructor does not initialize the color to any value.
32
- Color()
33
- {
34
- }
35
-
36
- //! Conversion constructor for literals of the form 0xaarrggbb.
37
- Color(unsigned argb)
38
- {
39
- *this = Color((argb >> 24) & 0xff, (argb >> 16) & 0xff,
40
- (argb >> 8) & 0xff, (argb >> 0) & 0xff);
41
- }
42
-
43
- Color(Channel red, Channel green, Channel blue)
44
- {
45
- *this = Color(0xff, red, green, blue);
46
- }
47
-
48
- Color(Channel alpha, Channel red, Channel green, Channel blue)
49
- {
50
- rep = (alpha << ALPHA_OFFSET) | (red << RED_OFFSET) |
51
- (green << GREEN_OFFSET) | (blue << BLUE_OFFSET);
52
- }
53
-
54
- //! Constructs a color from the given hue/saturation/value triple.
55
- //! Ranges of these values are given as 0..360, 0..1 and 0..1,
56
- //! respectively.
57
- //! The alpha value is set to 1 from this method.
58
- static Color fromHSV(double h, double s, double v);
59
- static Color fromAHSV(Channel alpha, double h, double s, double v);
60
-
61
- Channel red() const
62
- {
63
- return static_cast<Channel>(rep >> RED_OFFSET);
64
- }
65
-
66
- Channel green() const
67
- {
68
- return static_cast<Channel>(rep >> GREEN_OFFSET);
69
- }
70
-
71
- Channel blue() const
72
- {
73
- return static_cast<Channel>(rep >> BLUE_OFFSET);
74
- }
75
-
76
- Channel alpha() const
77
- {
78
- return static_cast<Channel>(rep >> ALPHA_OFFSET);
79
- }
80
-
81
- void setRed(Channel value)
82
- {
83
- rep &= ~(0xff << RED_OFFSET);
84
- rep |= value << RED_OFFSET;
85
- }
86
-
87
- void setGreen(Channel value)
88
- {
89
- rep &= ~(0xff << GREEN_OFFSET);
90
- rep |= value << GREEN_OFFSET;
91
- }
92
-
93
- void setBlue(Channel value)
94
- {
95
- rep &= ~(0xff << BLUE_OFFSET);
96
- rep |= value << BLUE_OFFSET;
97
- }
98
-
99
- void setAlpha(Channel value)
100
- {
101
- rep &= ~(0xff << ALPHA_OFFSET);
102
- rep |= value << ALPHA_OFFSET;
103
- }
104
-
105
- //! Returns the hue of the color, in the usual range of 0..360.
106
- double hue() const;
107
-
108
- //! Changes the current color so hue() will return h.
109
- void setHue(double h);
110
-
111
- //! Returns the saturation of the color, in the range of 0..1.
112
- double saturation() const;
113
-
114
- //! Changes the current color so saturation() will return s.
115
- void setSaturation(double s);
116
-
117
- //! Returns the value (brightness) of the color, in the range of 0..1.
118
- double value() const;
119
-
120
- //! Changes the current color so value() will return v.
121
- void setValue(double v);
122
-
123
- //! Returns the color in 0xaarrggbb representation.
124
- std::tr1::uint32_t argb() const
125
- {
126
- return alpha() << 24 | red() << 16 | green() << 8 | blue();
127
- }
128
-
129
- //! Returns the color in 0x00bbggrr representation. Useful for Win32 programming.
130
- std::tr1::uint32_t bgr() const
131
- {
132
- return blue() << 16 | green() << 8 | red();
133
- }
134
-
135
- //! Returns the color in 0xaabbggrr representation.
136
- std::tr1::uint32_t abgr() const
137
- {
138
- return alpha() << 24 | blue() << 16 | green() << 8 | red();
139
- }
140
-
141
- //! Returns the internal representation of the color (RGBA in memory).
142
- std::tr1::uint32_t gl() const
143
- {
144
- return rep;
145
- }
146
-
147
- static const Color NONE;
148
- static const Color BLACK;
149
- static const Color GRAY;
150
- static const Color WHITE;
151
-
152
- static const Color AQUA;
153
- static const Color RED;
154
- static const Color GREEN;
155
- static const Color BLUE;
156
- static const Color YELLOW;
157
- static const Color FUCHSIA;
158
- static const Color CYAN;
159
- };
160
-
161
- #ifndef SWIG
162
- inline bool operator<(Color a, Color b)
163
- {
164
- return a.gl() < b.gl();
165
- }
166
-
167
- inline bool operator==(Color a, Color b)
168
- {
169
- return a.gl() == b.gl();
170
- }
171
-
172
- inline bool operator!=(Color a, Color b)
173
- {
174
- return a.gl() != b.gl();
175
- }
176
-
177
- //! Interpolates linearly between two colors, with a given weight towards
178
- //! the second color.
179
- //! Specialization of the general function in Gosu/Math.hpp.
180
- Color interpolate(Color a, Color b, double weight = 0.5);
181
-
182
- //! Combines two colors as if their channels were mapped to the 0..1 range
183
- //! and then multiplied with each other.
184
- Color multiply(Color a, Color b);
185
-
186
- namespace Colors
187
- {
188
- GOSU_DEPRECATED const Color none (0x00000000);
189
- GOSU_DEPRECATED const Color black (0xff000000);
190
- GOSU_DEPRECATED const Color gray (0xff808080);
191
- GOSU_DEPRECATED const Color white (0xffffffff);
192
-
193
- GOSU_DEPRECATED const Color aqua (0xff00ffff);
194
- GOSU_DEPRECATED const Color red (0xffff0000);
195
- GOSU_DEPRECATED const Color green (0xff00ff00);
196
- GOSU_DEPRECATED const Color blue (0xff0000ff);
197
- GOSU_DEPRECATED const Color yellow (0xffffff00);
198
- GOSU_DEPRECATED const Color fuchsia (0xffff00ff);
199
- GOSU_DEPRECATED const Color cyan (0xff00ffff);
200
- }
201
- #endif
202
- }
203
-
204
- #endif
1
+ //! \file Color.hpp
2
+ //! Interface of the Color class.
3
+
4
+ #ifndef GOSU_COLOR_HPP
5
+ #define GOSU_COLOR_HPP
6
+
7
+ #include <Gosu/Platform.hpp>
8
+ #include <Gosu/TR1.hpp>
9
+
10
+ namespace Gosu
11
+ {
12
+ //! Represents an RGBA color value with 8 bits for each channel. Can be
13
+ //! implicitly constructed from literals of the form 0xaarrggbb. Has fast
14
+ //! value semantics.
15
+ //! The four-byte layout in memory is RGBA. On Big-Endian machines the
16
+ //! unsigned int interpretation is 0xrrggbbaa, on Little-Endian machines
17
+ //! it is 0xaabbggrr.
18
+ class Color
19
+ {
20
+ std::tr1::uint32_t rep;
21
+ #ifdef GOSU_IS_LITTLE_ENDIAN
22
+ enum { RED_OFFSET = 0, GREEN_OFFSET = 8, BLUE_OFFSET = 16, ALPHA_OFFSET = 24 };
23
+ #else
24
+ enum { RED_OFFSET = 24, GREEN_OFFSET = 16, BLUE_OFFSET = 8, ALPHA_OFFSET = 0 };
25
+ #endif
26
+
27
+ public:
28
+ typedef std::tr1::uint8_t Channel;
29
+ static const unsigned GL_FORMAT = 0x1908; // GL_RGBA
30
+
31
+ //! The default constructor does not initialize the color to any value.
32
+ Color()
33
+ {
34
+ }
35
+
36
+ //! Conversion constructor for literals of the form 0xaarrggbb.
37
+ Color(unsigned argb)
38
+ {
39
+ *this = Color((argb >> 24) & 0xff, (argb >> 16) & 0xff,
40
+ (argb >> 8) & 0xff, (argb >> 0) & 0xff);
41
+ }
42
+
43
+ Color(Channel red, Channel green, Channel blue)
44
+ {
45
+ *this = Color(0xff, red, green, blue);
46
+ }
47
+
48
+ Color(Channel alpha, Channel red, Channel green, Channel blue)
49
+ {
50
+ rep = (alpha << ALPHA_OFFSET) | (red << RED_OFFSET) |
51
+ (green << GREEN_OFFSET) | (blue << BLUE_OFFSET);
52
+ }
53
+
54
+ //! Constructs a color from the given hue/saturation/value triple.
55
+ //! Ranges of these values are given as 0..360, 0..1 and 0..1,
56
+ //! respectively.
57
+ //! The alpha value is set to 1 from this method.
58
+ static Color fromHSV(double h, double s, double v);
59
+ static Color fromAHSV(Channel alpha, double h, double s, double v);
60
+
61
+ Channel red() const
62
+ {
63
+ return static_cast<Channel>(rep >> RED_OFFSET);
64
+ }
65
+
66
+ Channel green() const
67
+ {
68
+ return static_cast<Channel>(rep >> GREEN_OFFSET);
69
+ }
70
+
71
+ Channel blue() const
72
+ {
73
+ return static_cast<Channel>(rep >> BLUE_OFFSET);
74
+ }
75
+
76
+ Channel alpha() const
77
+ {
78
+ return static_cast<Channel>(rep >> ALPHA_OFFSET);
79
+ }
80
+
81
+ void setRed(Channel value)
82
+ {
83
+ rep &= ~(0xff << RED_OFFSET);
84
+ rep |= value << RED_OFFSET;
85
+ }
86
+
87
+ void setGreen(Channel value)
88
+ {
89
+ rep &= ~(0xff << GREEN_OFFSET);
90
+ rep |= value << GREEN_OFFSET;
91
+ }
92
+
93
+ void setBlue(Channel value)
94
+ {
95
+ rep &= ~(0xff << BLUE_OFFSET);
96
+ rep |= value << BLUE_OFFSET;
97
+ }
98
+
99
+ void setAlpha(Channel value)
100
+ {
101
+ rep &= ~(0xff << ALPHA_OFFSET);
102
+ rep |= value << ALPHA_OFFSET;
103
+ }
104
+
105
+ //! Returns the hue of the color, in the usual range of 0..360.
106
+ double hue() const;
107
+
108
+ //! Changes the current color so hue() will return h.
109
+ void setHue(double h);
110
+
111
+ //! Returns the saturation of the color, in the range of 0..1.
112
+ double saturation() const;
113
+
114
+ //! Changes the current color so saturation() will return s.
115
+ void setSaturation(double s);
116
+
117
+ //! Returns the value (brightness) of the color, in the range of 0..1.
118
+ double value() const;
119
+
120
+ //! Changes the current color so value() will return v.
121
+ void setValue(double v);
122
+
123
+ //! Returns the color in 0xaarrggbb representation.
124
+ std::tr1::uint32_t argb() const
125
+ {
126
+ return alpha() << 24 | red() << 16 | green() << 8 | blue();
127
+ }
128
+
129
+ //! Returns the color in 0x00bbggrr representation. Useful for Win32 programming.
130
+ std::tr1::uint32_t bgr() const
131
+ {
132
+ return blue() << 16 | green() << 8 | red();
133
+ }
134
+
135
+ //! Returns the color in 0xaabbggrr representation.
136
+ std::tr1::uint32_t abgr() const
137
+ {
138
+ return alpha() << 24 | blue() << 16 | green() << 8 | red();
139
+ }
140
+
141
+ //! Returns the internal representation of the color (RGBA in memory).
142
+ std::tr1::uint32_t gl() const
143
+ {
144
+ return rep;
145
+ }
146
+
147
+ static const Color NONE;
148
+ static const Color BLACK;
149
+ static const Color GRAY;
150
+ static const Color WHITE;
151
+
152
+ static const Color AQUA;
153
+ static const Color RED;
154
+ static const Color GREEN;
155
+ static const Color BLUE;
156
+ static const Color YELLOW;
157
+ static const Color FUCHSIA;
158
+ static const Color CYAN;
159
+ };
160
+
161
+ #ifndef SWIG
162
+ inline bool operator<(Color a, Color b)
163
+ {
164
+ return a.gl() < b.gl();
165
+ }
166
+
167
+ inline bool operator==(Color a, Color b)
168
+ {
169
+ return a.gl() == b.gl();
170
+ }
171
+
172
+ inline bool operator!=(Color a, Color b)
173
+ {
174
+ return a.gl() != b.gl();
175
+ }
176
+
177
+ //! Interpolates linearly between two colors, with a given weight towards
178
+ //! the second color.
179
+ //! Specialization of the general function in Gosu/Math.hpp.
180
+ Color interpolate(Color a, Color b, double weight = 0.5);
181
+
182
+ //! Combines two colors as if their channels were mapped to the 0..1 range
183
+ //! and then multiplied with each other.
184
+ Color multiply(Color a, Color b);
185
+
186
+ namespace Colors
187
+ {
188
+ GOSU_DEPRECATED const Color none (0x00000000);
189
+ GOSU_DEPRECATED const Color black (0xff000000);
190
+ GOSU_DEPRECATED const Color gray (0xff808080);
191
+ GOSU_DEPRECATED const Color white (0xffffffff);
192
+
193
+ GOSU_DEPRECATED const Color aqua (0xff00ffff);
194
+ GOSU_DEPRECATED const Color red (0xffff0000);
195
+ GOSU_DEPRECATED const Color green (0xff00ff00);
196
+ GOSU_DEPRECATED const Color blue (0xff0000ff);
197
+ GOSU_DEPRECATED const Color yellow (0xffffff00);
198
+ GOSU_DEPRECATED const Color fuchsia (0xffff00ff);
199
+ GOSU_DEPRECATED const Color cyan (0xff00ffff);
200
+ }
201
+ #endif
202
+ }
203
+
204
+ #endif
@@ -1,36 +1,36 @@
1
- //! \file Directories.hpp
2
- //! Access to a small set of system paths.
3
-
4
- #ifndef GOSU_DIRECTORIES_HPP
5
- #define GOSU_DIRECTORIES_HPP
6
-
7
- #include <string>
8
-
9
- namespace Gosu
10
- {
11
- //! Prefix for a program's own resources.
12
- //! On Windows, the executable's containing directory.
13
- //! On OS X, the application's Resources subdirectory.
14
- //! On Linux, the current directory.
15
- std::wstring resourcePrefix();
16
-
17
- //! Prefix for resources of a group of programs.
18
- //! On Windows, the executable's containing directory.
19
- //! On OS X, the application's containing subdirectory.
20
- //! On Linux, the current directory.
21
- std::wstring sharedResourcePrefix();
22
-
23
- //! Prefix for user settings.
24
- //! On Windows, the same as %APPDATA%.
25
- //! On OS X, the user's Library/Preferences folder.
26
- //! On Linux, the home directory plus a trailing dot for hidden files.
27
- std::wstring userSettingsPrefix();
28
-
29
- //! Prefix for user documents, e.g. save games.
30
- //! On Windows, the My Documents folder.
31
- //! On OS X, the user's Documents folder.
32
- //! On Linux, the home directory.
33
- std::wstring userDocsPrefix();
34
- }
35
-
36
- #endif
1
+ //! \file Directories.hpp
2
+ //! Access to a small set of system paths.
3
+
4
+ #ifndef GOSU_DIRECTORIES_HPP
5
+ #define GOSU_DIRECTORIES_HPP
6
+
7
+ #include <string>
8
+
9
+ namespace Gosu
10
+ {
11
+ //! Prefix for a program's own resources.
12
+ //! On Windows, the executable's containing directory.
13
+ //! On OS X, the application's Resources subdirectory.
14
+ //! On Linux, the current directory.
15
+ std::wstring resourcePrefix();
16
+
17
+ //! Prefix for resources of a group of programs.
18
+ //! On Windows, the executable's containing directory.
19
+ //! On OS X, the application's containing subdirectory.
20
+ //! On Linux, the current directory.
21
+ std::wstring sharedResourcePrefix();
22
+
23
+ //! Prefix for user settings.
24
+ //! On Windows, the same as %APPDATA%.
25
+ //! On OS X, the user's Library/Preferences folder.
26
+ //! On Linux, the home directory plus a trailing dot for hidden files.
27
+ std::wstring userSettingsPrefix();
28
+
29
+ //! Prefix for user documents, e.g. save games.
30
+ //! On Windows, the My Documents folder.
31
+ //! On OS X, the user's Documents folder.
32
+ //! On Linux, the home directory.
33
+ std::wstring userDocsPrefix();
34
+ }
35
+
36
+ #endif