gosu 1.1.1.1 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +83 -7
- data/dependencies/SDL_sound/SDL_sound.h +4 -4
- data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
- data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
- data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
- data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
- data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
- data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
- data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
- data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
- data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
- data/dependencies/SDL_sound/dr_flac.h +618 -220
- data/dependencies/SDL_sound/dr_mp3.h +263 -94
- data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
- data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
- data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
- data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +508 -325
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4594 -0
- data/ext/gosu/extconf.rb +29 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Color.hpp +63 -107
- data/include/Gosu/Font.hpp +44 -48
- data/include/Gosu/Fwd.hpp +1 -1
- data/include/Gosu/Graphics.hpp +64 -75
- data/include/Gosu/GraphicsBase.hpp +32 -39
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +4 -16
- data/include/Gosu/Platform.hpp +1 -51
- data/include/Gosu/Text.hpp +37 -40
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +73 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +28 -37
- data/lib/gosu/swig_patches.rb +31 -3
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +9 -1
- data/src/Audio.cpp +88 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.hpp +5 -5
- data/src/Bitmap.cpp +13 -13
- data/src/BitmapIO.cpp +0 -20
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +62 -55
- data/src/EmptyImageData.hpp +16 -18
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +52 -57
- data/src/GosuViewController.cpp +2 -0
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +42 -42
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +120 -113
- data/src/LargeImageData.hpp +18 -16
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +35 -37
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +12 -7
- data/src/RubyGosu.cxx +471 -502
- data/src/RubyGosu.h +3 -2
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +58 -59
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TrueTypeFont.cpp +108 -108
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +27 -23
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Utility.cpp +82 -23
- data/src/WinUtility.hpp +2 -1
- data/src/Window.cpp +103 -86
- data/src/WindowUIKit.cpp +48 -51
- metadata +8 -20
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
data/src/Font.cpp
CHANGED
@@ -1,35 +1,31 @@
|
|
1
|
-
#include "MarkupParser.hpp"
|
2
|
-
#include "GraphicsImpl.hpp"
|
3
1
|
#include <Gosu/Font.hpp>
|
4
2
|
#include <Gosu/Graphics.hpp>
|
5
3
|
#include <Gosu/Image.hpp>
|
6
4
|
#include <Gosu/Math.hpp>
|
7
5
|
#include <Gosu/Text.hpp>
|
8
6
|
#include <Gosu/Utility.hpp>
|
9
|
-
|
10
|
-
#include
|
11
|
-
|
7
|
+
#include "GraphicsImpl.hpp"
|
8
|
+
#include "MarkupParser.hpp"
|
12
9
|
#include <array>
|
13
|
-
#include <cassert>
|
14
10
|
#include <map>
|
15
11
|
#include <stdexcept>
|
16
|
-
|
12
|
+
#include <utf8proc.h>
|
17
13
|
|
18
14
|
static const int FONT_RENDER_SCALE = 2;
|
19
15
|
|
20
|
-
struct Gosu::Font::Impl
|
16
|
+
struct Gosu::Font::Impl : Gosu::Noncopyable
|
21
17
|
{
|
22
|
-
string name;
|
18
|
+
std::string name;
|
23
19
|
int height;
|
24
20
|
unsigned base_flags;
|
25
21
|
|
26
22
|
// The most common characters are stored directly in an array for maximum performance.
|
27
23
|
// (This is the start of the Basic Multilingual Plane, up until the part where right-to-left
|
28
24
|
// languages begin, which don't really work with Gosu yet.)
|
29
|
-
array<array<Image, 0x58f>, FF_COMBINATIONS> fast_glyphs;
|
25
|
+
std::array<std::array<Image, 0x58f>, FF_COMBINATIONS> fast_glyphs;
|
30
26
|
// Everything else is looked up through a map...
|
31
|
-
array<map<utf8proc_int32_t, Image>, FF_COMBINATIONS> other_glyphs;
|
32
|
-
|
27
|
+
std::array<std::map<utf8proc_int32_t, Image>, FF_COMBINATIONS> other_glyphs;
|
28
|
+
|
33
29
|
Image& image(char32_t codepoint, unsigned font_flags)
|
34
30
|
{
|
35
31
|
Image* image;
|
@@ -39,98 +35,97 @@ struct Gosu::Font::Impl
|
|
39
35
|
else {
|
40
36
|
image = &other_glyphs[font_flags][codepoint];
|
41
37
|
}
|
42
|
-
|
38
|
+
|
43
39
|
// If this codepoint has not been rendered before, do it now.
|
44
40
|
if (image->width() == 0 && image->height() == 0) {
|
45
41
|
auto scaled_height = height * FONT_RENDER_SCALE;
|
46
|
-
|
47
|
-
u32string string(1, codepoint);
|
42
|
+
|
43
|
+
std::u32string string(1, codepoint);
|
48
44
|
Bitmap bitmap(scaled_height, scaled_height);
|
49
|
-
auto required_width = ceil(Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string,
|
50
|
-
|
45
|
+
auto required_width = ceil(Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string, name,
|
46
|
+
scaled_height, font_flags));
|
51
47
|
if (required_width > bitmap.width()) {
|
52
48
|
// If the character was wider than high, we need to render it again.
|
53
49
|
Bitmap(required_width, scaled_height).swap(bitmap);
|
54
|
-
Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string,
|
55
|
-
|
50
|
+
Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string, name, scaled_height,
|
51
|
+
font_flags);
|
56
52
|
}
|
57
|
-
|
53
|
+
|
58
54
|
*image = Image(bitmap, 0, 0, required_width, scaled_height);
|
59
55
|
}
|
60
|
-
|
56
|
+
|
61
57
|
return *image;
|
62
58
|
}
|
63
59
|
};
|
64
60
|
|
65
|
-
Gosu::Font::Font(int font_height, const string& font_name, unsigned font_flags)
|
66
|
-
:
|
61
|
+
Gosu::Font::Font(int font_height, const std::string& font_name, unsigned font_flags)
|
62
|
+
: m_impl{new Impl}
|
67
63
|
{
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
m_impl->name = font_name;
|
65
|
+
m_impl->height = font_height;
|
66
|
+
m_impl->base_flags = font_flags;
|
71
67
|
}
|
72
68
|
|
73
|
-
const string& Gosu::Font::name() const
|
69
|
+
const std::string& Gosu::Font::name() const
|
74
70
|
{
|
75
|
-
return
|
71
|
+
return m_impl->name;
|
76
72
|
}
|
77
73
|
|
78
74
|
int Gosu::Font::height() const
|
79
75
|
{
|
80
|
-
return
|
76
|
+
return m_impl->height;
|
81
77
|
}
|
82
78
|
|
83
79
|
unsigned Gosu::Font::flags() const
|
84
80
|
{
|
85
|
-
return
|
81
|
+
return m_impl->base_flags;
|
86
82
|
}
|
87
83
|
|
88
|
-
double Gosu::Font::text_width(const string& text) const
|
84
|
+
double Gosu::Font::text_width(const std::string& text) const
|
89
85
|
{
|
90
86
|
return markup_width(escape_markup(text));
|
91
87
|
}
|
92
88
|
|
93
|
-
double Gosu::Font::markup_width(const string& markup) const
|
89
|
+
double Gosu::Font::markup_width(const std::string& markup) const
|
94
90
|
{
|
95
91
|
double width = 0;
|
96
92
|
|
97
93
|
// Split the text into lines (split_words = false) because Font doesn't implement word-wrapping.
|
98
|
-
MarkupParser parser(
|
94
|
+
MarkupParser parser(m_impl->base_flags, false, [&](std::vector<FormattedString>&& line) {
|
99
95
|
double line_width = 0;
|
100
96
|
for (auto& part : line) {
|
101
97
|
for (auto codepoint : part.text) {
|
102
|
-
auto& image =
|
98
|
+
auto& image = m_impl->image(codepoint, part.flags);
|
103
99
|
double image_scale = 1.0 * height() / image.height();
|
104
100
|
line_width += image_scale * image.width();
|
105
101
|
}
|
106
102
|
}
|
107
|
-
width = max(width, line_width);
|
103
|
+
width = std::max(width, line_width);
|
108
104
|
});
|
109
105
|
parser.parse(markup);
|
110
|
-
|
106
|
+
|
111
107
|
return width;
|
112
108
|
}
|
113
109
|
|
114
|
-
void Gosu::Font::draw_text(const string& text, double x, double y, ZPos z,
|
115
|
-
double scale_x, double scale_y, Color c,
|
110
|
+
void Gosu::Font::draw_text(const std::string& text, double x, double y, ZPos z, //
|
111
|
+
double scale_x, double scale_y, Color c, BlendMode mode) const
|
116
112
|
{
|
117
113
|
draw_markup(escape_markup(text), x, y, z, scale_x, scale_y, c, mode);
|
118
114
|
}
|
119
115
|
|
120
|
-
void Gosu::Font::draw_markup(const string& markup, double x, double y, ZPos z,
|
121
|
-
double scale_x, double scale_y, Color c,
|
116
|
+
void Gosu::Font::draw_markup(const std::string& markup, double x, double y, ZPos z, //
|
117
|
+
double scale_x, double scale_y, Color c, BlendMode mode) const
|
122
118
|
{
|
123
119
|
double current_y = y;
|
124
|
-
|
120
|
+
|
125
121
|
// Split the text into lines (split_words = false) because Font doesn't implement word-wrapping.
|
126
|
-
MarkupParser parser(
|
122
|
+
MarkupParser parser(m_impl->base_flags, false, [&](std::vector<FormattedString>&& line) {
|
127
123
|
double current_x = x;
|
128
124
|
for (auto& part : line) {
|
129
125
|
for (auto codepoint : part.text) {
|
130
|
-
auto& image =
|
126
|
+
auto& image = m_impl->image(codepoint, part.flags);
|
131
127
|
double image_scale = 1.0 * height() / image.height();
|
132
|
-
image.draw(current_x, current_y, z,
|
133
|
-
image_scale * scale_x, image_scale * scale_y,
|
128
|
+
image.draw(current_x, current_y, z, image_scale * scale_x, image_scale * scale_y,
|
134
129
|
multiply(c, part.color), mode);
|
135
130
|
current_x += image_scale * scale_x * image.width();
|
136
131
|
}
|
@@ -140,23 +135,23 @@ void Gosu::Font::draw_markup(const string& markup, double x, double y, ZPos z,
|
|
140
135
|
parser.parse(markup);
|
141
136
|
}
|
142
137
|
|
143
|
-
void Gosu::Font::draw_text_rel(const string& text, double x, double y, ZPos z,
|
144
|
-
double rel_x, double rel_y, double scale_x, double scale_y,
|
145
|
-
Color c,
|
138
|
+
void Gosu::Font::draw_text_rel(const std::string& text, double x, double y, ZPos z, //
|
139
|
+
double rel_x, double rel_y, double scale_x, double scale_y, //
|
140
|
+
Color c, BlendMode mode) const
|
146
141
|
{
|
147
142
|
if (rel_x) x -= text_width(text) * scale_x * rel_x;
|
148
143
|
if (rel_y) y -= height() * scale_y * rel_y;
|
149
|
-
|
144
|
+
|
150
145
|
draw_text(text, x, y, z, scale_x, scale_y, c, mode);
|
151
146
|
}
|
152
147
|
|
153
|
-
void Gosu::Font::draw_markup_rel(const string& markup, double x, double y, ZPos z,
|
148
|
+
void Gosu::Font::draw_markup_rel(const std::string& markup, double x, double y, ZPos z, //
|
154
149
|
double rel_x, double rel_y, double scale_x, double scale_y,
|
155
|
-
Color c,
|
150
|
+
Color c, BlendMode mode) const
|
156
151
|
{
|
157
152
|
if (rel_x) x -= markup_width(markup) * scale_x * rel_x;
|
158
153
|
if (rel_y) y -= height() * scale_y * rel_y;
|
159
|
-
|
154
|
+
|
160
155
|
draw_markup(markup, x, y, z, scale_x, scale_y, c, mode);
|
161
156
|
}
|
162
157
|
|
@@ -164,14 +159,14 @@ void Gosu::Font::set_image(std::string codepoint, unsigned font_flags, const Gos
|
|
164
159
|
{
|
165
160
|
auto utc4 = utf8_to_composed_utc4(codepoint);
|
166
161
|
if (utc4.length() != 1) {
|
167
|
-
throw invalid_argument
|
162
|
+
throw std::invalid_argument{"Could not compose '" + codepoint + "' into single codepoint"};
|
168
163
|
}
|
169
|
-
|
170
|
-
if (utc4[0] <
|
171
|
-
|
164
|
+
|
165
|
+
if (utc4[0] < m_impl->fast_glyphs[font_flags].size()) {
|
166
|
+
m_impl->fast_glyphs[font_flags][utc4[0]] = image;
|
172
167
|
}
|
173
168
|
else {
|
174
|
-
|
169
|
+
m_impl->other_glyphs[font_flags][utc4[0]] = image;
|
175
170
|
}
|
176
171
|
}
|
177
172
|
|
data/src/GosuViewController.cpp
CHANGED
@@ -121,6 +121,8 @@ static void handle_audio_interruption(void* unused, UInt32 inInterruptionState)
|
|
121
121
|
- (void)applicationWillEnterForeground:(NSNotification*)notification
|
122
122
|
{
|
123
123
|
[self setupTimerOrDisplayLink];
|
124
|
+
|
125
|
+
self.gosuWindowReference.gain_focus();
|
124
126
|
}
|
125
127
|
|
126
128
|
- (void)applicationDidEnterBackground:(NSNotification*)notification
|