gosu 0.7.39-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/COPYING +34 -0
  2. data/Gosu/Async.hpp +50 -0
  3. data/Gosu/Audio.hpp +163 -0
  4. data/Gosu/AutoLink.hpp +16 -0
  5. data/Gosu/Bitmap.hpp +96 -0
  6. data/Gosu/ButtonsMac.hpp +140 -0
  7. data/Gosu/ButtonsWin.hpp +140 -0
  8. data/Gosu/ButtonsX.hpp +141 -0
  9. data/Gosu/Color.hpp +204 -0
  10. data/Gosu/Directories.hpp +36 -0
  11. data/Gosu/Font.hpp +83 -0
  12. data/Gosu/Fwd.hpp +31 -0
  13. data/Gosu/Gosu.hpp +34 -0
  14. data/Gosu/Graphics.hpp +120 -0
  15. data/Gosu/GraphicsBase.hpp +66 -0
  16. data/Gosu/IO.hpp +259 -0
  17. data/Gosu/Image.hpp +138 -0
  18. data/Gosu/ImageData.hpp +58 -0
  19. data/Gosu/Input.hpp +161 -0
  20. data/Gosu/Inspection.hpp +14 -0
  21. data/Gosu/Math.hpp +135 -0
  22. data/Gosu/Platform.hpp +73 -0
  23. data/Gosu/Sockets.hpp +137 -0
  24. data/Gosu/TR1.hpp +44 -0
  25. data/Gosu/Text.hpp +71 -0
  26. data/Gosu/TextInput.hpp +70 -0
  27. data/Gosu/Timing.hpp +16 -0
  28. data/Gosu/Utility.hpp +28 -0
  29. data/Gosu/Version.hpp +526 -0
  30. data/Gosu/WinUtility.hpp +75 -0
  31. data/Gosu/Window.hpp +124 -0
  32. data/README.txt +25 -0
  33. data/examples/ChipmunkIntegration.rb +275 -0
  34. data/examples/CptnRuby.rb +223 -0
  35. data/examples/MoreChipmunkAndRMagick.rb +155 -0
  36. data/examples/OpenGLIntegration.rb +226 -0
  37. data/examples/RMagickIntegration.rb +417 -0
  38. data/examples/TextInput.rb +154 -0
  39. data/examples/Tutorial.rb +131 -0
  40. data/examples/media/Beep.wav +0 -0
  41. data/examples/media/CptnRuby Gem.png +0 -0
  42. data/examples/media/CptnRuby Map.txt +25 -0
  43. data/examples/media/CptnRuby Tileset.png +0 -0
  44. data/examples/media/CptnRuby.png +0 -0
  45. data/examples/media/Cursor.png +0 -0
  46. data/examples/media/Earth.png +0 -0
  47. data/examples/media/Explosion.wav +0 -0
  48. data/examples/media/Landscape.svg +10 -0
  49. data/examples/media/LargeStar.png +0 -0
  50. data/examples/media/Smoke.png +0 -0
  51. data/examples/media/Soldier.png +0 -0
  52. data/examples/media/Space.png +0 -0
  53. data/examples/media/Star.png +0 -0
  54. data/examples/media/Starfighter.bmp +0 -0
  55. data/lib/FreeImage.dll +0 -0
  56. data/lib/OpenAL32.dll +0 -0
  57. data/lib/gosu.for_1_8.so +0 -0
  58. data/lib/gosu.for_1_9.so +0 -0
  59. data/lib/gosu.rb +17 -0
  60. data/lib/gosu/patches.rb +75 -0
  61. data/lib/gosu/preview.rb +121 -0
  62. data/lib/gosu/run.rb +11 -0
  63. data/lib/gosu/swig_patches.rb +48 -0
  64. data/lib/gosu/zen.rb +28 -0
  65. data/lib/libsndfile.dll +0 -0
  66. metadata +138 -0
@@ -0,0 +1,140 @@
1
+ #ifndef GOSU_BUTTONSWIN_HPP
2
+ #define GOSU_BUTTONSWIN_HPP
3
+
4
+ namespace Gosu
5
+ {
6
+ //! List of button ids that can be used with Gosu::Input.
7
+ //! This enumeration contains ids for keyboard keys (kb*),
8
+ //! mouse buttons and mouse wheel (ms*) and gamepad buttons (gp*).
9
+ enum ButtonName
10
+ {
11
+ kbRangeBegin = 0x00,
12
+ kbEscape = 0x01,
13
+ kbF1 = 0x3b,
14
+ kbF2 = 0x3c,
15
+ kbF3 = 0x3d,
16
+ kbF4 = 0x3e,
17
+ kbF5 = 0x3f,
18
+ kbF6 = 0x40,
19
+ kbF7 = 0x41,
20
+ kbF8 = 0x42,
21
+ kbF9 = 0x43,
22
+ kbF10 = 0x44,
23
+ kbF11 = 0x57,
24
+ kbF12 = 0x58,
25
+ kb0 = 0x0b,
26
+ kb1 = 0x02,
27
+ kb2 = 0x03,
28
+ kb3 = 0x04,
29
+ kb4 = 0x05,
30
+ kb5 = 0x06,
31
+ kb6 = 0x07,
32
+ kb7 = 0x08,
33
+ kb8 = 0x09,
34
+ kb9 = 0x0a,
35
+ kbTab = 0x0f,
36
+ kbReturn = 0x1c,
37
+ kbSpace = 0x39,
38
+ kbLeftShift = 0x2a,
39
+ kbRightShift = 0x36,
40
+ kbLeftControl = 0x1d,
41
+ kbRightControl = 0x9d,
42
+ kbLeftAlt = 0x38,
43
+ kbRightAlt = 0xb8,
44
+ kbLeftMeta = 0xdb,
45
+ kbRightMeta = 0xdc,
46
+ kbBackspace = 0x0e,
47
+ kbLeft = 0xcb,
48
+ kbRight = 0xcd,
49
+ kbUp = 0xc8,
50
+ kbDown = 0xd0,
51
+ kbHome = 0xc7,
52
+ kbEnd = 0xcf,
53
+ kbInsert = 0xd2,
54
+ kbDelete = 0xd3,
55
+ kbPageUp = 0xc9,
56
+ kbPageDown = 0xd1,
57
+ kbEnter = 0x9c,
58
+ kbA = 0x1e,
59
+ kbB = 0x30,
60
+ kbC = 0x2e,
61
+ kbD = 0x20,
62
+ kbE = 0x12,
63
+ kbF = 0x21,
64
+ kbG = 0x22,
65
+ kbH = 0x23,
66
+ kbI = 0x17,
67
+ kbJ = 0x24,
68
+ kbK = 0x25,
69
+ kbL = 0x26,
70
+ kbM = 0x32,
71
+ kbN = 0x31,
72
+ kbO = 0x18,
73
+ kbP = 0x19,
74
+ kbQ = 0x10,
75
+ kbR = 0x13,
76
+ kbS = 0x1f,
77
+ kbT = 0x14,
78
+ kbU = 0x16,
79
+ kbV = 0x2f,
80
+ kbW = 0x11,
81
+ kbX = 0x2d,
82
+ kbY = 0x15,
83
+ kbZ = 0x2c,
84
+ kbNumpad0 = 0x52,
85
+ kbNumpad1 = 0x4f,
86
+ kbNumpad2 = 0x50,
87
+ kbNumpad3 = 0x51,
88
+ kbNumpad4 = 0x4b,
89
+ kbNumpad5 = 0x4c,
90
+ kbNumpad6 = 0x4d,
91
+ kbNumpad7 = 0x47,
92
+ kbNumpad8 = 0x48,
93
+ kbNumpad9 = 0x49,
94
+ kbNumpadAdd = 0x4e,
95
+ kbNumpadSubtract = 0x4a,
96
+ kbNumpadMultiply = 0x37,
97
+ kbNumpadDivide = 0xb5,
98
+ kbRangeEnd = 0xff,
99
+
100
+ msRangeBegin,
101
+ msLeft = msRangeBegin,
102
+ msRight,
103
+ msMiddle,
104
+ msWheelUp,
105
+ msWheelDown,
106
+ msRangeEnd,
107
+
108
+ gpRangeBegin,
109
+ gpLeft = gpRangeBegin,
110
+ gpRight,
111
+ gpUp,
112
+ gpDown,
113
+ gpButton0,
114
+ gpButton1,
115
+ gpButton2,
116
+ gpButton3,
117
+ gpButton4,
118
+ gpButton5,
119
+ gpButton6,
120
+ gpButton7,
121
+ gpButton8,
122
+ gpButton9,
123
+ gpButton10,
124
+ gpButton11,
125
+ gpButton12,
126
+ gpButton13,
127
+ gpButton14,
128
+ gpButton15,
129
+ gpRangeEnd = gpButton15,
130
+
131
+ kbNum = kbRangeEnd - kbRangeBegin + 1,
132
+ msNum = msRangeEnd - msRangeBegin + 1,
133
+ gpNum = gpRangeEnd - gpRangeBegin + 1,
134
+
135
+ numButtons = gpRangeEnd,
136
+ noButton = 0xffffffff
137
+ };
138
+ }
139
+
140
+ #endif
data/Gosu/ButtonsX.hpp ADDED
@@ -0,0 +1,141 @@
1
+ #ifndef GOSU_BUTTONSX_HPP
2
+ #define GOSU_BUTTONSX_HPP
3
+
4
+ namespace Gosu
5
+ {
6
+ //! List of button ids that can be used with Gosu::Input.
7
+ //! This enumeration contains ids for keyboard keys (kb*),
8
+ //! mouse buttons and mouse wheel (ms*) and gamepad buttons (gp*).
9
+ enum ButtonName
10
+ {
11
+ kbRangeBegin = 0x00,
12
+ kbA = 'a',
13
+ kbB = 'b',
14
+ kbC = 'c',
15
+ kbD = 'd',
16
+ kbE = 'e',
17
+ kbF = 'f',
18
+ kbG = 'g',
19
+ kbH = 'h',
20
+ kbI = 'i',
21
+ kbJ = 'j',
22
+ kbK = 'k',
23
+ kbL = 'l',
24
+ kbM = 'm',
25
+ kbN = 'n',
26
+ kbO = 'o',
27
+ kbP = 'p',
28
+ kbQ = 'q',
29
+ kbR = 'r',
30
+ kbS = 's',
31
+ kbT = 't',
32
+ kbU = 'u',
33
+ kbV = 'v',
34
+ kbW = 'w',
35
+ kbX = 'x',
36
+ kbY = 'y',
37
+ kbZ = 'z',
38
+ kbEscape = XK_Escape,
39
+ kbF1 = XK_F1,
40
+ kbF2 = XK_F2,
41
+ kbF3 = XK_F3,
42
+ kbF4 = XK_F4,
43
+ kbF5 = XK_F5,
44
+ kbF6 = XK_F6,
45
+ kbF7 = XK_F7,
46
+ kbF8 = XK_F8,
47
+ kbF9 = XK_F9,
48
+ kbF10 = XK_F10,
49
+ kbF11 = XK_F11,
50
+ kbF12 = XK_F12,
51
+ kb1 = XK_1,
52
+ kb2 = XK_2,
53
+ kb3 = XK_3,
54
+ kb4 = XK_4,
55
+ kb5 = XK_5,
56
+ kb6 = XK_6,
57
+ kb7 = XK_7,
58
+ kb8 = XK_8,
59
+ kb9 = XK_9,
60
+ kb0 = XK_0,
61
+ kbTab = XK_Tab,
62
+ kbReturn = XK_Return,
63
+ kbSpace = XK_space,
64
+ kbLeftShift = XK_Shift_L,
65
+ kbRightShift = XK_Shift_R,
66
+ kbLeftControl = XK_Control_L,
67
+ kbRightControl = XK_Control_R,
68
+ kbLeftAlt = XK_Alt_L,
69
+ kbRightAlt = XK_Alt_R,
70
+ kbLeftMeta = 0, // TODO?!
71
+ kbRightMeta = 0,
72
+ kbBackspace = XK_BackSpace,
73
+ kbLeft = XK_Left,
74
+ kbRight = XK_Right,
75
+ kbUp = XK_Up,
76
+ kbDown = XK_Down,
77
+ kbHome = XK_Home,
78
+ kbEnd = XK_End,
79
+ kbInsert = XK_Insert,
80
+ kbDelete = XK_Delete,
81
+ kbPageUp = XK_Prior,
82
+ kbPageDown = XK_Next,
83
+ kbEnter = XK_KP_Enter,
84
+ kbNumpad1 = XK_KP_1,
85
+ kbNumpad2 = XK_KP_2,
86
+ kbNumpad3 = XK_KP_3,
87
+ kbNumpad4 = XK_KP_4,
88
+ kbNumpad5 = XK_KP_5,
89
+ kbNumpad6 = XK_KP_6,
90
+ kbNumpad7 = XK_KP_7,
91
+ kbNumpad8 = XK_KP_8,
92
+ kbNumpad9 = XK_KP_9,
93
+ kbNumpad0 = XK_KP_0,
94
+ kbNumpadAdd = XK_KP_Add,
95
+ kbNumpadSubtract = XK_KP_Subtract,
96
+ kbNumpadMultiply = XK_KP_Multiply,
97
+ kbNumpadDivide = XK_KP_Divide,
98
+ kbRangeEnd = 0xffff,
99
+
100
+ msRangeBegin,
101
+ msLeft = msRangeBegin,
102
+ msRight,
103
+ msMiddle,
104
+ msWheelUp,
105
+ msWheelDown,
106
+ msRangeEnd,
107
+
108
+ gpRangeBegin,
109
+ gpLeft = gpRangeBegin,
110
+ gpRight,
111
+ gpUp,
112
+ gpDown,
113
+ gpButton0,
114
+ gpButton1,
115
+ gpButton2,
116
+ gpButton3,
117
+ gpButton4,
118
+ gpButton5,
119
+ gpButton6,
120
+ gpButton7,
121
+ gpButton8,
122
+ gpButton9,
123
+ gpButton10,
124
+ gpButton11,
125
+ gpButton12,
126
+ gpButton13,
127
+ gpButton14,
128
+ gpButton15,
129
+ gpRangeEnd = gpButton15,
130
+
131
+ kbNum = kbRangeEnd - kbRangeBegin + 1,
132
+ msNum = msRangeEnd - msRangeBegin + 1,
133
+ gpNum = gpRangeEnd - gpRangeBegin + 1,
134
+
135
+ numButtons = gpRangeEnd,
136
+ noButton = 0xffffffff
137
+ };
138
+ }
139
+
140
+ #endif
141
+
data/Gosu/Color.hpp ADDED
@@ -0,0 +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
+ #endif
177
+
178
+ //! Interpolates linearly between two colors, with a given weight towards
179
+ //! the second color.
180
+ //! Specialization of the general function in Gosu/Math.hpp.
181
+ Color interpolate(Color a, Color b, double weight = 0.5);
182
+
183
+ //! Combines two colors as if their channels were mapped to the 0..1 range
184
+ //! and then multiplied with each other.
185
+ Color multiply(Color a, Color b);
186
+
187
+ namespace Colors
188
+ {
189
+ const Color none = 0x00000000;
190
+ const Color black = 0xff000000;
191
+ const Color gray = 0xff808080;
192
+ const Color white = 0xffffffff;
193
+
194
+ const Color aqua = 0xff00ffff;
195
+ const Color red = 0xffff0000;
196
+ const Color green = 0xff00ff00;
197
+ const Color blue = 0xff0000ff;
198
+ const Color yellow = 0xffffff00;
199
+ const Color fuchsia = 0xffff00ff;
200
+ const Color cyan = 0xff00ffff;
201
+ }
202
+ }
203
+
204
+ #endif