gosu 1.4.6 → 2.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/COPYING +2 -1
  3. data/dependencies/SDL/include/SDL_atomic.h +2 -3
  4. data/dependencies/SDL/include/SDL_audio.h +7 -7
  5. data/dependencies/SDL/include/SDL_blendmode.h +1 -1
  6. data/dependencies/SDL/include/SDL_endian.h +3 -3
  7. data/dependencies/SDL/include/SDL_gamecontroller.h +4 -4
  8. data/dependencies/SDL/include/SDL_hints.h +72 -28
  9. data/dependencies/SDL/include/SDL_joystick.h +8 -5
  10. data/dependencies/SDL/include/SDL_keycode.h +1 -1
  11. data/dependencies/SDL/include/SDL_main.h +7 -0
  12. data/dependencies/SDL/include/SDL_mouse.h +6 -7
  13. data/dependencies/SDL/include/SDL_mutex.h +79 -5
  14. data/dependencies/SDL/include/SDL_opengl_glext.h +5 -1
  15. data/dependencies/SDL/include/SDL_power.h +7 -8
  16. data/dependencies/SDL/include/SDL_render.h +5 -0
  17. data/dependencies/SDL/include/SDL_revision.h +2 -2
  18. data/dependencies/SDL/include/SDL_sensor.h +1 -1
  19. data/dependencies/SDL/include/SDL_stdinc.h +19 -11
  20. data/dependencies/SDL/include/SDL_thread.h +2 -2
  21. data/dependencies/SDL/include/SDL_version.h +2 -2
  22. data/dependencies/SDL/include/SDL_video.h +30 -2
  23. data/dependencies/SDL/include/begin_code.h +7 -7
  24. data/dependencies/SDL/include/close_code.h +2 -2
  25. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  26. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  27. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  28. data/dependencies/SDL_sound/dr_flac.h +48 -23
  29. data/dependencies/SDL_sound/dr_mp3.h +34 -14
  30. data/dependencies/SDL_sound/stb_vorbis.h +3 -2
  31. data/dependencies/mojoAL/mojoal.c +1 -1
  32. data/ext/{gosu → gosu-ffi}/extconf.rb +34 -33
  33. data/ext/gosu-ffi/gosu-ffi.def +464 -0
  34. data/ffi/Gosu.cpp +307 -0
  35. data/ffi/Gosu.h +84 -0
  36. data/ffi/Gosu_Channel.cpp +62 -0
  37. data/ffi/Gosu_Channel.h +17 -0
  38. data/ffi/Gosu_Color.cpp +132 -0
  39. data/ffi/Gosu_Color.h +31 -0
  40. data/ffi/Gosu_Constants.cpp +334 -0
  41. data/ffi/Gosu_FFI.h +34 -0
  42. data/ffi/Gosu_FFI_internal.h +161 -0
  43. data/ffi/Gosu_Font.cpp +92 -0
  44. data/ffi/Gosu_Font.h +32 -0
  45. data/ffi/Gosu_Image.cpp +206 -0
  46. data/ffi/Gosu_Image.h +60 -0
  47. data/ffi/Gosu_Sample.cpp +29 -0
  48. data/ffi/Gosu_Sample.h +14 -0
  49. data/ffi/Gosu_Song.cpp +69 -0
  50. data/ffi/Gosu_Song.h +18 -0
  51. data/ffi/Gosu_TextInput.cpp +94 -0
  52. data/ffi/Gosu_TextInput.h +25 -0
  53. data/ffi/Gosu_Window.cpp +314 -0
  54. data/ffi/Gosu_Window.h +78 -0
  55. data/include/Gosu/Audio.hpp +6 -11
  56. data/include/Gosu/Bitmap.hpp +38 -53
  57. data/include/Gosu/Buffer.hpp +54 -0
  58. data/include/Gosu/Color.hpp +27 -35
  59. data/include/Gosu/Directories.hpp +25 -28
  60. data/include/Gosu/Drawable.hpp +58 -0
  61. data/include/Gosu/Font.hpp +6 -5
  62. data/include/Gosu/Fwd.hpp +4 -6
  63. data/include/Gosu/Gosu.hpp +5 -5
  64. data/include/Gosu/Graphics.hpp +51 -61
  65. data/include/Gosu/GraphicsBase.hpp +1 -11
  66. data/include/Gosu/Image.hpp +11 -14
  67. data/include/Gosu/Math.hpp +50 -72
  68. data/include/Gosu/Transform.hpp +32 -0
  69. data/include/Gosu/Utility.hpp +51 -1
  70. data/include/Gosu/Version.hpp +3 -3
  71. data/include/Gosu/Window.hpp +15 -9
  72. data/lib/SDL2.dll +0 -0
  73. data/lib/gosu/channel.rb +49 -0
  74. data/lib/gosu/color.rb +150 -0
  75. data/lib/gosu/compat.rb +29 -8
  76. data/lib/gosu/constants.rb +386 -0
  77. data/lib/gosu/ffi.rb +258 -0
  78. data/lib/gosu/font.rb +56 -0
  79. data/lib/gosu/gl_tex_info.rb +33 -0
  80. data/lib/gosu/gosu.rb +210 -0
  81. data/lib/gosu/image.rb +141 -0
  82. data/lib/gosu/numeric.rb +17 -0
  83. data/lib/gosu/preview.rb +6 -6
  84. data/lib/gosu/sample.rb +24 -0
  85. data/lib/gosu/song.rb +56 -0
  86. data/lib/gosu/text_input.rb +69 -0
  87. data/lib/gosu/window.rb +228 -0
  88. data/lib/gosu.rb +29 -8
  89. data/lib64/SDL2.dll +0 -0
  90. data/rdoc/gosu.rb +0 -2
  91. data/src/Audio.cpp +12 -12
  92. data/src/AudioFile.hpp +5 -4
  93. data/src/AudioFileAudioToolbox.cpp +8 -8
  94. data/src/AudioFileSDLSound.cpp +7 -10
  95. data/src/BinPacker.cpp +187 -0
  96. data/src/BinPacker.hpp +55 -0
  97. data/src/Bitmap.cpp +166 -144
  98. data/src/BitmapIO.cpp +60 -86
  99. data/src/Buffer.cpp +159 -0
  100. data/src/Color.cpp +75 -80
  101. data/src/Directories.cpp +47 -0
  102. data/src/DirectoriesUIKit.cpp +50 -0
  103. data/src/DrawOp.hpp +9 -4
  104. data/src/DrawOpQueue.hpp +2 -2
  105. data/src/Drawable.cpp +95 -0
  106. data/src/EmptyDrawable.hpp +38 -0
  107. data/src/FPS.cpp +31 -0
  108. data/src/Font.cpp +104 -74
  109. data/src/GosuGLView.cpp +14 -6
  110. data/src/GosuViewController.cpp +2 -10
  111. data/src/Graphics.cpp +60 -126
  112. data/src/GraphicsImpl.hpp +17 -47
  113. data/src/Image.cpp +41 -35
  114. data/src/Input.cpp +7 -8
  115. data/src/Macro.cpp +6 -6
  116. data/src/Macro.hpp +4 -4
  117. data/src/MarkupParser.cpp +5 -5
  118. data/src/Math.cpp +35 -22
  119. data/src/OffScreenTarget.cpp +53 -49
  120. data/src/OffScreenTarget.hpp +13 -11
  121. data/src/OpenGLContext.cpp +117 -0
  122. data/src/OpenGLContext.hpp +41 -0
  123. data/src/RenderState.hpp +21 -19
  124. data/src/Resolution.cpp +23 -21
  125. data/src/TexChunk.cpp +35 -80
  126. data/src/TexChunk.hpp +44 -35
  127. data/src/Text.cpp +1 -1
  128. data/src/TextBuilder.cpp +35 -21
  129. data/src/TextBuilder.hpp +6 -9
  130. data/src/Texture.cpp +62 -80
  131. data/src/Texture.hpp +25 -23
  132. data/src/TiledDrawable.cpp +150 -0
  133. data/src/TiledDrawable.hpp +47 -0
  134. data/src/TimingApple.cpp +1 -1
  135. data/src/Transform.cpp +45 -50
  136. data/src/TransformStack.hpp +16 -16
  137. data/src/TrueTypeFont.cpp +59 -51
  138. data/src/TrueTypeFont.hpp +6 -7
  139. data/src/TrueTypeFontApple.cpp +28 -19
  140. data/src/TrueTypeFontUnix.cpp +27 -23
  141. data/src/TrueTypeFontWin.cpp +30 -30
  142. data/src/Utility.cpp +84 -21
  143. data/src/UtilityWin.cpp +45 -0
  144. data/src/Window.cpp +92 -142
  145. data/src/WindowUIKit.cpp +14 -14
  146. metadata +72 -31
  147. data/include/Gosu/IO.hpp +0 -254
  148. data/include/Gosu/ImageData.hpp +0 -53
  149. data/include/Gosu/Inspection.hpp +0 -7
  150. data/lib/gosu/patches.rb +0 -66
  151. data/lib/gosu/run.rb +0 -20
  152. data/lib/gosu/swig_patches.rb +0 -110
  153. data/src/BlockAllocator.cpp +0 -131
  154. data/src/BlockAllocator.hpp +0 -32
  155. data/src/DirectoriesApple.cpp +0 -69
  156. data/src/DirectoriesUnix.cpp +0 -46
  157. data/src/DirectoriesWin.cpp +0 -65
  158. data/src/EmptyImageData.hpp +0 -52
  159. data/src/FileUnix.cpp +0 -99
  160. data/src/FileWin.cpp +0 -88
  161. data/src/IO.cpp +0 -60
  162. data/src/Iconv.hpp +0 -51
  163. data/src/Inspection.cpp +0 -27
  164. data/src/LargeImageData.cpp +0 -215
  165. data/src/LargeImageData.hpp +0 -39
  166. data/src/Log.hpp +0 -19
  167. data/src/RubyGosu.cxx +0 -13100
  168. data/src/RubyGosu.h +0 -49
  169. data/src/WinUtility.cpp +0 -61
  170. data/src/WinUtility.hpp +0 -27
data/src/Font.cpp CHANGED
@@ -1,74 +1,94 @@
1
1
  #include <Gosu/Font.hpp>
2
- #include <Gosu/Graphics.hpp>
3
2
  #include <Gosu/Image.hpp>
4
- #include <Gosu/Math.hpp>
5
3
  #include <Gosu/Text.hpp>
6
4
  #include <Gosu/Utility.hpp>
7
5
  #include "GraphicsImpl.hpp"
8
6
  #include "MarkupParser.hpp"
9
- #include <array>
10
- #include <map>
7
+ #include <cmath> // for std::ceil
8
+ #include <mutex>
11
9
  #include <stdexcept>
12
- #include <utf8proc.h>
13
-
14
- static const int FONT_RENDER_SCALE = 2;
10
+ #include <unordered_map>
15
11
 
16
12
  struct Gosu::Font::Impl : private Gosu::Noncopyable
17
13
  {
18
- std::string name;
19
- int height;
20
- unsigned base_flags;
21
- unsigned image_flags;
22
-
23
- // The most common characters are stored directly in an array for maximum performance.
24
- // (This is the start of the Basic Multilingual Plane, up until the part where right-to-left
25
- // languages begin, which don't really work with Gosu yet.)
26
- std::array<std::array<Image, 0x58f>, FF_COMBINATIONS> fast_glyphs;
27
- // Everything else is looked up through a map...
28
- std::array<std::map<utf8proc_int32_t, Image>, FF_COMBINATIONS> other_glyphs;
29
-
30
- Image& image(char32_t codepoint, unsigned font_flags)
14
+ const int height;
15
+ const std::string name;
16
+ const unsigned base_flags;
17
+ const unsigned image_flags;
18
+
19
+ Impl(int height, std::string_view name, unsigned base_flags, unsigned image_flags)
20
+ : height(height),
21
+ name(name),
22
+ base_flags(base_flags),
23
+ image_flags(image_flags)
31
24
  {
32
- Image* image;
33
- if (codepoint < fast_glyphs[font_flags].size()) {
34
- image = &fast_glyphs[font_flags][codepoint];
25
+ }
26
+
27
+ struct GlyphKey
28
+ {
29
+ char32_t codepoint;
30
+ unsigned font_flags;
31
+ bool operator==(const GlyphKey&) const = default;
32
+ };
33
+
34
+ struct GlyphKeyHasher
35
+ {
36
+ std::size_t operator()(const GlyphKey& key) const noexcept
37
+ {
38
+ // The highest legal Unicode code point is 0x10FFFF, which is a 21-bit value, so we do
39
+ // not have to worry about overwriting any of the higher bits.
40
+ // This only works if unordered_map uses prime table sizes (which it should):
41
+ // https://www.reddit.com/r/cpp_questions/comments/us3nyb/comment/i937ulb/
42
+ return key.codepoint | (key.font_flags << 24);
35
43
  }
36
- else {
37
- image = &other_glyphs[font_flags][codepoint];
44
+ };
45
+
46
+ // Font implements copying through its shared_ptr, not by making a true copy. However, Fonts are
47
+ // not immutable: Glyphs are created and cashed on demand, and set_image() enables modifications
48
+ // to the shared data of a font. Having multiple references to the same object, but not being
49
+ // able to use it from two threads, seems counterintuitive, so introduce a mutex here, even
50
+ // though most Gosu games/programs will never really require it.
51
+ // (Could be a shared_mutex, but doesn't seem to be worth the trouble.)
52
+ std::mutex glyphs_mutex;
53
+ std::unordered_map<GlyphKey, Image, GlyphKeyHasher> glyphs;
54
+
55
+ const Image& image(char32_t codepoint, unsigned font_flags)
56
+ {
57
+ const GlyphKey key { codepoint, font_flags };
58
+ if (const auto iterator = glyphs.find(key); iterator != glyphs.end()) {
59
+ return iterator->second;
38
60
  }
39
61
 
40
62
  // If this codepoint has not been rendered before, do it now.
41
- if (image->width() == 0 && image->height() == 0) {
42
- auto scaled_height = height * FONT_RENDER_SCALE;
43
- // Optimization: Don't render higher-resolution versions if we use
44
- // next neighbor interpolation anyway.
45
- if (image_flags & IF_RETRO) scaled_height = height;
46
-
47
- std::u32string string(1, codepoint);
48
- Bitmap bitmap(scaled_height, scaled_height);
49
- auto required_width = ceil(Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string, name,
50
- scaled_height, font_flags));
51
- if (required_width > bitmap.width()) {
52
- // If the character was wider than high, we need to render it again.
53
- Bitmap(required_width, scaled_height).swap(bitmap);
54
- Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string, name, scaled_height,
55
- font_flags);
56
- }
63
+ // By default, render each glyph at 200% its size so that we have some wiggle room for
64
+ // changing the font size dynamically without it appearing too blurry.
65
+ auto scaled_height = height * 2;
66
+ // Optimization: Don't render higher-resolution versions if we use
67
+ // next neighbor interpolation anyway.
68
+ if (image_flags & IF_RETRO) {
69
+ scaled_height = height;
70
+ }
57
71
 
58
- *image = Image(bitmap, 0, 0, required_width, scaled_height, image_flags);
72
+ std::u32string string(1, codepoint);
73
+ Bitmap bitmap(scaled_height, scaled_height);
74
+ const int required_width = static_cast<int>(std::ceil(
75
+ Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string, name, scaled_height, font_flags)));
76
+ if (required_width > bitmap.width()) {
77
+ // If the character was wider than high, we need to render it again.
78
+ Bitmap resized_bitmap(required_width, scaled_height);
79
+ std::swap(resized_bitmap, bitmap);
80
+ Gosu::draw_text(bitmap, 0, 0, Color::WHITE, string, name, scaled_height, font_flags);
59
81
  }
82
+ const Rect source_rect { 0, 0, required_width, bitmap.height() };
60
83
 
61
- return *image;
84
+ return glyphs[key] = Image(bitmap, source_rect, image_flags);
62
85
  }
63
86
  };
64
87
 
65
- Gosu::Font::Font(int font_height, const std::string& font_name, unsigned font_flags, unsigned image_flags)
66
- : m_impl{new Impl}
88
+ Gosu::Font::Font(int font_height, std::string_view font_name, unsigned font_flags,
89
+ unsigned image_flags)
90
+ : m_impl(new Impl(font_height, font_name, font_flags, image_flags))
67
91
  {
68
- m_impl->name = font_name;
69
- m_impl->height = font_height;
70
- m_impl->base_flags = font_flags;
71
- m_impl->image_flags = image_flags;
72
92
  }
73
93
 
74
94
  const std::string& Gosu::Font::name() const
@@ -98,15 +118,17 @@ double Gosu::Font::text_width(const std::string& text) const
98
118
 
99
119
  double Gosu::Font::markup_width(const std::string& markup) const
100
120
  {
121
+ const std::unique_lock lock(m_impl->glyphs_mutex);
122
+
101
123
  double width = 0;
102
124
 
103
125
  // Split the text into lines (split_words = false) because Font doesn't implement word-wrapping.
104
- MarkupParser parser(m_impl->base_flags, false, [&](std::vector<FormattedString>&& line) {
126
+ MarkupParser parser(m_impl->base_flags, false, [&](const std::vector<FormattedString>& line) {
105
127
  double line_width = 0;
106
- for (auto& part : line) {
107
- for (auto codepoint : part.text) {
108
- auto& image = m_impl->image(codepoint, part.flags);
109
- double image_scale = 1.0 * height() / image.height();
128
+ for (const auto& part : line) {
129
+ for (const auto codepoint : part.text) {
130
+ const auto& image = m_impl->image(codepoint, part.flags);
131
+ double image_scale = image.height() ? 1.0 * height() / image.height() : 1.0;
110
132
  line_width += image_scale * image.width();
111
133
  }
112
134
  }
@@ -126,15 +148,17 @@ void Gosu::Font::draw_text(const std::string& text, double x, double y, ZPos z,
126
148
  void Gosu::Font::draw_markup(const std::string& markup, double x, double y, ZPos z, //
127
149
  double scale_x, double scale_y, Color c, BlendMode mode) const
128
150
  {
151
+ const std::unique_lock lock(m_impl->glyphs_mutex);
152
+
129
153
  double current_y = y;
130
154
 
131
155
  // Split the text into lines (split_words = false) because Font doesn't implement word-wrapping.
132
- MarkupParser parser(m_impl->base_flags, false, [&](std::vector<FormattedString>&& line) {
156
+ MarkupParser parser(m_impl->base_flags, false, [&](const std::vector<FormattedString>& line) {
133
157
  double current_x = x;
134
- for (auto& part : line) {
135
- for (auto codepoint : part.text) {
136
- auto& image = m_impl->image(codepoint, part.flags);
137
- double image_scale = 1.0 * height() / image.height();
158
+ for (const auto& part : line) {
159
+ for (const auto codepoint : part.text) {
160
+ const auto& image = m_impl->image(codepoint, part.flags);
161
+ double image_scale = image.height() ? 1.0 * height() / image.height() : 1.0;
138
162
  image.draw(current_x, current_y, z, image_scale * scale_x, image_scale * scale_y,
139
163
  multiply(c, part.color), mode);
140
164
  current_x += image_scale * scale_x * image.width();
@@ -145,12 +169,16 @@ void Gosu::Font::draw_markup(const std::string& markup, double x, double y, ZPos
145
169
  parser.parse(markup);
146
170
  }
147
171
 
148
- void Gosu::Font::draw_text_rel(const std::string& text, double x, double y, ZPos z, //
172
+ void Gosu::Font::draw_text_rel(const std::string& text, double x, double y, ZPos z, //
149
173
  double rel_x, double rel_y, double scale_x, double scale_y, //
150
174
  Color c, BlendMode mode) const
151
175
  {
152
- if (rel_x) x -= text_width(text) * scale_x * rel_x;
153
- if (rel_y) y -= height() * scale_y * rel_y;
176
+ if (rel_x != 0) {
177
+ x -= text_width(text) * scale_x * rel_x;
178
+ }
179
+ if (rel_y != 0) {
180
+ y -= height() * scale_y * rel_y;
181
+ }
154
182
 
155
183
  draw_text(text, x, y, z, scale_x, scale_y, c, mode);
156
184
  }
@@ -159,28 +187,30 @@ void Gosu::Font::draw_markup_rel(const std::string& markup, double x, double y,
159
187
  double rel_x, double rel_y, double scale_x, double scale_y,
160
188
  Color c, BlendMode mode) const
161
189
  {
162
- if (rel_x) x -= markup_width(markup) * scale_x * rel_x;
163
- if (rel_y) y -= height() * scale_y * rel_y;
190
+ if (rel_x != 0) {
191
+ x -= markup_width(markup) * scale_x * rel_x;
192
+ }
193
+ if (rel_y != 0) {
194
+ y -= height() * scale_y * rel_y;
195
+ }
164
196
 
165
197
  draw_markup(markup, x, y, z, scale_x, scale_y, c, mode);
166
198
  }
167
199
 
168
- void Gosu::Font::set_image(std::string codepoint, unsigned font_flags, const Gosu::Image& image)
200
+ void Gosu::Font::set_image(std::string_view codepoint, unsigned font_flags,
201
+ const Gosu::Image& image)
169
202
  {
170
- auto utc4 = utf8_to_composed_utc4(codepoint);
203
+ const std::u32string utc4 = utf8_to_composed_utc4(codepoint);
171
204
  if (utc4.length() != 1) {
172
- throw std::invalid_argument{"Could not compose '" + codepoint + "' into single codepoint"};
205
+ throw std::invalid_argument("Could not compose '" + std::string(codepoint)
206
+ + "' into single codepoint");
173
207
  }
174
208
 
175
- if (utc4[0] < m_impl->fast_glyphs[font_flags].size()) {
176
- m_impl->fast_glyphs[font_flags][utc4[0]] = image;
177
- }
178
- else {
179
- m_impl->other_glyphs[font_flags][utc4[0]] = image;
180
- }
209
+ const std::unique_lock lock(m_impl->glyphs_mutex);
210
+ m_impl->glyphs.insert_or_assign({ .codepoint = utc4[0], .font_flags = font_flags }, image);
181
211
  }
182
212
 
183
- void Gosu::Font::set_image(std::string codepoint, const Gosu::Image& image)
213
+ void Gosu::Font::set_image(std::string_view codepoint, const Gosu::Image& image)
184
214
  {
185
215
  for (unsigned font_flags = 0; font_flags < FF_COMBINATIONS; ++font_flags) {
186
216
  set_image(codepoint, font_flags, image);
data/src/GosuGLView.cpp CHANGED
@@ -1,25 +1,33 @@
1
1
  #include <Gosu/Platform.hpp>
2
2
  #if defined(GOSU_IS_IPHONE)
3
3
 
4
- #import "GosuGLView.hpp"
5
4
  #import <Gosu/Input.hpp>
6
5
  #import <Gosu/TextInput.hpp>
7
-
6
+ #import "GosuGLView.hpp"
7
+ #import "GraphicsImpl.hpp"
8
+ #import "OpenGLContext.hpp"
8
9
  #import <OpenGLES/EAGL.h>
9
10
  #import <OpenGLES/EAGLDrawable.h>
10
- #import <OpenGLES/ES1/gl.h>
11
- #import <OpenGLES/ES1/glext.h>
12
11
  #import <QuartzCore/QuartzCore.h>
13
12
 
14
-
15
13
  static EAGLContext __weak* globalContext;
16
14
 
17
15
  namespace Gosu
18
16
  {
19
- void ensure_current_context()
17
+ OpenGLContext::OpenGLContext(bool)
20
18
  {
19
+ // Gosu does not support multithreading on iOS.
20
+ if (![NSThread isMainThread]) {
21
+ throw std::logic_error("Multi-threaded OpenGL access is not supported on iOS");
22
+ }
23
+
21
24
  [EAGLContext setCurrentContext:globalContext];
22
25
  }
26
+
27
+ OpenGLContext::~OpenGLContext()
28
+ {
29
+ // Don't bother unsetting anything.
30
+ }
23
31
 
24
32
  int clip_rect_base_factor()
25
33
  {
@@ -10,14 +10,6 @@
10
10
  #import <AudioToolbox/AudioSession.h>
11
11
  #import <OpenAL/alc.h>
12
12
 
13
- namespace Gosu
14
- {
15
- namespace FPS
16
- {
17
- void register_frame();
18
- }
19
- }
20
-
21
13
  static void handle_audio_interruption(void* unused, UInt32 inInterruptionState)
22
14
  {
23
15
  if (inInterruptionState == kAudioSessionBeginInterruption) {
@@ -180,9 +172,9 @@ static void handle_audio_interruption(void* unused, UInt32 inInterruptionState)
180
172
 
181
173
  if (window.needs_redraw()) {
182
174
  [(GosuGLView*)self.view redrawGL:^{
183
- window.graphics().frame([&window] {
175
+ window.viewport().frame([&window] {
184
176
  window.draw();
185
- Gosu::FPS::register_frame();
177
+ Gosu::register_frame();
186
178
  });
187
179
  }];
188
180
  }