gosu 0.7.25-i386-mingw32 → 0.7.26-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.txt +1 -1
- data/Gosu/Async.hpp +48 -0
- data/Gosu/Audio.hpp +165 -0
- data/Gosu/AutoLink.hpp +16 -0
- data/Gosu/Bitmap.hpp +85 -0
- data/Gosu/ButtonsMac.hpp +140 -0
- data/Gosu/ButtonsWin.hpp +140 -0
- data/Gosu/ButtonsX.hpp +141 -0
- data/Gosu/Color.hpp +202 -0
- data/Gosu/Directories.hpp +36 -0
- data/Gosu/Font.hpp +74 -0
- data/Gosu/Fwd.hpp +30 -0
- data/Gosu/Gosu.hpp +33 -0
- data/Gosu/Graphics.hpp +118 -0
- data/Gosu/GraphicsBase.hpp +69 -0
- data/Gosu/IO.hpp +252 -0
- data/Gosu/Image.hpp +136 -0
- data/Gosu/ImageData.hpp +49 -0
- data/Gosu/Input.hpp +162 -0
- data/Gosu/Math.hpp +135 -0
- data/Gosu/Platform.hpp +73 -0
- data/Gosu/Sockets.hpp +139 -0
- data/Gosu/Text.hpp +71 -0
- data/Gosu/TextInput.hpp +70 -0
- data/Gosu/Timing.hpp +16 -0
- data/Gosu/Utility.hpp +25 -0
- data/Gosu/Version.hpp +9 -0
- data/Gosu/WinUtility.hpp +76 -0
- data/Gosu/Window.hpp +124 -0
- data/lib/gosu.for_1_8.so +0 -0
- data/lib/gosu.for_1_9.so +0 -0
- data/lib/gosu/patches.rb +13 -13
- metadata +32 -4
data/Gosu/ButtonsWin.hpp
ADDED
@@ -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 = 1,
|
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 = 0x01,
|
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,202 @@
|
|
1
|
+
//! \file Color.hpp
|
2
|
+
//! Interface of the Color class.
|
3
|
+
|
4
|
+
#ifndef GOSU_COLOR_HPP
|
5
|
+
#define GOSU_COLOR_HPP
|
6
|
+
|
7
|
+
#include <boost/cstdint.hpp>
|
8
|
+
#include <Gosu/Platform.hpp>
|
9
|
+
|
10
|
+
namespace Gosu
|
11
|
+
{
|
12
|
+
//! Represents an ARGB 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
|
+
boost::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 boost::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(boost::uint32_t 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
|
+
boost::uint32_t argb() const
|
125
|
+
{
|
126
|
+
return alpha() << 24 | red() << 16 | green() << 8 | blue();
|
127
|
+
}
|
128
|
+
|
129
|
+
//! Returns the color in 0x00bbggrr representation.
|
130
|
+
boost::uint32_t bgr() const
|
131
|
+
{
|
132
|
+
return blue() << 16 | green() << 8 | red();
|
133
|
+
}
|
134
|
+
|
135
|
+
//! Returns the color in 0xaabbggrr representation.
|
136
|
+
boost::uint32_t abgr() const
|
137
|
+
{
|
138
|
+
return alpha() << 24 | blue() << 16 | green() << 8 | red();
|
139
|
+
}
|
140
|
+
|
141
|
+
static const Color NONE;
|
142
|
+
static const Color BLACK;
|
143
|
+
static const Color GRAY;
|
144
|
+
static const Color WHITE;
|
145
|
+
|
146
|
+
static const Color AQUA;
|
147
|
+
static const Color RED;
|
148
|
+
static const Color GREEN;
|
149
|
+
static const Color BLUE;
|
150
|
+
static const Color YELLOW;
|
151
|
+
static const Color FUCHSIA;
|
152
|
+
static const Color CYAN;
|
153
|
+
};
|
154
|
+
|
155
|
+
// Causes weird errors when included in the SWIG wrapping process.
|
156
|
+
// If, with a future version of SWIG, this can be included and
|
157
|
+
// require 'gosu'; include Gosu
|
158
|
+
// works from within Ruby, the #ifndef guard can be removed.
|
159
|
+
#ifndef SWIG
|
160
|
+
inline bool operator<(Color a, Color b)
|
161
|
+
{
|
162
|
+
return a.argb() < b.argb();
|
163
|
+
}
|
164
|
+
|
165
|
+
inline bool operator==(Color a, Color b)
|
166
|
+
{
|
167
|
+
return a.argb() == b.argb();
|
168
|
+
}
|
169
|
+
|
170
|
+
inline bool operator!=(Color a, Color b)
|
171
|
+
{
|
172
|
+
return a.argb() != b.argb();
|
173
|
+
}
|
174
|
+
#endif
|
175
|
+
|
176
|
+
//! Interpolates linearly between two colors, with a given weight towards
|
177
|
+
//! the second color.
|
178
|
+
//! Specialization of the general function in Gosu/Math.hpp.
|
179
|
+
Color interpolate(Color a, Color b, double weight = 0.5);
|
180
|
+
|
181
|
+
//! Combines two colors as if their channels were mapped to the 0..1 range
|
182
|
+
//! and then multiplied with each other.
|
183
|
+
Color multiply(Color a, Color b);
|
184
|
+
|
185
|
+
namespace Colors
|
186
|
+
{
|
187
|
+
const Color none = 0x00000000;
|
188
|
+
const Color black = 0xff000000;
|
189
|
+
const Color gray = 0xff808080;
|
190
|
+
const Color white = 0xffffffff;
|
191
|
+
|
192
|
+
const Color aqua = 0xff00ffff;
|
193
|
+
const Color red = 0xffff0000;
|
194
|
+
const Color green = 0xff00ff00;
|
195
|
+
const Color blue = 0xff0000ff;
|
196
|
+
const Color yellow = 0xffffff00;
|
197
|
+
const Color fuchsia = 0xffff00ff;
|
198
|
+
const Color cyan = 0xff00ffff;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
#endif
|