gosu 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/RubyGosu.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ----------------------------------------------------------------------------
|
2
2
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
3
|
-
* Version 4.
|
3
|
+
* Version 4.0.2
|
4
4
|
*
|
5
5
|
* This file is not intended to be easily readable and contains a number of
|
6
6
|
* coding conventions designed to improve portability and efficiency. Do not make
|
@@ -28,7 +28,7 @@ public:
|
|
28
28
|
class SwigDirector_Window : public Gosu::Window, public Swig::Director {
|
29
29
|
|
30
30
|
public:
|
31
|
-
SwigDirector_Window(VALUE self,
|
31
|
+
SwigDirector_Window(VALUE self, int width, int height, unsigned int window_flags = Gosu::WF_WINDOWED, double update_interval = 16.666666);
|
32
32
|
virtual ~SwigDirector_Window();
|
33
33
|
virtual void show();
|
34
34
|
virtual bool tick();
|
data/src/TexChunk.cpp
CHANGED
@@ -44,7 +44,7 @@ Gosu::TexChunk::~TexChunk()
|
|
44
44
|
}
|
45
45
|
|
46
46
|
void Gosu::TexChunk::draw(double x1, double y1, Color c1, double x2, double y2, Color c2,
|
47
|
-
double x3, double y3, Color c3, double x4, double y4, Color c4, ZPos z,
|
47
|
+
double x3, double y3, Color c3, double x4, double y4, Color c4, ZPos z, BlendMode mode) const
|
48
48
|
{
|
49
49
|
DrawOp op;
|
50
50
|
op.render_state.texture = texture;
|
data/src/TexChunk.hpp
CHANGED
@@ -29,7 +29,7 @@ public:
|
|
29
29
|
double x2, double y2, Color c2,
|
30
30
|
double x3, double y3, Color c3,
|
31
31
|
double x4, double y4, Color c4,
|
32
|
-
ZPos z,
|
32
|
+
ZPos z, BlendMode mode) const override;
|
33
33
|
|
34
34
|
const GLTexInfo* gl_tex_info() const override { return &info; }
|
35
35
|
|
data/src/TrueTypeFontApple.cpp
CHANGED
@@ -24,8 +24,8 @@ const unsigned char* Gosu::ttf_data_by_name(const string& font_name, unsigned fo
|
|
24
24
|
log("Trying to find a font named '%s', flags=%x", font_name.c_str(), font_flags);
|
25
25
|
|
26
26
|
unsigned symbolic_traits = 0;
|
27
|
-
if (font_flags & Gosu::FF_BOLD) symbolic_traits |=
|
28
|
-
if (font_flags & Gosu::FF_ITALIC) symbolic_traits |=
|
27
|
+
if (font_flags & Gosu::FF_BOLD) symbolic_traits |= kCTFontTraitBold;
|
28
|
+
if (font_flags & Gosu::FF_ITALIC) symbolic_traits |= kCTFontTraitItalic;
|
29
29
|
|
30
30
|
NSDictionary *attributes = @{
|
31
31
|
((__bridge id) kCTFontNameAttribute): [NSString stringWithUTF8String:font_name.c_str()],
|
@@ -39,6 +39,14 @@ const unsigned char* Gosu::ttf_data_by_name(const string& font_name, unsigned fo
|
|
39
39
|
if (descriptor) {
|
40
40
|
CTFontRef font = CTFontCreateWithFontDescriptorAndOptions(descriptor, 20, nullptr, 0);
|
41
41
|
if (font) {
|
42
|
+
if ((CTFontGetSymbolicTraits(font) & symbolic_traits) != symbolic_traits) {
|
43
|
+
// For some reason the initial call to CTFontCreateWithFontDescriptorAndOptions does
|
44
|
+
// not respect the requested font traits. Explicitly requesting the traits again
|
45
|
+
// seems to help. Tested on macOS 11.2.2.
|
46
|
+
CTFontRef correct_font = CTFontCreateCopyWithSymbolicTraits(font, 0.0, nullptr, symbolic_traits, symbolic_traits);
|
47
|
+
CFRelease(font);
|
48
|
+
font = correct_font;
|
49
|
+
}
|
42
50
|
NSURL *url = CFBridgingRelease(CTFontCopyAttribute(font, kCTFontURLAttribute));
|
43
51
|
if (url && url.fileSystemRepresentation) {
|
44
52
|
log("Loading file '%s'", url.fileSystemRepresentation);
|
data/src/TrueTypeFontWin.cpp
CHANGED
@@ -32,9 +32,9 @@ const unsigned char* Gosu::ttf_data_by_name(const string& font_name, unsigned fo
|
|
32
32
|
LOGFONT logfont = {
|
33
33
|
0, 0, 0, 0,
|
34
34
|
(font_flags & Gosu::FF_BOLD) ? FW_BOLD : FW_NORMAL,
|
35
|
-
(font_flags & Gosu::FF_ITALIC) ? TRUE : FALSE,
|
36
|
-
(font_flags & Gosu::FF_UNDERLINE) ? TRUE : FALSE,
|
37
|
-
|
35
|
+
static_cast<BYTE>((font_flags & Gosu::FF_ITALIC) ? TRUE : FALSE),
|
36
|
+
static_cast<BYTE>((font_flags & Gosu::FF_UNDERLINE) ? TRUE : FALSE),
|
37
|
+
0 /* no strikethrough */,
|
38
38
|
ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
|
39
39
|
DEFAULT_PITCH
|
40
40
|
};
|
data/src/Utility.cpp
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#include <Gosu/Utility.hpp>
|
2
|
-
#include <Gosu/Platform.hpp>
|
3
2
|
|
3
|
+
#include <SDL.h>
|
4
4
|
#include <utf8proc.h>
|
5
5
|
|
6
6
|
#include <cstring>
|
7
|
+
#include <memory>
|
7
8
|
#include <stdexcept>
|
8
|
-
using namespace std;
|
9
9
|
|
10
|
-
u32string Gosu::utf8_to_composed_utc4(const string& utf8)
|
10
|
+
std::u32string Gosu::utf8_to_composed_utc4(const std::string& utf8)
|
11
11
|
{
|
12
|
-
u32string utc4;
|
12
|
+
std::u32string utc4;
|
13
13
|
utc4.reserve(utf8.size());
|
14
|
-
|
15
|
-
auto* current_byte = reinterpret_cast<const utf8proc_uint8_t*>(utf8.data());
|
14
|
+
|
15
|
+
const auto* current_byte = reinterpret_cast<const utf8proc_uint8_t*>(utf8.data());
|
16
16
|
auto remaining_length = utf8.length();
|
17
|
-
|
17
|
+
|
18
18
|
// First convert from UTF-8 to UTC-4.
|
19
19
|
utf8proc_int32_t codepoint;
|
20
20
|
while (remaining_length) {
|
@@ -30,35 +30,35 @@ u32string Gosu::utf8_to_composed_utc4(const string& utf8)
|
|
30
30
|
remaining_length -= bytes_read;
|
31
31
|
}
|
32
32
|
}
|
33
|
-
|
33
|
+
|
34
34
|
// Now compose characters in-place.
|
35
|
-
auto utc4_data = reinterpret_cast<
|
36
|
-
// Note that this const_cast will not be necessary anymore in C++17.
|
37
|
-
auto writable_utc4_data = const_cast<utf8proc_int32_t*>(utc4_data);
|
35
|
+
auto* utc4_data = reinterpret_cast<utf8proc_int32_t*>(utc4.data());
|
38
36
|
auto options = static_cast<utf8proc_option_t>(UTF8PROC_NLF2LF | UTF8PROC_COMPOSE);
|
39
|
-
auto new_length = utf8proc_normalize_utf32(
|
37
|
+
auto new_length = utf8proc_normalize_utf32(utc4_data, utc4.length(), options);
|
40
38
|
if (new_length < 0) {
|
41
|
-
throw runtime_error
|
39
|
+
throw std::runtime_error{"Could not normalize '" + utf8 +
|
40
|
+
"': " + utf8proc_errmsg(new_length)};
|
42
41
|
}
|
43
42
|
utc4.resize(new_length);
|
44
|
-
|
43
|
+
|
45
44
|
return utc4;
|
46
45
|
}
|
47
46
|
|
48
|
-
bool Gosu::has_extension(string_view filename, string_view extension)
|
47
|
+
bool Gosu::has_extension(std::string_view filename, std::string_view extension)
|
49
48
|
{
|
50
|
-
size_t ext_len = extension.length();
|
49
|
+
std::size_t ext_len = extension.length();
|
51
50
|
if (ext_len > filename.length()) {
|
52
51
|
return false;
|
53
52
|
}
|
54
53
|
|
55
|
-
string_view::iterator filename_iter = filename.end();
|
56
|
-
string_view::iterator ext_iter = extension.end();
|
54
|
+
std::string_view::iterator filename_iter = filename.end();
|
55
|
+
std::string_view::iterator ext_iter = extension.end();
|
57
56
|
while (ext_len--) {
|
58
57
|
--filename_iter;
|
59
58
|
--ext_iter;
|
60
59
|
|
61
|
-
if (tolower((
|
60
|
+
if (std::tolower(static_cast<int>(*filename_iter)) !=
|
61
|
+
std::tolower(static_cast<int>(*ext_iter))) {
|
62
62
|
return false;
|
63
63
|
}
|
64
64
|
}
|
@@ -66,10 +66,39 @@ bool Gosu::has_extension(string_view filename, string_view extension)
|
|
66
66
|
return true;
|
67
67
|
}
|
68
68
|
|
69
|
-
#if
|
70
|
-
string Gosu::
|
69
|
+
#if SDL_VERSION_ATLEAST(2, 0, 14)
|
70
|
+
std::vector<std::string> Gosu::user_languages()
|
71
|
+
{
|
72
|
+
std::vector<std::string> user_languages;
|
73
|
+
|
74
|
+
std::unique_ptr<SDL_Locale, decltype(SDL_free)*> locales{SDL_GetPreferredLocales(), SDL_free};
|
75
|
+
if (!locales) return user_languages;
|
76
|
+
|
77
|
+
for (const SDL_Locale* locale = locales.get(); locale->language != nullptr; ++locale) {
|
78
|
+
std::string language = locale->language;
|
79
|
+
if (locale->country) {
|
80
|
+
language += "_";
|
81
|
+
language += locale->country;
|
82
|
+
}
|
83
|
+
user_languages.emplace_back(std::move(language));
|
84
|
+
}
|
85
|
+
|
86
|
+
return user_languages;
|
87
|
+
}
|
88
|
+
#else
|
89
|
+
#include <cstdlib>
|
90
|
+
#include <regex>
|
91
|
+
|
92
|
+
std::vector<std::string> Gosu::user_languages()
|
71
93
|
{
|
72
|
-
const
|
73
|
-
|
94
|
+
static const std::regex language_regex{"[a-z]{2}_[A-Z]{2}([^A-Z].*)?"};
|
95
|
+
|
96
|
+
const char* locale = std::getenv("LANG");
|
97
|
+
|
98
|
+
if (locale && std::regex_match(locale, language_regex)) {
|
99
|
+
return {std::string{locale, locale + 5}};
|
100
|
+
}
|
101
|
+
|
102
|
+
return {};
|
74
103
|
}
|
75
104
|
#endif
|
data/src/Window.cpp
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#include <Gosu/Platform.hpp>
|
2
2
|
#if !defined(GOSU_IS_IPHONE)
|
3
3
|
|
4
|
+
#if defined(GOSU_IS_WIN)
|
5
|
+
#include <windows.h>
|
6
|
+
#endif
|
7
|
+
|
4
8
|
#include <Gosu/Gosu.hpp>
|
5
9
|
#include "GraphicsImpl.hpp"
|
6
10
|
#include <SDL.h>
|
@@ -30,11 +34,7 @@ namespace Gosu
|
|
30
34
|
throw_sdl_error("Could not initialize SDL Video");
|
31
35
|
}
|
32
36
|
|
33
|
-
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN;
|
34
|
-
|
35
|
-
#if SDL_VERSION_ATLEAST(2, 0, 1)
|
36
|
-
flags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
37
|
-
#endif
|
37
|
+
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_ALLOW_HIGHDPI;
|
38
38
|
|
39
39
|
window =
|
40
40
|
SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 64, 64, flags);
|
@@ -87,13 +87,11 @@ struct Gosu::Window::Impl
|
|
87
87
|
unique_ptr<Input> input;
|
88
88
|
};
|
89
89
|
|
90
|
-
Gosu::Window::Window(
|
91
|
-
bool resizable)
|
90
|
+
Gosu::Window::Window(int width, int height, unsigned window_flags, double update_interval)
|
92
91
|
: pimpl(new Impl)
|
93
92
|
{
|
94
|
-
|
95
|
-
|
96
|
-
#endif
|
93
|
+
set_borderless(window_flags & WF_BORDERLESS);
|
94
|
+
set_resizable(window_flags & WF_RESIZABLE);
|
97
95
|
|
98
96
|
// Even in fullscreen mode, temporarily show the window in windowed mode to centre it.
|
99
97
|
// This ensures that the window will be centered correctly when exiting fullscreen mode.
|
@@ -103,12 +101,11 @@ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double up
|
|
103
101
|
SDL_SetWindowPosition(shared_window(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
104
102
|
|
105
103
|
// Really enable fullscreen if desired.
|
106
|
-
resize(width, height,
|
104
|
+
resize(width, height, (window_flags & WF_FULLSCREEN));
|
107
105
|
|
108
106
|
SDL_GL_SetSwapInterval(1);
|
109
107
|
|
110
108
|
pimpl->update_interval = update_interval;
|
111
|
-
pimpl->resizable = resizable;
|
112
109
|
|
113
110
|
input().on_button_down = [this](Button button) { button_down(button); };
|
114
111
|
input().on_button_up = [this](Button button) { button_up(button); };
|
@@ -121,12 +118,12 @@ Gosu::Window::~Window()
|
|
121
118
|
SDL_HideWindow(shared_window());
|
122
119
|
}
|
123
120
|
|
124
|
-
|
121
|
+
int Gosu::Window::width() const
|
125
122
|
{
|
126
123
|
return graphics().width();
|
127
124
|
}
|
128
125
|
|
129
|
-
|
126
|
+
int Gosu::Window::height() const
|
130
127
|
{
|
131
128
|
return graphics().height();
|
132
129
|
}
|
@@ -136,12 +133,7 @@ bool Gosu::Window::fullscreen() const
|
|
136
133
|
return pimpl->fullscreen;
|
137
134
|
}
|
138
135
|
|
139
|
-
|
140
|
-
{
|
141
|
-
return pimpl->resizable;
|
142
|
-
}
|
143
|
-
|
144
|
-
void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
|
136
|
+
void Gosu::Window::resize(int width, int height, bool fullscreen)
|
145
137
|
{
|
146
138
|
pimpl->fullscreen = fullscreen;
|
147
139
|
|
@@ -175,8 +167,8 @@ void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
|
|
175
167
|
}
|
176
168
|
}
|
177
169
|
else {
|
178
|
-
|
179
|
-
|
170
|
+
int max_width = Gosu::available_width(this);
|
171
|
+
int max_height = Gosu::available_height(this);
|
180
172
|
|
181
173
|
if (resizable()) {
|
182
174
|
// If the window is resizable, limit its size, without preserving the aspect ratio.
|
@@ -196,9 +188,7 @@ void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
|
|
196
188
|
SDL_SetWindowSize(shared_window(), actual_width, actual_height);
|
197
189
|
}
|
198
190
|
|
199
|
-
#if SDL_VERSION_ATLEAST(2, 0, 1)
|
200
191
|
SDL_GL_GetDrawableSize(shared_window(), &actual_width, &actual_height);
|
201
|
-
#endif
|
202
192
|
|
203
193
|
ensure_current_context();
|
204
194
|
|
@@ -217,6 +207,27 @@ void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
|
|
217
207
|
black_bar_width, black_bar_height);
|
218
208
|
}
|
219
209
|
|
210
|
+
bool Gosu::Window::resizable() const
|
211
|
+
{
|
212
|
+
return pimpl->resizable;
|
213
|
+
}
|
214
|
+
|
215
|
+
void Gosu::Window::set_resizable(bool resizable)
|
216
|
+
{
|
217
|
+
pimpl->resizable = resizable;
|
218
|
+
SDL_SetWindowResizable(shared_window(), resizable ? SDL_TRUE : SDL_FALSE);
|
219
|
+
}
|
220
|
+
|
221
|
+
bool Gosu::Window::borderless() const
|
222
|
+
{
|
223
|
+
return SDL_GetWindowFlags(shared_window()) & SDL_WINDOW_BORDERLESS;
|
224
|
+
}
|
225
|
+
|
226
|
+
void Gosu::Window::set_borderless(bool borderless)
|
227
|
+
{
|
228
|
+
SDL_SetWindowBordered(shared_window(), borderless ? SDL_FALSE : SDL_TRUE);
|
229
|
+
}
|
230
|
+
|
220
231
|
double Gosu::Window::update_interval() const
|
221
232
|
{
|
222
233
|
return pimpl->update_interval;
|
@@ -242,16 +253,34 @@ void Gosu::Window::show()
|
|
242
253
|
{
|
243
254
|
unsigned long time_before_tick = milliseconds();
|
244
255
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
256
|
+
#ifdef GOSU_IS_WIN
|
257
|
+
// Try to convince Windows to only run this thread on the first core, to avoid timing glitches.
|
258
|
+
// (If we ever run into a situation where the first core is not available, we should start to
|
259
|
+
// use GetProcessAffinityMask to retrieve the allowed cores as a bitmask.)
|
260
|
+
DWORD_PTR previous_affinity = SetThreadAffinityMask(GetCurrentThread(), 1);
|
261
|
+
#endif
|
262
|
+
|
263
|
+
try {
|
264
|
+
while (tick()) {
|
265
|
+
// Sleep to keep this loop from eating 100% CPU.
|
266
|
+
unsigned long tick_time = milliseconds() - time_before_tick;
|
267
|
+
if (tick_time < update_interval()) {
|
268
|
+
sleep(update_interval() - tick_time);
|
269
|
+
}
|
251
270
|
|
252
|
-
|
271
|
+
time_before_tick = milliseconds();
|
272
|
+
}
|
273
|
+
} catch (...) {
|
274
|
+
#ifdef GOSU_IS_WIN
|
275
|
+
if (previous_affinity) SetThreadAffinityMask(GetCurrentThread(), previous_affinity);
|
276
|
+
#endif
|
277
|
+
throw;
|
253
278
|
}
|
254
279
|
|
280
|
+
#ifdef GOSU_IS_WIN
|
281
|
+
if (previous_affinity) SetThreadAffinityMask(GetCurrentThread(), previous_affinity);
|
282
|
+
#endif
|
283
|
+
|
255
284
|
pimpl->state = Impl::CLOSED;
|
256
285
|
}
|
257
286
|
|
data/src/WindowUIKit.cpp
CHANGED
@@ -17,8 +17,7 @@ struct Gosu::Window::Impl
|
|
17
17
|
string caption;
|
18
18
|
};
|
19
19
|
|
20
|
-
Gosu::Window::Window(
|
21
|
-
bool resizable)
|
20
|
+
Gosu::Window::Window(int width, int height, unsigned window_flags, double update_interval)
|
22
21
|
: pimpl(new Impl)
|
23
22
|
{
|
24
23
|
pimpl->window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
@@ -50,12 +49,12 @@ Gosu::Window::~Window()
|
|
50
49
|
{
|
51
50
|
}
|
52
51
|
|
53
|
-
|
52
|
+
int Gosu::Window::width() const
|
54
53
|
{
|
55
54
|
return graphics().width();
|
56
55
|
}
|
57
56
|
|
58
|
-
|
57
|
+
int Gosu::Window::height() const
|
59
58
|
{
|
60
59
|
return graphics().height();
|
61
60
|
}
|
@@ -70,7 +69,20 @@ bool Gosu::Window::resizable() const
|
|
70
69
|
return false;
|
71
70
|
}
|
72
71
|
|
73
|
-
void Gosu::Window::
|
72
|
+
void Gosu::Window::set_resizable(bool resizable)
|
73
|
+
{
|
74
|
+
}
|
75
|
+
|
76
|
+
bool Gosu::Window::borderless() const
|
77
|
+
{
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
|
81
|
+
void Gosu::Window::set_borderless(bool borderless)
|
82
|
+
{
|
83
|
+
}
|
84
|
+
|
85
|
+
void Gosu::Window::resize(int width, int height, bool fullscreen)
|
74
86
|
{
|
75
87
|
throw logic_error("Cannot resize windows on iOS");
|
76
88
|
}
|
@@ -138,24 +150,24 @@ void* Gosu::Window::uikit_window() const
|
|
138
150
|
return (__bridge void*) pimpl->window;
|
139
151
|
}
|
140
152
|
|
141
|
-
|
153
|
+
int Gosu::screen_width(Window*)
|
142
154
|
{
|
143
155
|
return available_width() * [UIScreen mainScreen].scale;
|
144
156
|
}
|
145
157
|
|
146
|
-
|
158
|
+
int Gosu::screen_height(Window*)
|
147
159
|
{
|
148
160
|
return available_height() * [UIScreen mainScreen].scale;
|
149
161
|
}
|
150
162
|
|
151
|
-
|
163
|
+
int Gosu::available_width(Window*)
|
152
164
|
{
|
153
165
|
static CGSize screen_size = [UIScreen mainScreen].bounds.size;
|
154
166
|
static CGFloat width = MAX(screen_size.width, screen_size.height);
|
155
167
|
return width;
|
156
168
|
}
|
157
169
|
|
158
|
-
|
170
|
+
int Gosu::available_height(Window*)
|
159
171
|
{
|
160
172
|
static CGSize screen_size = [UIScreen mainScreen].bounds.size;
|
161
173
|
static CGFloat height = MIN(screen_size.width, screen_size.height);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Raschke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
2D game development library.
|
@@ -188,34 +188,25 @@ files:
|
|
188
188
|
- include/Gosu/Audio.hpp
|
189
189
|
- include/Gosu/Bitmap.hpp
|
190
190
|
- include/Gosu/Buttons.hpp
|
191
|
-
- include/Gosu/Channel.h
|
192
|
-
- include/Gosu/Color.h
|
193
191
|
- include/Gosu/Color.hpp
|
194
192
|
- include/Gosu/Directories.hpp
|
195
|
-
- include/Gosu/Font.h
|
196
193
|
- include/Gosu/Font.hpp
|
197
194
|
- include/Gosu/Fwd.hpp
|
198
|
-
- include/Gosu/Gosu.h
|
199
195
|
- include/Gosu/Gosu.hpp
|
200
196
|
- include/Gosu/Graphics.hpp
|
201
197
|
- include/Gosu/GraphicsBase.hpp
|
202
198
|
- include/Gosu/IO.hpp
|
203
|
-
- include/Gosu/Image.h
|
204
199
|
- include/Gosu/Image.hpp
|
205
200
|
- include/Gosu/ImageData.hpp
|
206
201
|
- include/Gosu/Input.hpp
|
207
202
|
- include/Gosu/Inspection.hpp
|
208
203
|
- include/Gosu/Math.hpp
|
209
204
|
- include/Gosu/Platform.hpp
|
210
|
-
- include/Gosu/Sample.h
|
211
|
-
- include/Gosu/Song.h
|
212
205
|
- include/Gosu/Text.hpp
|
213
|
-
- include/Gosu/TextInput.h
|
214
206
|
- include/Gosu/TextInput.hpp
|
215
207
|
- include/Gosu/Timing.hpp
|
216
208
|
- include/Gosu/Utility.hpp
|
217
209
|
- include/Gosu/Version.hpp
|
218
|
-
- include/Gosu/Window.h
|
219
210
|
- include/Gosu/Window.hpp
|
220
211
|
- lib/OpenAL32.dll
|
221
212
|
- lib/SDL2.dll
|
@@ -239,11 +230,8 @@ files:
|
|
239
230
|
- src/BlockAllocator.cpp
|
240
231
|
- src/BlockAllocator.hpp
|
241
232
|
- src/Channel.cpp
|
242
|
-
- src/ChannelWrapper.cpp
|
243
233
|
- src/ClipRectStack.hpp
|
244
234
|
- src/Color.cpp
|
245
|
-
- src/ColorWrapper.cpp
|
246
|
-
- src/Constants.cpp
|
247
235
|
- src/DirectoriesApple.cpp
|
248
236
|
- src/DirectoriesUnix.cpp
|
249
237
|
- src/DirectoriesWin.cpp
|
@@ -253,25 +241,21 @@ files:
|
|
253
241
|
- src/FileUnix.cpp
|
254
242
|
- src/FileWin.cpp
|
255
243
|
- src/Font.cpp
|
256
|
-
- src/FontWrapper.cpp
|
257
244
|
- src/GosuGLView.cpp
|
258
245
|
- src/GosuGLView.hpp
|
259
246
|
- src/GosuViewController.cpp
|
260
247
|
- src/GosuViewController.hpp
|
261
|
-
- src/GosuWrapper.cpp
|
262
248
|
- src/Graphics.cpp
|
263
249
|
- src/GraphicsImpl.hpp
|
264
250
|
- src/IO.cpp
|
265
251
|
- src/Iconv.hpp
|
266
252
|
- src/Image.cpp
|
267
|
-
- src/ImageWrapper.cpp
|
268
253
|
- src/Input.cpp
|
269
254
|
- src/InputUIKit.cpp
|
270
255
|
- src/Inspection.cpp
|
271
256
|
- src/LargeImageData.cpp
|
272
257
|
- src/LargeImageData.hpp
|
273
258
|
- src/Log.hpp
|
274
|
-
- src/MPEGFile.hpp
|
275
259
|
- src/Macro.cpp
|
276
260
|
- src/Macro.hpp
|
277
261
|
- src/MarkupParser.cpp
|
@@ -283,15 +267,12 @@ files:
|
|
283
267
|
- src/Resolution.cpp
|
284
268
|
- src/RubyGosu.cxx
|
285
269
|
- src/RubyGosu.h
|
286
|
-
- src/SampleWrapper.cpp
|
287
|
-
- src/SongWrapper.cpp
|
288
270
|
- src/TexChunk.cpp
|
289
271
|
- src/TexChunk.hpp
|
290
272
|
- src/Text.cpp
|
291
273
|
- src/TextBuilder.cpp
|
292
274
|
- src/TextBuilder.hpp
|
293
275
|
- src/TextInput.cpp
|
294
|
-
- src/TextInputWrapper.cpp
|
295
276
|
- src/Texture.cpp
|
296
277
|
- src/Texture.hpp
|
297
278
|
- src/TimingApple.cpp
|
@@ -305,14 +286,11 @@ files:
|
|
305
286
|
- src/TrueTypeFontUnix.cpp
|
306
287
|
- src/TrueTypeFontWin.cpp
|
307
288
|
- src/Utility.cpp
|
308
|
-
- src/UtilityApple.cpp
|
309
|
-
- src/UtilityWin.cpp
|
310
289
|
- src/Version.cpp
|
311
290
|
- src/WinUtility.cpp
|
312
291
|
- src/WinUtility.hpp
|
313
292
|
- src/Window.cpp
|
314
293
|
- src/WindowUIKit.cpp
|
315
|
-
- src/WindowWrapper.cpp
|
316
294
|
homepage: https://www.libgosu.org/
|
317
295
|
licenses:
|
318
296
|
- MIT
|
@@ -336,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
314
|
- !ruby/object:Gem::Version
|
337
315
|
version: '0'
|
338
316
|
requirements: []
|
339
|
-
rubygems_version: 3.
|
317
|
+
rubygems_version: 3.1.4
|
340
318
|
signing_key:
|
341
319
|
specification_version: 4
|
342
320
|
summary: 2D game development library.
|