gosu 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/COPYING +1 -1
- data/ext/gosu/extconf.rb +5 -1
- data/include/Gosu/Font.hpp +7 -9
- data/include/Gosu/Graphics.hpp +6 -4
- data/include/Gosu/GraphicsBase.hpp +6 -6
- data/include/Gosu/Image.hpp +3 -3
- data/include/Gosu/ImageData.hpp +1 -1
- data/include/Gosu/Text.hpp +4 -4
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +23 -9
- data/lib/gosu/compat.rb +4 -0
- data/lib/gosu/swig_patches.rb +11 -10
- data/rdoc/gosu.rb +14 -1
- data/src/EmptyImageData.hpp +1 -1
- data/src/Font.cpp +4 -4
- data/src/Graphics.cpp +4 -4
- data/src/Image.cpp +4 -3
- data/src/Input.cpp +1 -10
- data/src/LargeImageData.cpp +1 -1
- data/src/LargeImageData.hpp +1 -1
- data/src/Macro.cpp +100 -143
- data/src/Macro.hpp +1 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +111 -63
- data/src/RubyGosu.cxx +222 -124
- data/src/RubyGosu.h +2 -2
- data/src/TexChunk.cpp +1 -1
- data/src/TexChunk.hpp +1 -1
- data/src/TrueTypeFontApple.cpp +10 -2
- data/src/TrueTypeFontWin.cpp +3 -3
- data/src/Utility.cpp +52 -23
- data/src/Window.cpp +60 -31
- data/src/WindowUIKit.cpp +21 -9
- metadata +3 -25
- data/include/Gosu/Channel.h +0 -25
- data/include/Gosu/Color.h +0 -38
- data/include/Gosu/Font.h +0 -36
- data/include/Gosu/Gosu.h +0 -82
- data/include/Gosu/Image.h +0 -54
- data/include/Gosu/Sample.h +0 -19
- data/include/Gosu/Song.h +0 -24
- data/include/Gosu/TextInput.h +0 -30
- data/include/Gosu/Window.h +0 -63
- data/src/ChannelWrapper.cpp +0 -50
- data/src/ColorWrapper.cpp +0 -126
- data/src/Constants.cpp +0 -338
- data/src/FontWrapper.cpp +0 -74
- data/src/GosuWrapper.cpp +0 -251
- data/src/ImageWrapper.cpp +0 -168
- data/src/MPEGFile.hpp +0 -90
- data/src/SampleWrapper.cpp +0 -30
- data/src/SongWrapper.cpp +0 -52
- data/src/TextInputWrapper.cpp +0 -101
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
- data/src/WindowWrapper.cpp +0 -317
data/src/UtilityWin.cpp
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#include <Gosu/Platform.hpp>
|
2
|
-
#if defined(GOSU_IS_WIN)
|
3
|
-
|
4
|
-
#include <Gosu/Utility.hpp>
|
5
|
-
#include "WinUtility.hpp"
|
6
|
-
#include <windows.h>
|
7
|
-
using namespace std;
|
8
|
-
|
9
|
-
string Gosu::language()
|
10
|
-
{
|
11
|
-
LCID lcid = GetUserDefaultLCID();
|
12
|
-
char buffer[9];
|
13
|
-
winapi_check(GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, buffer, sizeof buffer));
|
14
|
-
return buffer;
|
15
|
-
}
|
16
|
-
|
17
|
-
#endif
|
data/src/WindowWrapper.cpp
DELETED
@@ -1,317 +0,0 @@
|
|
1
|
-
#include <Gosu/Gosu.hpp>
|
2
|
-
|
3
|
-
namespace Gosu
|
4
|
-
{
|
5
|
-
class WindowForWrapper : public Gosu::Window
|
6
|
-
{
|
7
|
-
public:
|
8
|
-
WindowForWrapper(int width, int height, bool fullscreen, double update_interval, bool resizable);
|
9
|
-
void update() override;
|
10
|
-
void draw() override;
|
11
|
-
void default_button_down(unsigned btn); // Enables fullscreen toggle
|
12
|
-
void button_down(Gosu::Button btn) override;
|
13
|
-
void button_up(Gosu::Button btn) override;
|
14
|
-
void gamepad_connected(int id) override;
|
15
|
-
void gamepad_disconnected(int id) override;
|
16
|
-
void drop(const std::string &filename) override;
|
17
|
-
bool needs_redraw() const override;
|
18
|
-
bool needs_cursor() const override;
|
19
|
-
void close() override;
|
20
|
-
|
21
|
-
void close_immediately();
|
22
|
-
|
23
|
-
std::function<void ()> update_callback;
|
24
|
-
std::function<void ()> draw_callback;
|
25
|
-
std::function<void (unsigned btn)> button_down_callback;
|
26
|
-
std::function<void (unsigned btn)> button_up_callback;
|
27
|
-
std::function<void (int id)> gamepad_connected_callback;
|
28
|
-
std::function<void (int id)> gamepad_disconnected_callback;
|
29
|
-
std::function<void (const char *filename)> drop_callback;
|
30
|
-
std::function<bool ()> needs_redraw_callback;
|
31
|
-
std::function<bool ()> needs_cursor_callback;
|
32
|
-
std::function<void ()> close_callback;
|
33
|
-
};
|
34
|
-
} // namespace Gosu
|
35
|
-
|
36
|
-
Gosu::WindowForWrapper::WindowForWrapper(int width, int height, bool fullscreen,
|
37
|
-
double update_interval, bool resizable)
|
38
|
-
: Gosu::Window(width, height, fullscreen, update_interval, resizable)
|
39
|
-
{
|
40
|
-
}
|
41
|
-
|
42
|
-
void Gosu::WindowForWrapper::update()
|
43
|
-
{
|
44
|
-
if (update_callback != nullptr) {
|
45
|
-
update_callback();
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
void Gosu::WindowForWrapper::draw()
|
50
|
-
{
|
51
|
-
if (draw_callback != nullptr) {
|
52
|
-
draw_callback();
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
void Gosu::WindowForWrapper::default_button_down(unsigned btn)
|
57
|
-
{
|
58
|
-
Gosu::Window::button_down(Gosu::Button(btn));
|
59
|
-
}
|
60
|
-
|
61
|
-
void Gosu::WindowForWrapper::button_down(Gosu::Button btn)
|
62
|
-
{
|
63
|
-
if (button_down_callback != nullptr) {
|
64
|
-
button_down_callback(btn);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
void Gosu::WindowForWrapper::button_up(Gosu::Button btn)
|
69
|
-
{
|
70
|
-
if (button_up_callback != nullptr) {
|
71
|
-
button_up_callback(btn);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
void Gosu::WindowForWrapper::gamepad_connected(int id)
|
76
|
-
{
|
77
|
-
if (gamepad_connected_callback != nullptr) {
|
78
|
-
gamepad_connected_callback(id);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
void Gosu::WindowForWrapper::gamepad_disconnected(int id)
|
83
|
-
{
|
84
|
-
if (gamepad_disconnected_callback != nullptr) {
|
85
|
-
gamepad_disconnected_callback(id);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
void Gosu::WindowForWrapper::drop(const std::string &filename)
|
90
|
-
{
|
91
|
-
if (drop_callback != nullptr) {
|
92
|
-
drop_callback(filename.c_str());
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
bool Gosu::WindowForWrapper::needs_redraw() const
|
97
|
-
{
|
98
|
-
if (needs_redraw_callback != nullptr) {
|
99
|
-
return needs_redraw_callback();
|
100
|
-
}
|
101
|
-
else {
|
102
|
-
return true;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
bool Gosu::WindowForWrapper::needs_cursor() const
|
107
|
-
{
|
108
|
-
if (needs_cursor_callback != nullptr) {
|
109
|
-
return needs_cursor_callback();
|
110
|
-
}
|
111
|
-
else {
|
112
|
-
return false;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
void Gosu::WindowForWrapper::close()
|
117
|
-
{
|
118
|
-
if (close_callback != nullptr) {
|
119
|
-
close_callback();
|
120
|
-
}
|
121
|
-
else {
|
122
|
-
Gosu::Window::close();
|
123
|
-
}
|
124
|
-
}
|
125
|
-
|
126
|
-
void Gosu::WindowForWrapper::close_immediately()
|
127
|
-
{
|
128
|
-
Gosu::Window::close();
|
129
|
-
}
|
130
|
-
|
131
|
-
extern "C" {
|
132
|
-
#include <Gosu/Window.h>
|
133
|
-
#include <Gosu/TextInput.h>
|
134
|
-
|
135
|
-
// Constructor
|
136
|
-
Gosu_Window *Gosu_Window_create(int width, int height, bool fullscreen, double update_interval, bool resizable)
|
137
|
-
{
|
138
|
-
return reinterpret_cast<Gosu_Window *>(new Gosu::WindowForWrapper(width, height, fullscreen, update_interval, resizable));
|
139
|
-
};
|
140
|
-
|
141
|
-
// Callbacks
|
142
|
-
void Gosu_Window_set_draw(Gosu_Window *window, void function(void *data), void *data)
|
143
|
-
{
|
144
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->draw_callback = [=]() { function(data); };
|
145
|
-
}
|
146
|
-
|
147
|
-
void Gosu_Window_set_update(Gosu_Window *window, void function(void *data), void *data)
|
148
|
-
{
|
149
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->update_callback = [=]() { function(data); };
|
150
|
-
}
|
151
|
-
|
152
|
-
void Gosu_Window_set_button_down(Gosu_Window *window, void function(void *data, unsigned btn), void *data)
|
153
|
-
{
|
154
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->button_down_callback = [=](unsigned btn) { function(data, btn); };
|
155
|
-
}
|
156
|
-
|
157
|
-
void Gosu_Window_default_button_down(Gosu_Window *window, unsigned btn)
|
158
|
-
{
|
159
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->default_button_down(btn);
|
160
|
-
}
|
161
|
-
|
162
|
-
void Gosu_Window_set_button_up(Gosu_Window *window, void function(void *data, unsigned btn), void *data)
|
163
|
-
{
|
164
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->button_up_callback = [=](unsigned btn) { function(data, btn); };
|
165
|
-
}
|
166
|
-
|
167
|
-
void Gosu_Window_set_gamepad_connected(Gosu_Window *window, void function(void *data, int id), void *data)
|
168
|
-
{
|
169
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->gamepad_connected_callback = [=](int id) { function(data, id); };
|
170
|
-
}
|
171
|
-
|
172
|
-
void Gosu_Window_set_gamepad_disconnected(Gosu_Window *window, void function(void *data, int id), void *data)
|
173
|
-
{
|
174
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->gamepad_disconnected_callback = [=](int id) { function(data, id); };
|
175
|
-
}
|
176
|
-
|
177
|
-
void Gosu_Window_set_drop(Gosu_Window *window, void function(void *data, const char *filename), void *data)
|
178
|
-
{
|
179
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->drop_callback = [=](const char *filename) { function(data, filename); };
|
180
|
-
}
|
181
|
-
|
182
|
-
void Gosu_Window_set_needs_redraw(Gosu_Window *window, bool function(void *data), void *data)
|
183
|
-
{
|
184
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->needs_redraw_callback = [=]() -> bool { return function(data); };
|
185
|
-
}
|
186
|
-
|
187
|
-
void Gosu_Window_set_needs_cursor(Gosu_Window *window, bool function(void *data), void *data)
|
188
|
-
{
|
189
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->needs_cursor_callback = [=]() -> bool { return function(data); };
|
190
|
-
}
|
191
|
-
|
192
|
-
void Gosu_Window_set_close(Gosu_Window *window, void function(void *data), void *data)
|
193
|
-
{
|
194
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->close_callback = [=]() { function(data); };
|
195
|
-
}
|
196
|
-
|
197
|
-
Gosu_TextInput *Gosu_Window_text_input(Gosu_Window *window)
|
198
|
-
{
|
199
|
-
Gosu::Window *gosu_window = reinterpret_cast<Gosu::WindowForWrapper *>(window);
|
200
|
-
return reinterpret_cast<Gosu_TextInput *>(gosu_window->input().text_input());
|
201
|
-
}
|
202
|
-
|
203
|
-
void Gosu_Window_set_text_input(Gosu_Window *window, Gosu_TextInput *text_input)
|
204
|
-
{
|
205
|
-
Gosu::Window *gosu_window = reinterpret_cast<Gosu::WindowForWrapper *>(window);
|
206
|
-
gosu_window->input().set_text_input(reinterpret_cast<Gosu::TextInput *>(text_input));
|
207
|
-
}
|
208
|
-
|
209
|
-
void Gosu_Window_show(Gosu_Window *window)
|
210
|
-
{
|
211
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->show();
|
212
|
-
}
|
213
|
-
|
214
|
-
bool Gosu_Window_tick(Gosu_Window *window)
|
215
|
-
{
|
216
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->tick();
|
217
|
-
}
|
218
|
-
|
219
|
-
void Gosu_Window_close_immediately(Gosu_Window *window)
|
220
|
-
{
|
221
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->close_immediately();
|
222
|
-
}
|
223
|
-
|
224
|
-
bool Gosu_Window_is_fullscreen(Gosu_Window *window)
|
225
|
-
{
|
226
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->fullscreen();
|
227
|
-
}
|
228
|
-
|
229
|
-
bool Gosu_Window_is_resizable(Gosu_Window *window)
|
230
|
-
{
|
231
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->resizable();
|
232
|
-
}
|
233
|
-
|
234
|
-
const char *Gosu_Window_caption(Gosu_Window *window)
|
235
|
-
{
|
236
|
-
static thread_local std::string caption;
|
237
|
-
caption = reinterpret_cast<Gosu::WindowForWrapper *>(window)->caption();
|
238
|
-
|
239
|
-
return caption.c_str();
|
240
|
-
}
|
241
|
-
|
242
|
-
void Gosu_Window_set_caption(Gosu_Window *window, const char *caption)
|
243
|
-
{
|
244
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->set_caption(caption);
|
245
|
-
}
|
246
|
-
|
247
|
-
double Gosu_Window_update_interval(Gosu_Window *window)
|
248
|
-
{
|
249
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->update_interval();
|
250
|
-
}
|
251
|
-
|
252
|
-
void Gosu_Window_set_update_interval(Gosu_Window *window, double update_interval)
|
253
|
-
{
|
254
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->set_update_interval(update_interval);
|
255
|
-
}
|
256
|
-
|
257
|
-
void Gosu_Window_set_mouse_x(Gosu_Window *window, double x)
|
258
|
-
{
|
259
|
-
Gosu::Window *gosu_window = reinterpret_cast<Gosu::WindowForWrapper *>(window);
|
260
|
-
gosu_window->input().set_mouse_position(x, gosu_window->input().mouse_x());
|
261
|
-
}
|
262
|
-
|
263
|
-
void Gosu_Window_set_mouse_y(Gosu_Window *window, double y)
|
264
|
-
{
|
265
|
-
Gosu::Window *gosu_window = reinterpret_cast<Gosu::WindowForWrapper *>(window);
|
266
|
-
gosu_window->input().set_mouse_position(gosu_window->input().mouse_x(), y);
|
267
|
-
}
|
268
|
-
|
269
|
-
double Gosu_Window_mouse_x(Gosu_Window *window)
|
270
|
-
{
|
271
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->input().mouse_x();
|
272
|
-
}
|
273
|
-
|
274
|
-
double Gosu_Window_mouse_y(Gosu_Window *window)
|
275
|
-
{
|
276
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->input().mouse_y();
|
277
|
-
}
|
278
|
-
|
279
|
-
int Gosu_Window_width(Gosu_Window *window)
|
280
|
-
{
|
281
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->width();
|
282
|
-
}
|
283
|
-
|
284
|
-
void Gosu_Window_set_width(Gosu_Window *window, int width)
|
285
|
-
{
|
286
|
-
Gosu::Window *gosu_window = reinterpret_cast<Gosu::WindowForWrapper *>(window);
|
287
|
-
gosu_window->resize(width, gosu_window->height(), gosu_window->fullscreen());
|
288
|
-
}
|
289
|
-
|
290
|
-
int Gosu_Window_height(Gosu_Window *window)
|
291
|
-
{
|
292
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->height();
|
293
|
-
}
|
294
|
-
|
295
|
-
void Gosu_Window_set_height(Gosu_Window *window, int height)
|
296
|
-
{
|
297
|
-
Gosu::Window *gosu_window = reinterpret_cast<Gosu::WindowForWrapper *>(window);
|
298
|
-
gosu_window->resize(gosu_window->width(), height, gosu_window->fullscreen());
|
299
|
-
}
|
300
|
-
|
301
|
-
void Gosu_Window_resize(Gosu_Window *window, int width, int height, bool fullscreen)
|
302
|
-
{
|
303
|
-
reinterpret_cast<Gosu::WindowForWrapper *>(window)->resize(width, height, fullscreen);
|
304
|
-
}
|
305
|
-
|
306
|
-
int Gosu_Window_is_button_down(Gosu_Window *window, unsigned btn)
|
307
|
-
{
|
308
|
-
return reinterpret_cast<Gosu::WindowForWrapper *>(window)->input().down(Gosu::Button(btn));
|
309
|
-
}
|
310
|
-
|
311
|
-
// Destructor
|
312
|
-
void Gosu_Window_destroy(Gosu_Window *window)
|
313
|
-
{
|
314
|
-
delete (reinterpret_cast<Gosu::WindowForWrapper *>(window));
|
315
|
-
}
|
316
|
-
|
317
|
-
}
|