gosu 0.13.3 → 0.14.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Audio.hpp +15 -11
  3. data/Gosu/Font.hpp +24 -20
  4. data/Gosu/Fwd.hpp +1 -1
  5. data/Gosu/Graphics.hpp +8 -9
  6. data/Gosu/ImageData.hpp +1 -1
  7. data/Gosu/Input.hpp +1 -1
  8. data/Gosu/Math.hpp +0 -18
  9. data/Gosu/Text.hpp +22 -30
  10. data/Gosu/TextInput.hpp +13 -0
  11. data/Gosu/Utility.hpp +2 -0
  12. data/Gosu/Window.hpp +3 -3
  13. data/README.md +3 -4
  14. data/ext/gosu/extconf.rb +7 -9
  15. data/lib/gosu/swig_patches.rb +1 -4
  16. data/rdoc/gosu.rb +34 -9
  17. data/src/Audio.cpp +6 -6
  18. data/src/AudioImpl.cpp +2 -2
  19. data/src/Bitmap.cpp +1 -2
  20. data/src/BitmapIO.cpp +21 -2
  21. data/src/BlockAllocator.cpp +1 -1
  22. data/src/Channel.cpp +7 -1
  23. data/src/ClipRectStack.hpp +4 -1
  24. data/src/Color.cpp +2 -1
  25. data/src/DirectoriesWin.cpp +1 -1
  26. data/src/DrawOp.hpp +8 -4
  27. data/src/DrawOpQueue.hpp +13 -24
  28. data/src/FileUnix.cpp +3 -1
  29. data/src/Font.cpp +92 -96
  30. data/src/GosuGLView.cpp +59 -31
  31. data/src/GosuGLView.hpp +14 -0
  32. data/src/GosuViewController.cpp +21 -21
  33. data/src/{GosuViewController.h → GosuViewController.hpp} +2 -4
  34. data/src/Graphics.cpp +71 -38
  35. data/src/GraphicsImpl.hpp +12 -29
  36. data/src/Image.cpp +5 -7
  37. data/src/Input.cpp +7 -5
  38. data/src/InputUIKit.cpp +19 -37
  39. data/src/Macro.cpp +10 -2
  40. data/src/MarkupParser.cpp +241 -0
  41. data/src/MarkupParser.hpp +61 -0
  42. data/src/Math.cpp +1 -1
  43. data/src/OffScreenTarget.cpp +99 -0
  44. data/src/OffScreenTarget.hpp +23 -0
  45. data/src/OggFile.hpp +10 -0
  46. data/src/RenderState.hpp +0 -2
  47. data/src/Resolution.cpp +2 -2
  48. data/src/RubyGosu.cxx +457 -244
  49. data/src/TexChunk.cpp +8 -6
  50. data/src/Text.cpp +58 -345
  51. data/src/TextBuilder.cpp +138 -0
  52. data/src/TextBuilder.hpp +55 -0
  53. data/src/TextInput.cpp +27 -10
  54. data/src/Texture.cpp +22 -17
  55. data/src/Texture.hpp +19 -20
  56. data/src/TimingApple.cpp +5 -7
  57. data/src/TimingUnix.cpp +1 -4
  58. data/src/TimingWin.cpp +4 -1
  59. data/src/TrueTypeFont.cpp +282 -0
  60. data/src/TrueTypeFont.hpp +66 -0
  61. data/src/TrueTypeFontApple.cpp +65 -0
  62. data/src/TrueTypeFontUnix.cpp +91 -0
  63. data/src/TrueTypeFontWin.cpp +82 -0
  64. data/src/Utility.cpp +40 -0
  65. data/src/Window.cpp +7 -6
  66. data/src/WindowUIKit.cpp +9 -4
  67. data/src/stb_truetype.h +4589 -0
  68. data/src/utf8proc.c +755 -0
  69. data/src/utf8proc.h +699 -0
  70. data/src/utf8proc_data.h +14386 -0
  71. metadata +23 -16
  72. data/src/FormattedString.cpp +0 -237
  73. data/src/FormattedString.hpp +0 -47
  74. data/src/GosuAppDelegate.cpp +0 -30
  75. data/src/GosuAppDelegate.h +0 -8
  76. data/src/GosuGLView.h +0 -8
  77. data/src/TextApple.cpp +0 -212
  78. data/src/TextTTFWin.cpp +0 -197
  79. data/src/TextUnix.cpp +0 -280
  80. data/src/TextWin.cpp +0 -191
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11cad0cf3c250ded2f28767de4b16a3813fe9344ab7ae4fced8fc175c84f1a45
4
- data.tar.gz: 1ed49eebd7f989d77af063d9ba72a39623f61ce2ef0ad650c670cbe41ebe2c77
3
+ metadata.gz: fae36fbf2c222327884fa9b34c5c2dc0a085a8fe7389dcc3c58d6d865b44a8f5
4
+ data.tar.gz: 843de673ab12f0d0ab72f29d560e29dd1262ecb8e4c1929118fc9dd770db5b77
5
5
  SHA512:
6
- metadata.gz: 70dc3a30a7bda5cb80f3ec61f51869ee764e18a96f0403ce592b10b8c66124b7d190ca5585c8fa8ad530adafe723d901775c0e45995d18b5f91f431b213fc43a
7
- data.tar.gz: 04c99a303c628114457eba9b4f3f770a3ca9278862b86ea15bd3f0fa30dad3cd3155f054ee98e95d2c844efd2869b0ef29bda63553061ca167caa10631723947
6
+ metadata.gz: 7a0f3a6bc482c1e30dbf2e04a4097ddde5fe630a8583875c9344463808d306b8f0c41131b70229bfc0f343e948d15714e65707bef077c18b434c434f9bd6a3e3
7
+ data.tar.gz: 2a1ec2451e8653b6dd7682faf8c4e7cf4b354a778234c0db51c4f0f17ad547a7a6356019c25d8458f1975d685c81f8e219cd384c2e81ed285f8053b5e2a61077
@@ -11,26 +11,31 @@
11
11
 
12
12
  namespace Gosu
13
13
  {
14
- //! Sample::play returns a Channel that represents the sound currently being played.
15
- //! This object can be used to stop sounds dynamically, or to check whether they have finished.
14
+ //! Sample::play returns a Channel that represents the sound being played.
15
+ //! This object can be used to stop sounds dynamically, or to check whether playback has
16
+ //! finished.
16
17
  class Channel
17
18
  {
18
19
  mutable int channel, token;
19
20
 
20
21
  public:
22
+ //! This creates an "empty" Channel which is expired and cannot be resumed.
23
+ Channel();
21
24
  //! For internal use only.
22
25
  Channel(int channel, int token);
23
26
 
27
+ //! For internal use only.
24
28
  int current_channel() const;
25
29
 
26
30
  bool playing() const;
27
31
  bool paused() const;
28
32
  //! Pauses this instance to be resumed afterwards.
29
- //! It will still occupy an audio channel while paused.
33
+ //! Avoid leaving samples paused for too long, as they will still occupy one of Gosu's
34
+ //! limited channels.
30
35
  void pause();
31
36
  void resume();
32
- //! Stops this instance of a sound being played.
33
- //! Calling this twice, or too late, does not do any harm.
37
+ //! Stops this channel if the sample is still being played.
38
+ //! If this method is called when playback has finished, it has no effect.
34
39
  void stop();
35
40
 
36
41
  //! \param volume Can be anything from 0.0 (silence) to 1.0 (full volume).
@@ -50,7 +55,7 @@ namespace Gosu
50
55
  std::shared_ptr<SampleData> data;
51
56
 
52
57
  public:
53
- //! Constructs an empty sample that acts as if the song had a length of 0.
58
+ //! Constructs an empty sample that is inaudible when played.
54
59
  Sample();
55
60
 
56
61
  //! Constructs a sample that can be played on the specified audio
@@ -82,7 +87,7 @@ namespace Gosu
82
87
  bool looping = false) const;
83
88
  };
84
89
 
85
- //! Songs are less flexible than samples. Only Song can be played at any given time,
90
+ //! Songs are less flexible than samples. Only one Song can be played at any given time,
86
91
  //! and there is no way to control its pan (stereo position) or speed.
87
92
  class Song
88
93
  {
@@ -98,8 +103,8 @@ namespace Gosu
98
103
 
99
104
  public:
100
105
  //! Constructs a song that can be played on the provided audio system
101
- //! and loads the song from a file. The type is determined from the
102
- //! filename.
106
+ //! and loads the song from a file.
107
+ //! The file type is determined by the filename.
103
108
  explicit Song(const std::string& filename);
104
109
 
105
110
  //! Constructs a song of the specified type that can be played on the
@@ -129,8 +134,7 @@ namespace Gosu
129
134
  bool playing() const;
130
135
  //! Returns the current volume of the song.
131
136
  double volume() const;
132
- //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
133
- //! volume).
137
+ //! \param volume Can be anything from 0.0 (silence) to 1.0 (full volume).
134
138
  void set_volume(double volume);
135
139
 
136
140
  //! Called every tick by Window for management purposes.
@@ -29,14 +29,13 @@ namespace Gosu
29
29
  //! \param font_height Height of the font, in pixels.
30
30
  //! \param font_flags Flags used to render individual characters of
31
31
  //! the font.
32
- Font(unsigned font_height, const std::string& font_name = default_font_name(),
33
- unsigned font_flags = FF_BOLD);
32
+ Font(int height, const std::string& name = default_font_name(), unsigned flags = FF_BOLD);
34
33
 
35
34
  //! Returns the name of the font that was used to create it.
36
- std::string name() const;
35
+ const std::string& name() const;
37
36
 
38
37
  //! Returns the height of the font, in pixels.
39
- unsigned height() const;
38
+ int height() const;
40
39
 
41
40
  //! Returns the flags used to create the font characters.
42
41
  unsigned flags() const;
@@ -47,8 +46,8 @@ namespace Gosu
47
46
  //! Draws text so the top left corner of the text is at (x; y).
48
47
  //! \param text Formatted text without line-breaks.
49
48
  void draw(const std::string& text, double x, double y, ZPos z,
50
- double scale_x = 1, double scale_y = 1, Color c = Color::WHITE,
51
- AlphaMode mode = AM_DEFAULT) const;
49
+ double scale_x = 1, double scale_y = 1, Color c = Color::WHITE,
50
+ AlphaMode mode = AM_DEFAULT) const;
52
51
 
53
52
  //! Draws text at a position relative to (x; y).
54
53
  //! \param rel_x Determines where the text is drawn horizontally. If
@@ -57,25 +56,30 @@ namespace Gosu
57
56
  //! centered on x. Of course, all real numbers are possible values.
58
57
  //! \param rel_y See rel_x.
59
58
  void draw_rel(const std::string& text, double x, double y, ZPos z,
60
- double rel_x, double rel_y, double scale_x = 1, double scale_y = 1,
61
- Color c = Color::WHITE, AlphaMode mode = AM_DEFAULT) const;
62
-
59
+ double rel_x, double rel_y, double scale_x = 1, double scale_y = 1,
60
+ Color c = Color::WHITE, AlphaMode mode = AM_DEFAULT) const;
61
+
62
+ //! DEPRECATED: Analogous to draw, but rotates the text by a given angle.
63
+ //! Use Graphics::push_transform to achieve the same effect.
64
+ #ifndef SWIG
65
+ GOSU_DEPRECATED
66
+ #endif
67
+ void draw_rot(const std::string& text, double x, double y, ZPos z, double angle,
68
+ double scale_x = 1, double scale_y = 1, Color c = Color::WHITE,
69
+ AlphaMode mode = AM_DEFAULT) const;
70
+
63
71
  //! Maps a letter to a specific image instead of generating one using
64
72
  //! Gosu's built-in text rendering. This can only be called once per
65
73
  //! character, and the character must not have been drawn before.
66
74
  //! This ensures that Fonts are still (sort of) immutable.
67
- void set_image(wchar_t wc, unsigned font_flags, const Gosu::Image& image);
75
+ #ifndef SWIG
76
+ GOSU_DEPRECATED
77
+ #endif
78
+ void set_image(std::string codepoint, unsigned font_flags, const Gosu::Image& image);
68
79
  //! A shortcut for mapping a character to an image regardless of font_flags.
69
- //! Later versions might apply faux italics or faux bold to it (to be decided!).
70
- void set_image(wchar_t wc, const Gosu::Image& image);
71
-
72
- #ifndef SWIG
80
+ #ifndef SWIG
73
81
  GOSU_DEPRECATED
74
- #endif
75
- //! DEPRECATED: Analogous to draw, but rotates the text by a given angle.
76
- //! Use Graphics::push_transform to achieve the same effect.
77
- void draw_rot(const std::string& text, double x, double y, ZPos z, double angle,
78
- double scale_x = 1, double scale_y = 1, Color c = Color::WHITE,
79
- AlphaMode mode = AM_DEFAULT) const;
82
+ #endif
83
+ void set_image(std::string codepoint, const Gosu::Image& image);
80
84
  };
81
85
  }
@@ -9,6 +9,7 @@ namespace Gosu
9
9
  class Bitmap;
10
10
  class Buffer;
11
11
  class Button;
12
+ class Channel;
12
13
  class Color;
13
14
  class File;
14
15
  class Font;
@@ -21,7 +22,6 @@ namespace Gosu
21
22
  class Sample;
22
23
  class Song;
23
24
  class TextInput;
24
- class Timer;
25
25
  class Window;
26
26
  class Writer;
27
27
  }
@@ -24,9 +24,8 @@ namespace Gosu
24
24
  class Graphics
25
25
  {
26
26
  struct Impl;
27
- // Non-movable (const) to avoid dangling internal references.
28
- const std::unique_ptr<Impl> pimpl;
29
-
27
+ std::unique_ptr<Impl> pimpl;
28
+
30
29
  public:
31
30
  Graphics(unsigned physical_width, unsigned physical_height);
32
31
  ~Graphics();
@@ -60,11 +59,11 @@ namespace Gosu
60
59
  static void clip_to(double x, double y, double width, double height,
61
60
  const std::function<void ()>& f);
62
61
 
63
- //! Records a macro and returns it as an ImageData instance.
64
- //! Usually, the return value is passed to Image::Image().
65
- //! Cannot be nested.
66
- static std::unique_ptr<Gosu::ImageData> record(int width, int height,
67
- const std::function<void ()>& f);
62
+ //! Renders everything drawn in f onto a new Image of size (width, height).
63
+ static Gosu::Image render(int width, int height, const std::function<void ()>& f);
64
+
65
+ //! Records a macro and returns it as an Image.
66
+ static Gosu::Image record(int width, int height, const std::function<void ()>& f);
68
67
 
69
68
  //! Pushes one transformation onto the transformation stack.
70
69
  static void transform(const Transform& transform,
@@ -100,7 +99,7 @@ namespace Gosu
100
99
 
101
100
  //! Turns a portion of a bitmap into something that can be drawn on a Graphics object.
102
101
  static std::unique_ptr<ImageData> create_image(const Bitmap& src,
103
- unsigned src_x, unsigned src_y,
102
+ unsigned src_x, unsigned src_y,
104
103
  unsigned src_width, unsigned src_height,
105
104
  unsigned image_flags);
106
105
  };
@@ -17,7 +17,7 @@ namespace Gosu
17
17
  struct GLTexInfo
18
18
  {
19
19
  int tex_name;
20
- float left, right, top, bottom;
20
+ double left, right, top, bottom;
21
21
  };
22
22
 
23
23
  //! The ImageData class is an abstract base class for drawable images.
@@ -59,7 +59,7 @@ namespace Gosu
59
59
  public:
60
60
  #ifdef GOSU_IS_IPHONE
61
61
  Input(void* view, float update_interval);
62
- void feed_touch_event(int type, void* touches);
62
+ void feed_touch_event(std::function<void (Touch)>& callback, void* touches);
63
63
  #else
64
64
  Input(void* window);
65
65
  bool feed_sdl_event(void* event);
@@ -12,24 +12,6 @@
12
12
 
13
13
  namespace Gosu
14
14
  {
15
- //! Truncates the fractional part of a real value. Equivalent to
16
- //! static_cast<long>.
17
- inline long trunc(double value)
18
- {
19
- return static_cast<long>(value);
20
- }
21
-
22
- //! Rounds a real value towards the next integer.
23
- inline long round(double value)
24
- {
25
- if (value >= 0) {
26
- return static_cast<long>(value + 0.5);
27
- }
28
- else {
29
- return static_cast<long>(value - 0.5);
30
- }
31
- }
32
-
33
15
  //! Returns a real value between min (inclusive) and max (exclusive).
34
16
  //! Uses std::rand, so you should call std::srand before using it.
35
17
  double random(double min, double max);
@@ -10,53 +10,45 @@
10
10
 
11
11
  namespace Gosu
12
12
  {
13
- //! Returns the name of a neutral font that is available on the current
14
- //! platform.
13
+ //! Returns the name of a neutral font that is available on the current platform.
15
14
  std::string default_font_name();
16
15
 
17
16
  //! Returns the width an unformatted line of text would span on a bitmap if it were drawn using
18
- //! draw_text with the same arguments. This is a very low-level function that does not
19
- //! understand any of Gosu's HTML-like markup.
20
- //! \param text Unformatted text.
21
- //! \param font_name Name of a system font, or a filename to a TTF file (must contain '/').
22
- unsigned text_width(const std::string& text, const std::string& font_name, unsigned font_height,
23
- unsigned font_flags = 0);
17
+ //! draw_text with the same arguments.
18
+ //! \param text A UCS-4 string, normalization: NFC.
19
+ //! \param font_name Name of a system font, or filename of a TTF file (must contain '/' or '.').
20
+ double text_width(const std::u32string& text, const std::string& font_name, double font_height,
21
+ unsigned font_flags = 0);
24
22
 
25
23
  //! Draws a line of unformatted text on a bitmap. This is a very low-level function that does
26
24
  //! not understand any of Gosu's HTML-like markup.
27
- //! \param text Unformatted text.
28
- //! \param font_name Name of a system font, or a filename to a TTF file (must contain '/').
25
+ //! \param text A UCS-4 string, normalization: NFC.
26
+ //! \param font_name Name of a system font, or filename of a TTF file (must contain '/' or '.').
29
27
  //! \param font_height Height, in pixels, of the text.
30
- //! \param font_flags Binary combination of members of the FontFlags
31
- //! enum.
32
- void draw_text(Bitmap& bitmap, const std::string& text, int x, int y, Color c,
33
- const std::string& font_name, unsigned font_height, unsigned font_flags = 0);
28
+ //! \param font_flags Binary combination of members of the FontFlags enum.
29
+ double draw_text(Bitmap& bitmap, double x, double y, Color c, const std::u32string& text,
30
+ const std::string& font_name, double font_height, unsigned font_flags = 0);
34
31
 
35
32
  //! Creates a bitmap that is filled with a line of formatted text given to the function.
36
33
  //! The line can contain line breaks and HTML-like markup.
37
34
  //! \param text Formatted text.
38
- //! \param font_name Name of a system font, or a filename to a TTF file (must contain '/').
35
+ //! \param font_name Name of a system font, or filename of a TTF file (must contain '/' or '.').
39
36
  //! \param font_height Height of the font in pixels.
40
- //! \param font_flags Binary combination of members of the FontFlags
41
- //! enum.
42
- Bitmap create_text(const std::string& text, const std::string& font_name, unsigned font_height,
43
- unsigned font_flags = 0);
37
+ //! \param font_flags Binary combination of members of the FontFlags enum.
38
+ Bitmap create_text(const std::string& text, const std::string& font_name, double font_height,
39
+ unsigned font_flags = 0);
44
40
 
45
41
  //! Creates a bitmap that is filled with the formatted text given to the function.
46
42
  //! The line can contain line breaks and HTML-like markup.
47
43
  //! \param text Formatted text.
48
- //! \param font_name Name of a system font, or a filename to a TTF file (must contain '/').
44
+ //! \param font_name Name of a system font, or filename of a TTF file (must contain '/' or '.').
49
45
  //! \param font_height Height of the font in pixels.
50
46
  //! \param line_spacing Spacing between two lines of text in pixels. Can be negative to make
51
- //! text stick together more closely.
52
- //! \param width Width of the bitmap that will be returned. Text will be split into multiple
53
- //! lines to avoid drawing over the right border. When a single word is too long, it will be
54
- //! truncated.
47
+ //! text stick together more closely.
48
+ //! \param width Width of the bitmap that will be returned.
49
+ //! Text will be split into multiple lines to avoid drawing over the right border.
50
+ //! When a single word is too long, it will be truncated.
55
51
  //! \param font_flags Binary combination of members of the FontFlags enum.
56
- Bitmap create_text(const std::string& text, const std::string& font_name, unsigned font_height,
57
- int line_spacing, unsigned width, Alignment align, unsigned font_flags = 0);
58
-
59
- //! Registers a new HTML-style entity that can subsequently be used
60
- //! with Gosu::Font and Gosu::create_text. The name is given without & and ;.
61
- void register_entity(const std::string& name, const Bitmap& replacement);
52
+ Bitmap create_text(const std::string& text, const std::string& font_name, double font_height,
53
+ double line_spacing, int width, Alignment align, unsigned font_flags = 0);
62
54
  }
@@ -49,8 +49,10 @@ namespace Gosu
49
49
  //! Sets the start of the selection as returned by selection_start.
50
50
  void set_selection_start(unsigned pos);
51
51
 
52
+ #ifndef GOSU_IS_IPHONE
52
53
  // Platform-specific communication with Gosu::Input.
53
54
  bool feed_sdl_event(void* event);
55
+ #endif
54
56
 
55
57
  //! Overridable filter that is applied to all new text that is entered.
56
58
  //! Allows for context-sensitive filtering/extending/... of new characters.
@@ -59,5 +61,16 @@ namespace Gosu
59
61
  {
60
62
  return text;
61
63
  }
64
+
65
+ //! Replaces the current selection (if any) and inserts the given string at the current
66
+ //! caret position.
67
+ //! The filter method will not be applied before appending the string.
68
+ void insert_text(std::string text);
69
+
70
+ //! Deletes the current selection, if any, or the next character.
71
+ void delete_forward();
72
+
73
+ //! Deletes the current selection, if any, or the previous character.
74
+ void delete_backward();
62
75
  };
63
76
  }
@@ -12,6 +12,8 @@ namespace Gosu
12
12
  //! Converts an UCS-4 or UTF-16 to UTF-8, depending on the platform's interpretation of wstring.
13
13
  std::string wstring_to_utf8(const std::wstring& ws);
14
14
 
15
+ std::u32string utf8_to_composed_utc4(const std::string& utf8);
16
+
15
17
  //! Returns true if the filename has the given extension.
16
18
  //! The comparison is case-insensitive, but you must pass the extension in lower case.
17
19
  bool has_extension(const std::string& filename, const char* extension);
@@ -118,10 +118,10 @@ namespace Gosu
118
118
  virtual void button_up(Gosu::Button) {}
119
119
 
120
120
  //! Called when a file is dropped onto the window.
121
- //! \param path The filename of the dropped file. When multiple files are dropped, this
121
+ //! \param filename The filename of the dropped file. When multiple files are dropped, this
122
122
  //! method will be called several times.
123
123
  virtual void drop(const std::string& filename) {}
124
-
124
+
125
125
  // Ignore when SWIG is wrapping this class for Ruby/Gosu.
126
126
  #ifndef SWIG
127
127
  // Callbacks for touch events. So far these are only used on iOS.
@@ -138,7 +138,7 @@ namespace Gosu
138
138
  #endif
139
139
 
140
140
  #ifdef GOSU_IS_IPHONE
141
- void* UIWindow() const;
141
+ void* uikit_window() const;
142
142
  #endif
143
143
  };
144
144
  }
data/README.md CHANGED
@@ -18,10 +18,9 @@ or look at existing projects in the [Gosu Showcase](https://www.libgosu.org/cgi-
18
18
  Community
19
19
  ---------
20
20
 
21
- - Visit our [message board](https://www.libgosu.org/cgi-bin/mwf/forum.pl) or the [r/gosu subreddit](https://reddit.com/r/gosu).
22
- - There’s also an IRC room, [#gosu on freenode](https://webchat.freenode.net/?channels=gosu).
23
- The regulars are spread across many timezones, so you’ll need some patience.
24
- - Please file bugs and request features [on GitHub](https://github.com/gosu/gosu/issues).
21
+ - There is a lively [Discord community](https://discord.gg/SZ4nbEd).
22
+ - If you want to discuss or announce something in a more permanent place than a chat room, we also have a [message board](https://www.libgosu.org/cgi-bin/mwf/forum.pl).
23
+ - Please file bugs and feature requests [on GitHub](https://github.com/gosu/gosu/issues).
25
24
 
26
25
  Build Status
27
26
  ------------
@@ -24,16 +24,18 @@ $CFLAGS << " -DGOSU_DEPRECATED="
24
24
 
25
25
  $CXXFLAGS ||= ""
26
26
  $CXXFLAGS << " -std=gnu++11"
27
- $CXXFLAGS << " -Wno-reserved-user-defined-literal" # see https://github.com/gosu/gosu/issues/424
28
27
 
29
28
  # For #include <Gosu/...>
30
29
  $INCFLAGS << " -I../.."
31
30
 
32
31
  if `uname`.chomp == 'Darwin'
33
- # To make everything work with the Objective C runtime
34
- $CFLAGS << " -x objective-c -fobjc-arc -DNDEBUG"
32
+ # Disable assertions in C code.
33
+ $CFLAGS << " -DNDEBUG"
35
34
  # Compile all C++ files as Objective C++ on macOS since mkmf does not support .mm files.
36
35
  $CXXFLAGS << " -x objective-c++ -fobjc-arc -DNDEBUG"
36
+ # Prevents issues with Apple's pre-installed Ruby 2.3 on macOS 10.13.
37
+ # https://github.com/gosu/gosu/issues/424
38
+ $CXXFLAGS << " -Wno-reserved-user-defined-literal"
37
39
 
38
40
  # Explicitly specify libc++ as the standard library.
39
41
  # rvm will sometimes try to override this:
@@ -43,7 +45,7 @@ if `uname`.chomp == 'Darwin'
43
45
  # Dependencies.
44
46
  $CXXFLAGS << " #{`sdl2-config --cflags`.chomp}"
45
47
  # Prefer statically linking SDL 2.
46
- $LDFLAGS << " #{`sdl2-config --static-libs`.chomp} -framework OpenGL -framework OpenAL"
48
+ $LDFLAGS << " #{`sdl2-config --static-libs`.chomp} -framework OpenGL -framework Metal -framework OpenAL"
47
49
 
48
50
  # Disable building of 32-bit slices in Apple's Ruby.
49
51
  # (RbConfig::CONFIG['CXXFLAGS'] on 10.11: -arch x86_64 -arch i386 -g -Os -pipe)
@@ -65,19 +67,15 @@ else
65
67
  end
66
68
 
67
69
  pkg_config 'sdl2'
68
- pkg_config 'pangoft2'
69
70
  pkg_config 'vorbisfile'
70
71
  pkg_config 'openal'
71
72
  pkg_config 'sndfile'
72
73
  pkg_config 'libmpg123'
74
+ pkg_config 'fontconfig'
73
75
 
74
- have_header 'SDL_ttf.h' if have_library('SDL2_ttf', 'TTF_RenderUTF8_Blended')
75
76
  have_header 'AL/al.h' if have_library('openal')
76
77
  end
77
78
 
78
- # This is necessary to build with stock Ruby on OS X 10.7.
79
- CONFIG['CXXFLAGS'] ||= $CXXFLAGS
80
-
81
79
  # Gem::Version#initialize is apparently broken in some versions of Ruby, so use a local helper.
82
80
  def ruby_newer_than?(want_version)
83
81
  have_parts = RUBY_VERSION.split('.').map { |part| part.to_i }