gosu 0.14.5 → 0.14.6.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61b26106f2220170e6e8aaeeff303363a1ba74e7380902fdb994ca7cb5380e10
4
- data.tar.gz: 2c4c31879e62f94a6717b08e0b964294a3d969752867aa10e69b348ed1aa6b28
3
+ metadata.gz: aa8da5cf8c3c455ebaa47ee8e9dc31091fcc2ecc10afce1acac4fb4802cd0b9a
4
+ data.tar.gz: 12c781dbcbda39f7417b8afcbb4fc72e7998fb5574fa0dfed15d4e4b2c0e97fb
5
5
  SHA512:
6
- metadata.gz: c2a5661e5da0003d5225299f386fb05cecc22ee66ee2b7e9bf7a91e8f81e41f2845807d1816a80e814fa128088154bad53f5887eed851d09cae0c1457e084c6e
7
- data.tar.gz: f68170c042c37db4f15a35c37f6f347076b26ed3c4582b45a7c9be896588479db07582fe3439206fdaf803142ff22709acd1c0e250fd2dae0a9abf2d5ff4f39c
6
+ metadata.gz: a84524ee920802fa45abf1bcf980c6bd0ec0456a3b47c42ee3bc139e4c364261f6fb1369e2456dd886a5bc0eae8f8903b21a9a80c930abc14fad665f13253d8a
7
+ data.tar.gz: 43cc93051d22b7ddbf49987dd50efd70b001752acab675e29235f351e7a30d318acb11ed9853937ead8024185d494fc6d872307a961cef3a37ddca4f09e84442
data/COPYING CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2001-2018 Julian Raschke, Jan Lücker and all contributors.
1
+ Copyright (C) 2001-2019 Julian Raschke, Jan Lücker and all contributors.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a
4
4
  copy of this software and associated documentation files (the "Software"),
@@ -4,7 +4,7 @@
4
4
 
5
5
  #define GOSU_MAJOR_VERSION 0
6
6
  #define GOSU_MINOR_VERSION 14
7
- #define GOSU_POINT_VERSION 5
7
+ #define GOSU_POINT_VERSION 6
8
8
 
9
9
  namespace Gosu
10
10
  {
@@ -34,14 +34,15 @@ namespace Gosu
34
34
  //! \param update_interval Interval in milliseconds between two calls to the update member
35
35
  //! function.
36
36
  Window(unsigned width, unsigned height, bool fullscreen = false,
37
- double update_interval = 16.666666);
37
+ double update_interval = 16.666666, bool resizable = false);
38
38
  virtual ~Window();
39
39
 
40
40
  unsigned width() const;
41
41
  unsigned height() const;
42
42
  bool fullscreen() const;
43
+ bool resizable() const;
43
44
  void resize(unsigned width, unsigned height, bool fullscreen);
44
-
45
+
45
46
  double update_interval() const;
46
47
  void set_update_interval(double update_interval);
47
48
 
data/README.md CHANGED
@@ -18,7 +18,7 @@ or look at existing projects in the [Gosu Showcase](https://www.libgosu.org/cgi-
18
18
  Community
19
19
  ---------
20
20
 
21
- - There is a lively [Discord community](https://discord.gg/SZ4nbEd).
21
+ - There is a lively [Discord community](https://discord.gg/5nEBXDc).
22
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
23
  - Please file bugs and feature requests [on GitHub](https://github.com/gosu/gosu/issues).
24
24
 
@@ -46,6 +46,9 @@ if `uname`.chomp == 'Darwin'
46
46
  $CXXFLAGS << " #{`sdl2-config --cflags`.chomp}"
47
47
  # Prefer statically linking SDL 2.
48
48
  $LDFLAGS << " #{`sdl2-config --static-libs`.chomp} -framework OpenGL -framework Metal -framework OpenAL"
49
+ # And yet another hack: `sdl2-config --static-libs` uses `-lSDL2` instead of linking to the static library,
50
+ # even if it exists. -> Manually replace it. (Ugh!)
51
+ $LDFLAGS.sub! " -lSDL2 ", " /usr/local/lib/libSDL2.a " if File.exist? "/usr/local/lib/libSDL2.a"
49
52
 
50
53
  # Disable building of 32-bit slices in Apple's Ruby.
51
54
  # (RbConfig::CONFIG['CXXFLAGS'] on 10.11: -arch x86_64 -arch i386 -g -Os -pipe)
@@ -74,7 +74,7 @@ class Gosu::Image
74
74
 
75
75
  def initialize(*args)
76
76
  if args[0].is_a? Gosu::Window
77
- Gosu.deprecation_message("Passing a Window to Image#initialize has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html.")
77
+ Gosu.deprecation_message("Passing a Window to Image#initialize has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html ")
78
78
  if args.size == 7
79
79
  initialize_without_window args[1], :tileable => args[2], :rect => args[3..-1]
80
80
  else
@@ -91,10 +91,10 @@ class Gosu::Image
91
91
 
92
92
  def self.from_text(*args)
93
93
  if args.size == 4
94
- Gosu.deprecation_message("Passing a Window to Image.from_text has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html.")
94
+ Gosu.deprecation_message("Passing a Window to Image.from_text has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html ")
95
95
  from_text_without_window(args[1], args[3], :font => args[2])
96
96
  elsif args.size == 7
97
- Gosu.deprecation_message("Passing a Window to Image.from_text has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html.")
97
+ Gosu.deprecation_message("Passing a Window to Image.from_text has been deprecated in Gosu 0.9 and this method now uses an options hash, see https://www.libgosu.org/rdoc/Gosu/Image.html ")
98
98
  from_text_without_window(args[1], args[3], :font => args[2],
99
99
  :spacing => args[4], :width => args[5], :align => args[6])
100
100
  else
@@ -4,19 +4,20 @@
4
4
  # custom debugging help:
5
5
  class Gosu::Window
6
6
  alias initialize_without_hash initialize
7
-
7
+
8
8
  def initialize width, height, *args
9
9
  if args.empty? or args.first.is_a? Hash
10
10
  options = args.first || {}
11
11
  fullscreen = options[:fullscreen]
12
12
  update_interval = options[:update_interval]
13
+ resizable = options[:resizable]
13
14
  else
14
15
  fullscreen, update_interval = *args
15
16
  end
16
17
  $gosu_gl_blocks = nil
17
- initialize_without_hash width, height, !!fullscreen, update_interval || 16.666666
18
+ initialize_without_hash width, height, !!fullscreen, update_interval || 16.666666, !!resizable
18
19
  end
19
-
20
+
20
21
  %w(update draw needs_redraw? needs_cursor?
21
22
  lose_focus button_down button_up).each do |callback|
22
23
  define_method "protected_#{callback}" do |*args|
@@ -56,10 +57,14 @@ end
56
57
  module Gosu
57
58
  # Keep a reference to these blocks that is only cleared after Window#draw.
58
59
  # Otherwise, the GC might free these blocks while Gosu is still rendering.
59
- def self.gl(*args, &block)
60
+ def self.gl(z = nil, &block)
60
61
  $gosu_gl_blocks ||= []
61
62
  $gosu_gl_blocks << block
62
- unsafe_gl(*args, &block)
63
+ if z.nil?
64
+ unsafe_gl(&block)
65
+ else
66
+ unsafe_gl(z, &block)
67
+ end
63
68
  end
64
69
  end
65
70
 
@@ -1,4 +1,4 @@
1
- # Encoding: UTF-8
1
+ ## Encoding: UTF-8
2
2
 
3
3
  module Gosu
4
4
  ##
@@ -50,6 +50,7 @@ module Gosu
50
50
  KB_LEFT_SHIFT = :an_integer
51
51
  KB_MINUS = :an_integer
52
52
  KB_NUMPAD_0…KB_NUMPAD_9 = :an_integer
53
+ KB_NUMPAD_DELETE = :an_integer
53
54
  KB_NUMPAD_DIVIDE = :an_integer
54
55
  KB_NUMPAD_MINUS = :an_integer
55
56
  KB_NUMPAD_MULTIPLY = :an_integer
@@ -471,7 +472,6 @@ module Gosu
471
472
  # @return [Gosu::GLTexInfo?] information about the underlying OpenGL texture.
472
473
  #
473
474
  # @see Gosu::GLTexInfo
474
- # @see file:examples/OpenGLIntegration.rb
475
475
  def gl_tex_info; end
476
476
 
477
477
  ##
@@ -764,6 +764,10 @@ module Gosu
764
764
  ##
765
765
  # Toggles between windowed mode and fullscreen.
766
766
  attr_writer :fullscreen
767
+
768
+ ##
769
+ # @return [true, false] whether this window is resizable.
770
+ def resizable?; end
767
771
 
768
772
  ##
769
773
  # @return [Float] the interval between calls to {#update}, in milliseconds.
@@ -772,8 +776,9 @@ module Gosu
772
776
  ##
773
777
  # Creates a new window with the requested size.
774
778
  #
775
- # @note The actual window may be smaller if the requested size is too large for the current display resolution; in that case, Gosu will automatically scale all coordinates to transparently emulate a larger window. No need to thank us.
776
- #
779
+ # Resizable fullscreen windows always use the full desktop resolution.
780
+ # Windows that are larger than the desktop resolution will be shrunk.
781
+ #
777
782
  # @overload initialize(width, height, options = {})
778
783
  # @overload initialize(width, height, fullscreen, update_interval = 16.666666)
779
784
  #
@@ -781,6 +786,7 @@ module Gosu
781
786
  # @param height [Integer] the desired window height.
782
787
  # @param [Hash] options
783
788
  # @option options [true, false] :fullscreen (false) whether to present the window in fullscreen mode.
789
+ # @option options [true, false] :resizable (false) whether the window can be resized by the user.
784
790
  # @option options [Float] :update_interval (16.666666) the interval between frames, in milliseconds.
785
791
  def initialize(width, height, options); end
786
792
 
@@ -889,7 +895,6 @@ module Gosu
889
895
  # Can be retrieved from some images to use them in OpenGL operations.
890
896
  #
891
897
  # @see Gosu::Image#gl_tex_info
892
- # @see file:examples/OpenGLIntegration.rb
893
898
  class GLTexInfo
894
899
  ##
895
900
  # @return [Integer] OpenGL texture id
@@ -1040,7 +1045,6 @@ module Gosu
1040
1045
  #
1041
1046
  # @see Window#draw
1042
1047
  # @see file:reference/Z-Ordering
1043
- # @see file:examples/OpenGLIntegration.rb
1044
1048
  def gl(z=nil); end
1045
1049
 
1046
1050
  ##
@@ -3212,7 +3212,7 @@ std::string SwigDirector_TextInput::filter(std::string text) const {
3212
3212
  }
3213
3213
 
3214
3214
 
3215
- SwigDirector_Window::SwigDirector_Window(VALUE self, unsigned int width, unsigned int height, bool fullscreen, double update_interval): Gosu::Window(width, height, fullscreen, update_interval), Swig::Director(self) {
3215
+ SwigDirector_Window::SwigDirector_Window(VALUE self, unsigned int width, unsigned int height, bool fullscreen, double update_interval, bool resizable): Gosu::Window(width, height, fullscreen, update_interval, resizable), Swig::Director(self) {
3216
3216
 
3217
3217
  }
3218
3218
 
@@ -8697,6 +8697,7 @@ _wrap_new_Window(int argc, VALUE *argv, VALUE self) {
8697
8697
  unsigned int arg3 ;
8698
8698
  bool arg4 = (bool) false ;
8699
8699
  double arg5 = (double) 16.666666 ;
8700
+ bool arg6 = (bool) false ;
8700
8701
  unsigned int val2 ;
8701
8702
  int ecode2 = 0 ;
8702
8703
  unsigned int val3 ;
@@ -8705,10 +8706,12 @@ _wrap_new_Window(int argc, VALUE *argv, VALUE self) {
8705
8706
  int ecode4 = 0 ;
8706
8707
  double val5 ;
8707
8708
  int ecode5 = 0 ;
8709
+ bool val6 ;
8710
+ int ecode6 = 0 ;
8708
8711
  const char *classname SWIGUNUSED = "Gosu::Window";
8709
8712
  Gosu::Window *result = 0 ;
8710
8713
 
8711
- if ((argc < 2) || (argc > 4)) {
8714
+ if ((argc < 2) || (argc > 5)) {
8712
8715
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
8713
8716
  }
8714
8717
  arg1 = self;
@@ -8736,13 +8739,20 @@ _wrap_new_Window(int argc, VALUE *argv, VALUE self) {
8736
8739
  }
8737
8740
  arg5 = static_cast< double >(val5);
8738
8741
  }
8742
+ if (argc > 4) {
8743
+ ecode6 = SWIG_AsVal_bool(argv[4], &val6);
8744
+ if (!SWIG_IsOK(ecode6)) {
8745
+ SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "bool","Window", 6, argv[4] ));
8746
+ }
8747
+ arg6 = static_cast< bool >(val6);
8748
+ }
8739
8749
  {
8740
8750
  try {
8741
8751
  if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
8742
8752
  /* subclassed */
8743
- result = (Gosu::Window *)new SwigDirector_Window(arg1,arg2,arg3,arg4,arg5);
8753
+ result = (Gosu::Window *)new SwigDirector_Window(arg1,arg2,arg3,arg4,arg5,arg6);
8744
8754
  } else {
8745
- result = (Gosu::Window *)new Gosu::Window(arg2,arg3,arg4,arg5);
8755
+ result = (Gosu::Window *)new Gosu::Window(arg2,arg3,arg4,arg5,arg6);
8746
8756
  }
8747
8757
 
8748
8758
  DATA_PTR(self) = result;
@@ -8858,6 +8868,37 @@ fail:
8858
8868
  }
8859
8869
 
8860
8870
 
8871
+ SWIGINTERN VALUE
8872
+ _wrap_Window_resizableq___(int argc, VALUE *argv, VALUE self) {
8873
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
8874
+ void *argp1 = 0 ;
8875
+ int res1 = 0 ;
8876
+ bool result;
8877
+ VALUE vresult = Qnil;
8878
+
8879
+ if ((argc < 0) || (argc > 0)) {
8880
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8881
+ }
8882
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
8883
+ if (!SWIG_IsOK(res1)) {
8884
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window const *","resizable", 1, self ));
8885
+ }
8886
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
8887
+ {
8888
+ try {
8889
+ result = (bool)((Gosu::Window const *)arg1)->resizable();
8890
+ }
8891
+ catch (const std::exception& e) {
8892
+ SWIG_exception(SWIG_RuntimeError, e.what());
8893
+ }
8894
+ }
8895
+ vresult = SWIG_From_bool(static_cast< bool >(result));
8896
+ return vresult;
8897
+ fail:
8898
+ return Qnil;
8899
+ }
8900
+
8901
+
8861
8902
  SWIGINTERN VALUE
8862
8903
  _wrap_Window_update_interval(int argc, VALUE *argv, VALUE self) {
8863
8904
  Gosu::Window *arg1 = (Gosu::Window *) 0 ;
@@ -12097,6 +12138,7 @@ SWIGEXPORT void Init_gosu(void) {
12097
12138
  rb_define_method(SwigClassWindow.klass, "width", VALUEFUNC(_wrap_Window_width), -1);
12098
12139
  rb_define_method(SwigClassWindow.klass, "height", VALUEFUNC(_wrap_Window_height), -1);
12099
12140
  rb_define_method(SwigClassWindow.klass, "fullscreen?", VALUEFUNC(_wrap_Window_fullscreenq___), -1);
12141
+ rb_define_method(SwigClassWindow.klass, "resizable?", VALUEFUNC(_wrap_Window_resizableq___), -1);
12100
12142
  rb_define_method(SwigClassWindow.klass, "update_interval", VALUEFUNC(_wrap_Window_update_interval), -1);
12101
12143
  rb_define_method(SwigClassWindow.klass, "update_interval=", VALUEFUNC(_wrap_Window_update_intervale___), -1);
12102
12144
  rb_define_method(SwigClassWindow.klass, "caption", VALUEFUNC(_wrap_Window_caption), -1);
@@ -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, unsigned int width, unsigned int height, bool fullscreen = false, double update_interval = 16.666666);
31
+ SwigDirector_Window(VALUE self, unsigned int width, unsigned int height, bool fullscreen = false, double update_interval = 16.666666, bool resizable = false);
32
32
  virtual ~SwigDirector_Window();
33
33
  virtual void show();
34
34
  virtual bool tick();
@@ -85,22 +85,29 @@ struct Gosu::Window::Impl
85
85
  {
86
86
  bool fullscreen;
87
87
  double update_interval;
88
-
88
+ bool resizable;
89
+ bool resizing = false;
90
+
89
91
  // A single `bool open` is not good enough to support the tick() method: When close() is called
90
92
  // from outside the window's call graph, the next call to tick() must return false (transition
91
93
  // from CLOSING to CLOSED), but the call after that must return show the window again
92
94
  // (transition from CLOSED to OPEN).
93
95
  enum { CLOSED, OPEN, CLOSING } state = CLOSED;
94
-
96
+
95
97
  unique_ptr<Graphics> graphics;
96
98
  unique_ptr<Input> input;
97
99
  };
98
100
 
99
- Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double update_interval)
101
+ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double update_interval,
102
+ bool resizable)
100
103
  : pimpl(new Impl)
101
104
  {
105
+ #if SDL_VERSION_ATLEAST(2, 0, 5)
106
+ SDL_SetWindowResizable(shared_window(), (SDL_bool)resizable);
107
+ #endif
108
+
102
109
  // Even in fullscreen mode, temporarily show the window in windowed mode to centre it.
103
- // This ensures that the window will be centred correctly when exiting fullscreen mode.
110
+ // This ensures that the window will be centered correctly when exiting fullscreen mode.
104
111
  // Fixes https://github.com/gosu/gosu/issues/369
105
112
  // (This will implicitly create graphics() and input(), and make the OpenGL context current.)
106
113
  resize(width, height, false);
@@ -108,11 +115,12 @@ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double up
108
115
 
109
116
  // Really enable fullscreen if desired.
110
117
  resize(width, height, fullscreen);
111
-
118
+
112
119
  SDL_GL_SetSwapInterval(1);
113
120
 
114
121
  pimpl->update_interval = update_interval;
115
-
122
+ pimpl->resizable = resizable;
123
+
116
124
  input().on_button_down = [this](Button button) { button_down(button); };
117
125
  input().on_button_up = [this](Button button) { button_up(button); };
118
126
  }
@@ -137,6 +145,11 @@ bool Gosu::Window::fullscreen() const
137
145
  return pimpl->fullscreen;
138
146
  }
139
147
 
148
+ bool Gosu::Window::resizable() const
149
+ {
150
+ return pimpl->resizable;
151
+ }
152
+
140
153
  void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
141
154
  {
142
155
  pimpl->fullscreen = fullscreen;
@@ -150,31 +163,47 @@ void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
150
163
  if (fullscreen) {
151
164
  actual_width = Gosu::screen_width(this);
152
165
  actual_height = Gosu::screen_height(this);
153
-
154
- double scale_x = 1.0 * actual_width / width;
155
- double scale_y = 1.0 * actual_height / height;
156
- scale_factor = min(scale_x, scale_y);
157
-
158
- if (scale_x < scale_y) {
159
- black_bar_height = (actual_height / scale_x - height) / 2;
166
+
167
+ if (resizable()) {
168
+ // Resizable fullscreen windows stubbornly follow the desktop resolution.
169
+ width = actual_width;
170
+ height = actual_height;
160
171
  }
161
- else if (scale_y < scale_x) {
162
- black_bar_width = (actual_width / scale_y - width) / 2;
172
+ else {
173
+ // Scale the window to fill the desktop resolution.
174
+ double scale_x = 1.0 * actual_width / width;
175
+ double scale_y = 1.0 * actual_height / height;
176
+ scale_factor = min(scale_x, scale_y);
177
+ // Add black bars to preserve the aspect ratio, if necessary.
178
+ if (scale_x < scale_y) {
179
+ black_bar_height = (actual_height / scale_x - height) / 2;
180
+ }
181
+ else if (scale_y < scale_x) {
182
+ black_bar_width = (actual_width / scale_y - width) / 2;
183
+ }
163
184
  }
164
185
  }
165
186
  else {
166
- double max_width = Gosu::available_width(this);
167
- double max_height = Gosu::available_height(this);
187
+ unsigned max_width = Gosu::available_width(this);
188
+ unsigned max_height = Gosu::available_height(this);
168
189
 
169
- if (width > max_width || height > max_height) {
170
- scale_factor = min(max_width / width, max_height / height);
190
+ if (resizable()) {
191
+ // If the window is resizable, limit its size, without preserving the aspect ratio.
192
+ width = actual_width = min(width, max_width);
193
+ height = actual_height = min(height, max_height);
194
+ }
195
+ else if (width > max_width || height > max_height) {
196
+ // If the window cannot fit on the screen, shrink its contents.
197
+ scale_factor = min(1.0 * max_width / width, 1.0 * max_height / height);
171
198
  actual_width = width * scale_factor;
172
199
  actual_height = height * scale_factor;
173
200
  }
174
201
  }
175
202
 
176
203
  SDL_SetWindowFullscreen(shared_window(), fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
177
- SDL_SetWindowSize(shared_window(), actual_width, actual_height);
204
+ if (!pimpl->resizing) {
205
+ SDL_SetWindowSize(shared_window(), actual_width, actual_height);
206
+ }
178
207
 
179
208
  #if SDL_VERSION_ATLEAST(2, 0, 1)
180
209
  SDL_GL_GetDrawableSize(shared_window(), &actual_width, &actual_height);
@@ -256,19 +285,24 @@ bool Gosu::Window::tick()
256
285
 
257
286
  SDL_Event e;
258
287
  while (SDL_PollEvent(&e)) {
288
+
259
289
  switch (e.type) {
260
- #ifdef GOSU_IS_MAC
261
- // Workaround for https://github.com/gosu/gosu/issues/458
262
- // "Resize" the window to its current dimensions after it is shown.
263
- // Otherwise it will be black on macOS 10.14 (Mojave) until the user moves it around.
264
- // TODO: Since this affects `brew install supertux` as well, maybe file an SDL bug?
265
290
  case SDL_WINDOWEVENT: {
266
- if (e.window.event == SDL_WINDOWEVENT_SHOWN) {
267
- resize(this->width(), this->height(), fullscreen());
291
+ switch (e.window.event) {
292
+ case SDL_WINDOWEVENT_SIZE_CHANGED: {
293
+ if (pimpl->resizable && (width() != e.window.data1 || height() != e.window.data2)) {
294
+ pimpl->resizing = true;
295
+ resize(e.window.data1, e.window.data2, fullscreen());
296
+ pimpl->resizing = false;
297
+ }
298
+ break;
299
+ }
300
+ default: {
301
+ break;
302
+ }
268
303
  }
269
304
  break;
270
305
  }
271
- #endif
272
306
  case SDL_QUIT: {
273
307
  close();
274
308
  break;
@@ -13,12 +13,12 @@ struct Gosu::Window::Impl
13
13
  unique_ptr<Graphics> graphics;
14
14
  unique_ptr<Input> input;
15
15
 
16
- bool fullscreen;
17
16
  double update_interval;
18
17
  string caption;
19
18
  };
20
19
 
21
- Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double update_interval)
20
+ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double update_interval,
21
+ bool resizable)
22
22
  : pimpl(new Impl)
23
23
  {
24
24
  pimpl->window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
@@ -43,7 +43,6 @@ Gosu::Window::Window(unsigned width, unsigned height, bool fullscreen, double up
43
43
  // Now let the controller know about our Input instance.
44
44
  [pimpl->controller trackTextInput:*pimpl->input];
45
45
 
46
- pimpl->fullscreen = fullscreen;
47
46
  pimpl->update_interval = update_interval;
48
47
  }
49
48
 
@@ -63,7 +62,12 @@ unsigned Gosu::Window::height() const
63
62
 
64
63
  bool Gosu::Window::fullscreen() const
65
64
  {
66
- return pimpl->fullscreen;
65
+ return true;
66
+ }
67
+
68
+ bool Gosu::Window::resizable() const
69
+ {
70
+ return false;
67
71
  }
68
72
 
69
73
  void Gosu::Window::resize(unsigned width, unsigned height, bool fullscreen)
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: 0.14.5
4
+ version: 0.14.6.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Raschke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-09 00:00:00.000000000 Z
11
+ date: 2019-10-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  2D game development library.
@@ -163,12 +163,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  version: 1.9.3
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
- - - ">="
166
+ - - ">"
167
167
  - !ruby/object:Gem::Version
168
- version: '0'
168
+ version: 1.3.1
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.7.7
170
+ rubygems_version: 3.0.3
172
171
  signing_key:
173
172
  specification_version: 4
174
173
  summary: 2D game development library.