gosu 0.7.22 → 0.7.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Gosu/Audio.hpp +2 -0
  2. data/Gosu/Fwd.hpp +0 -1
  3. data/Gosu/Gosu.hpp +1 -1
  4. data/Gosu/Graphics.hpp +12 -11
  5. data/Gosu/GraphicsBase.hpp +5 -0
  6. data/Gosu/Image.hpp +0 -14
  7. data/Gosu/Input.hpp +32 -18
  8. data/Gosu/Text.hpp +3 -2
  9. data/Gosu/Version.hpp +2 -2
  10. data/Gosu/Window.hpp +21 -8
  11. data/GosuImpl/Audio/AudioOpenAL.mm +74 -8
  12. data/GosuImpl/Graphics/Common.hpp +25 -1
  13. data/GosuImpl/Graphics/DrawOp.hpp +54 -222
  14. data/GosuImpl/Graphics/DrawOpQueue.hpp +127 -0
  15. data/GosuImpl/Graphics/FormattedString.hpp +63 -20
  16. data/GosuImpl/Graphics/GosuView.hpp +5 -8
  17. data/GosuImpl/Graphics/GosuView.mm +36 -65
  18. data/GosuImpl/Graphics/Graphics.cpp +121 -110
  19. data/GosuImpl/Graphics/Image.cpp +0 -51
  20. data/GosuImpl/Graphics/Macro.hpp +1 -0
  21. data/GosuImpl/Graphics/RenderState.hpp +107 -0
  22. data/GosuImpl/Graphics/TexChunk.cpp +1 -10
  23. data/GosuImpl/Graphics/Text.cpp +22 -10
  24. data/GosuImpl/Graphics/TextMac.cpp +2 -4
  25. data/GosuImpl/Graphics/TextTouch.mm +14 -21
  26. data/GosuImpl/Graphics/TextWin.cpp +5 -2
  27. data/GosuImpl/Graphics/Texture.cpp +11 -10
  28. data/GosuImpl/Graphics/Transform.cpp +3 -1
  29. data/GosuImpl/Input/AccelerometerReader.hpp +10 -0
  30. data/GosuImpl/Input/AccelerometerReader.mm +31 -0
  31. data/GosuImpl/InputMac.mm +51 -24
  32. data/GosuImpl/InputTouch.mm +112 -1
  33. data/GosuImpl/InputWin.cpp +27 -3
  34. data/GosuImpl/InputX.cpp +21 -0
  35. data/GosuImpl/MacUtility.hpp +33 -0
  36. data/GosuImpl/Orientation.hpp +15 -0
  37. data/GosuImpl/Orientation.mm +34 -0
  38. data/GosuImpl/RubyGosu.swg +7 -9
  39. data/GosuImpl/RubyGosu_wrap.cxx +328 -82
  40. data/GosuImpl/RubyGosu_wrap.h +3 -0
  41. data/GosuImpl/TextInputWin.cpp +2 -0
  42. data/GosuImpl/Utility.cpp +2 -0
  43. data/GosuImpl/WindowMac.mm +13 -19
  44. data/GosuImpl/WindowTouch.mm +44 -32
  45. data/GosuImpl/WindowWin.cpp +20 -12
  46. data/GosuImpl/WindowX.cpp +33 -23
  47. data/examples/CptnRuby.rb +8 -9
  48. data/lib/gosu.rb +0 -0
  49. data/lib/gosu/swig_patches.rb +0 -12
  50. data/linux/extconf.rb +2 -2
  51. metadata +11 -7
  52. data/Gosu/RotFlip.hpp +0 -125
  53. data/GosuImpl/Graphics/RotFlip.cpp +0 -184
@@ -0,0 +1,15 @@
1
+ #ifndef GOSUIMPL_ORIENTATION_HPP
2
+ #define GOSUIMPL_ORIENTATION_HPP
3
+
4
+ namespace Gosu
5
+ {
6
+ enum Orientation
7
+ {
8
+ orLandscapeLeft,
9
+ orLandscapeRight
10
+ };
11
+
12
+ Orientation currentOrientation();
13
+ }
14
+
15
+ #endif
@@ -0,0 +1,34 @@
1
+ #include <GosuImpl/Orientation.hpp>
2
+ #include <Gosu/Timing.hpp>
3
+ #import <UIKit/UIKit.h>
4
+
5
+ namespace
6
+ {
7
+ static const unsigned CHANGE_AFTER_MS = 500;
8
+
9
+ Gosu::Orientation orientationToGosu(UIDeviceOrientation orientation)
10
+ {
11
+ return orientation == UIDeviceOrientationLandscapeLeft ? Gosu::orLandscapeLeft : Gosu::orLandscapeRight;
12
+ }
13
+ }
14
+
15
+ Gosu::Orientation Gosu::currentOrientation()
16
+ {
17
+ UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
18
+ unsigned now = Gosu::milliseconds();
19
+
20
+ static Orientation orientation = Gosu::Orientation(-1);
21
+ static unsigned waitingForChangeSince = now;
22
+
23
+ if (!UIDeviceOrientationIsLandscape(newOrientation) || orientationToGosu(newOrientation) == orientation)
24
+ waitingForChangeSince = now;
25
+
26
+ if (now - waitingForChangeSince >= CHANGE_AFTER_MS or orientation == Gosu::Orientation(-1))
27
+ {
28
+ orientation = orientationToGosu(newOrientation);
29
+ [UIApplication sharedApplication].statusBarOrientation =
30
+ (newOrientation == UIDeviceOrientationLandscapeLeft ? UIInterfaceOrientationLandscapeRight : UIInterfaceOrientationLandscapeLeft);
31
+ }
32
+
33
+ return orientation;
34
+ }
@@ -126,6 +126,7 @@
126
126
  #undef write
127
127
  #undef close
128
128
  #undef read
129
+ #undef bind
129
130
  #undef sleep
130
131
  #undef Sleep
131
132
  #undef int8_t
@@ -158,11 +159,8 @@
158
159
  #include <Gosu/Version.hpp>
159
160
  #include <Gosu/Window.hpp>
160
161
 
161
- // For Ruby-only MAX_TEXTURE_SIZE
162
- #include <Gosu/../GosuImpl/Graphics/Texture.hpp>
163
162
  namespace Gosu {
164
163
  void enableUndocumentedRetrofication() { extern bool undocumentedRetrofication; undocumentedRetrofication = true; }
165
- unsigned __maxTextureSize() { return Gosu::Texture::maxTextureSize(); }
166
164
  void register_entity(const std::wstring& name, Gosu::Image* image) { registerEntity(name, image->getData().toBitmap()); }
167
165
  }
168
166
 
@@ -274,7 +272,6 @@ namespace Gosu
274
272
  // Graphics:
275
273
 
276
274
  // ZPos, AlphaMode, FontFlags, TextAlign
277
- %ignore Gosu::zImmediate;
278
275
  %ignore Gosu::AlphaMode;
279
276
  %ignore Gosu::FontFlags;
280
277
  %ignore Gosu::TextAlign;
@@ -284,16 +281,13 @@ namespace Gosu
284
281
  // For screenWidth/screenHeight
285
282
  %ignore Gosu::Graphics;
286
283
  %ignore Gosu::BorderFlags;
287
- //%ignore Gosu::MAX_TEXTURE_SIZE;
284
+ %ignore Gosu::MAX_TEXTURE_SIZE;
288
285
  %include "../Gosu/Graphics.hpp"
289
286
 
290
- // More Ubuntu libgl initialization fail workarounds
291
-
292
- //%constant unsigned MAX_TEXTURE_SIZE = Gosu::Texture::maxTextureSize();
287
+ %constant unsigned MAX_TEXTURE_SIZE = Gosu::MAX_TEXTURE_SIZE;
293
288
 
294
289
  namespace Gosu {
295
290
  void enableUndocumentedRetrofication() { extern bool undocumentedRetrofication; undocumentedRetrofication = true; }
296
- unsigned __maxTextureSize() { return Gosu::Texture::maxTextureSize(); }
297
291
  void register_entity(const std::wstring& name, Gosu::Image* image) { registerEntity(name, image->getData().toBitmap()); }
298
292
  }
299
293
 
@@ -506,6 +500,7 @@ namespace Gosu {
506
500
  %rename("text_input=") setTextInput;
507
501
  %rename("mouse_x=") setMouseX;
508
502
  %rename("mouse_y=") setMouseY;
503
+ %rename("needs_cursor?") needsCursor;
509
504
  %rename("needs_redraw?") needsRedraw;
510
505
  %rename("fullscreen?") fullscreen;
511
506
  %markfunc Gosu::Window "markWindow";
@@ -542,6 +537,9 @@ namespace Gosu {
542
537
  x3, y3, c3, x4, y4, c4,
543
538
  z, mode);
544
539
  }
540
+ void flush() {
541
+ return $self->graphics().flush();
542
+ }
545
543
  bool isButtonDown(Gosu::Button btn) const {
546
544
  return $self->input().down(btn);
547
545
  }
@@ -2157,17 +2157,18 @@ namespace Swig {
2157
2157
  #define SWIGTYPE_p_Gosu__Font swig_types[3]
2158
2158
  #define SWIGTYPE_p_Gosu__GLTexInfo swig_types[4]
2159
2159
  #define SWIGTYPE_p_Gosu__Image swig_types[5]
2160
- #define SWIGTYPE_p_Gosu__Sample swig_types[6]
2161
- #define SWIGTYPE_p_Gosu__SampleInstance swig_types[7]
2162
- #define SWIGTYPE_p_Gosu__Song swig_types[8]
2163
- #define SWIGTYPE_p_Gosu__TextInput swig_types[9]
2164
- #define SWIGTYPE_p_Gosu__Window swig_types[10]
2165
- #define SWIGTYPE_p_boost__arrayT_double_16_t swig_types[11]
2166
- #define SWIGTYPE_p_char swig_types[12]
2167
- #define SWIGTYPE_p_double swig_types[13]
2168
- #define SWIGTYPE_p_std__wstring swig_types[14]
2169
- static swig_type_info *swig_types[16];
2170
- static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0};
2160
+ #define SWIGTYPE_p_Gosu__ImageData swig_types[6]
2161
+ #define SWIGTYPE_p_Gosu__Sample swig_types[7]
2162
+ #define SWIGTYPE_p_Gosu__SampleInstance swig_types[8]
2163
+ #define SWIGTYPE_p_Gosu__Song swig_types[9]
2164
+ #define SWIGTYPE_p_Gosu__TextInput swig_types[10]
2165
+ #define SWIGTYPE_p_Gosu__Window swig_types[11]
2166
+ #define SWIGTYPE_p_boost__arrayT_double_16_t swig_types[12]
2167
+ #define SWIGTYPE_p_char swig_types[13]
2168
+ #define SWIGTYPE_p_double swig_types[14]
2169
+ #define SWIGTYPE_p_std__wstring swig_types[15]
2170
+ static swig_type_info *swig_types[17];
2171
+ static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
2171
2172
  #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2172
2173
  #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2173
2174
 
@@ -2197,6 +2198,7 @@ static VALUE mGosu;
2197
2198
  #undef write
2198
2199
  #undef close
2199
2200
  #undef read
2201
+ #undef bind
2200
2202
  #undef sleep
2201
2203
  #undef Sleep
2202
2204
  #undef int8_t
@@ -2229,11 +2231,8 @@ static VALUE mGosu;
2229
2231
  #include <Gosu/Version.hpp>
2230
2232
  #include <Gosu/Window.hpp>
2231
2233
 
2232
- // For Ruby-only MAX_TEXTURE_SIZE
2233
- #include <Gosu/../GosuImpl/Graphics/Texture.hpp>
2234
2234
  namespace Gosu {
2235
2235
  void enableUndocumentedRetrofication() { extern bool undocumentedRetrofication; undocumentedRetrofication = true; }
2236
- unsigned __maxTextureSize() { return Gosu::Texture::maxTextureSize(); }
2237
2236
  void register_entity(const std::wstring& name, Gosu::Image* image) { registerEntity(name, image->getData().toBitmap()); }
2238
2237
  }
2239
2238
 
@@ -2645,6 +2644,9 @@ SWIGINTERN void Gosu_Window_drawQuad(Gosu::Window *self,double x1,double y1,Gosu
2645
2644
  x3, y3, c3, x4, y4, c4,
2646
2645
  z, mode);
2647
2646
  }
2647
+ SWIGINTERN void Gosu_Window_flush(Gosu::Window *self){
2648
+ return self->graphics().flush();
2649
+ }
2648
2650
  SWIGINTERN bool Gosu_Window_isButtonDown(Gosu::Window const *self,Gosu::Button btn){
2649
2651
  return self->input().down(btn);
2650
2652
  }
@@ -2810,6 +2812,35 @@ bool SwigDirector_Window::needsRedraw() const {
2810
2812
  }
2811
2813
 
2812
2814
 
2815
+ bool SwigDirector_Window::needsCursor() const {
2816
+ bool c_result ;
2817
+ VALUE result;
2818
+
2819
+ result = rb_funcall(swig_get_self(), rb_intern("needs_cursor?"), 0, NULL);
2820
+ bool swig_val;
2821
+ int swig_res = SWIG_AsVal_bool(result, &swig_val);
2822
+ if (!SWIG_IsOK(swig_res)) {
2823
+ Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
2824
+ }
2825
+ c_result = static_cast< bool >(swig_val);
2826
+ return (bool) c_result;
2827
+ }
2828
+
2829
+
2830
+ void SwigDirector_Window::loseFocus() {
2831
+ VALUE result;
2832
+
2833
+ result = rb_funcall(swig_get_self(), rb_intern("lose_focus"), 0, NULL);
2834
+ }
2835
+
2836
+
2837
+ void SwigDirector_Window::releaseMemory() {
2838
+ VALUE result;
2839
+
2840
+ result = rb_funcall(swig_get_self(), rb_intern("release_memory"), 0, NULL);
2841
+ }
2842
+
2843
+
2813
2844
  void SwigDirector_Window::buttonDown(Gosu::Button arg0) {
2814
2845
  VALUE obj0 = Qnil ;
2815
2846
  VALUE result;
@@ -3242,6 +3273,15 @@ fail:
3242
3273
  }
3243
3274
 
3244
3275
 
3276
+ SWIGINTERN VALUE
3277
+ _wrap_zImmediate_get(VALUE self) {
3278
+ VALUE _val;
3279
+
3280
+ _val = SWIG_From_double(static_cast< double >(Gosu::zImmediate));
3281
+ return _val;
3282
+ }
3283
+
3284
+
3245
3285
  SWIGINTERN VALUE
3246
3286
  _wrap_screen_width(int argc, VALUE *argv, VALUE self) {
3247
3287
  unsigned int result;
@@ -3287,44 +3327,32 @@ fail:
3287
3327
 
3288
3328
 
3289
3329
  SWIGINTERN VALUE
3290
- _wrap_rotate(int argc, VALUE *argv, VALUE self) {
3330
+ _wrap_translate(int argc, VALUE *argv, VALUE self) {
3291
3331
  double arg1 ;
3292
- double arg2 = (double) 0 ;
3293
- double arg3 = (double) 0 ;
3332
+ double arg2 ;
3294
3333
  double val1 ;
3295
3334
  int ecode1 = 0 ;
3296
3335
  double val2 ;
3297
3336
  int ecode2 = 0 ;
3298
- double val3 ;
3299
- int ecode3 = 0 ;
3300
3337
  Gosu::Transform result;
3301
3338
  VALUE vresult = Qnil;
3302
3339
 
3303
- if ((argc < 1) || (argc > 3)) {
3304
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3340
+ if ((argc < 2) || (argc > 2)) {
3341
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3305
3342
  }
3306
3343
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
3307
3344
  if (!SWIG_IsOK(ecode1)) {
3308
- SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Gosu::rotate", 1, argv[0] ));
3345
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Gosu::translate", 1, argv[0] ));
3309
3346
  }
3310
3347
  arg1 = static_cast< double >(val1);
3311
- if (argc > 1) {
3312
- ecode2 = SWIG_AsVal_double(argv[1], &val2);
3313
- if (!SWIG_IsOK(ecode2)) {
3314
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::rotate", 2, argv[1] ));
3315
- }
3316
- arg2 = static_cast< double >(val2);
3317
- }
3318
- if (argc > 2) {
3319
- ecode3 = SWIG_AsVal_double(argv[2], &val3);
3320
- if (!SWIG_IsOK(ecode3)) {
3321
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::rotate", 3, argv[2] ));
3322
- }
3323
- arg3 = static_cast< double >(val3);
3324
- }
3348
+ ecode2 = SWIG_AsVal_double(argv[1], &val2);
3349
+ if (!SWIG_IsOK(ecode2)) {
3350
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::translate", 2, argv[1] ));
3351
+ }
3352
+ arg2 = static_cast< double >(val2);
3325
3353
  {
3326
3354
  try {
3327
- result = Gosu::rotate(arg1,arg2,arg3);
3355
+ result = Gosu::translate(arg1,arg2);
3328
3356
  } catch(const std::runtime_error& e) {
3329
3357
  SWIG_exception(SWIG_RuntimeError, e.what());
3330
3358
  }
@@ -3337,32 +3365,44 @@ fail:
3337
3365
 
3338
3366
 
3339
3367
  SWIGINTERN VALUE
3340
- _wrap_translate(int argc, VALUE *argv, VALUE self) {
3368
+ _wrap_rotate(int argc, VALUE *argv, VALUE self) {
3341
3369
  double arg1 ;
3342
- double arg2 ;
3370
+ double arg2 = (double) 0 ;
3371
+ double arg3 = (double) 0 ;
3343
3372
  double val1 ;
3344
3373
  int ecode1 = 0 ;
3345
3374
  double val2 ;
3346
3375
  int ecode2 = 0 ;
3376
+ double val3 ;
3377
+ int ecode3 = 0 ;
3347
3378
  Gosu::Transform result;
3348
3379
  VALUE vresult = Qnil;
3349
3380
 
3350
- if ((argc < 2) || (argc > 2)) {
3351
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3381
+ if ((argc < 1) || (argc > 3)) {
3382
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3352
3383
  }
3353
3384
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
3354
3385
  if (!SWIG_IsOK(ecode1)) {
3355
- SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Gosu::translate", 1, argv[0] ));
3386
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Gosu::rotate", 1, argv[0] ));
3356
3387
  }
3357
3388
  arg1 = static_cast< double >(val1);
3358
- ecode2 = SWIG_AsVal_double(argv[1], &val2);
3359
- if (!SWIG_IsOK(ecode2)) {
3360
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::translate", 2, argv[1] ));
3361
- }
3362
- arg2 = static_cast< double >(val2);
3389
+ if (argc > 1) {
3390
+ ecode2 = SWIG_AsVal_double(argv[1], &val2);
3391
+ if (!SWIG_IsOK(ecode2)) {
3392
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::rotate", 2, argv[1] ));
3393
+ }
3394
+ arg2 = static_cast< double >(val2);
3395
+ }
3396
+ if (argc > 2) {
3397
+ ecode3 = SWIG_AsVal_double(argv[2], &val3);
3398
+ if (!SWIG_IsOK(ecode3)) {
3399
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::rotate", 3, argv[2] ));
3400
+ }
3401
+ arg3 = static_cast< double >(val3);
3402
+ }
3363
3403
  {
3364
3404
  try {
3365
- result = Gosu::translate(arg1,arg2);
3405
+ result = Gosu::rotate(arg1,arg2,arg3);
3366
3406
  } catch(const std::runtime_error& e) {
3367
3407
  SWIG_exception(SWIG_RuntimeError, e.what());
3368
3408
  }
@@ -3408,14 +3448,20 @@ SWIGINTERN VALUE
3408
3448
  _wrap_scale__SWIG_1(int argc, VALUE *argv, VALUE self) {
3409
3449
  double arg1 ;
3410
3450
  double arg2 ;
3451
+ double arg3 = (double) 0 ;
3452
+ double arg4 = (double) 0 ;
3411
3453
  double val1 ;
3412
3454
  int ecode1 = 0 ;
3413
3455
  double val2 ;
3414
3456
  int ecode2 = 0 ;
3457
+ double val3 ;
3458
+ int ecode3 = 0 ;
3459
+ double val4 ;
3460
+ int ecode4 = 0 ;
3415
3461
  Gosu::Transform result;
3416
3462
  VALUE vresult = Qnil;
3417
3463
 
3418
- if ((argc < 2) || (argc > 2)) {
3464
+ if ((argc < 2) || (argc > 4)) {
3419
3465
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3420
3466
  }
3421
3467
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
@@ -3428,9 +3474,23 @@ _wrap_scale__SWIG_1(int argc, VALUE *argv, VALUE self) {
3428
3474
  SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::scale", 2, argv[1] ));
3429
3475
  }
3430
3476
  arg2 = static_cast< double >(val2);
3477
+ if (argc > 2) {
3478
+ ecode3 = SWIG_AsVal_double(argv[2], &val3);
3479
+ if (!SWIG_IsOK(ecode3)) {
3480
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::scale", 3, argv[2] ));
3481
+ }
3482
+ arg3 = static_cast< double >(val3);
3483
+ }
3484
+ if (argc > 3) {
3485
+ ecode4 = SWIG_AsVal_double(argv[3], &val4);
3486
+ if (!SWIG_IsOK(ecode4)) {
3487
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","Gosu::scale", 4, argv[3] ));
3488
+ }
3489
+ arg4 = static_cast< double >(val4);
3490
+ }
3431
3491
  {
3432
3492
  try {
3433
- result = Gosu::scale(arg1,arg2);
3493
+ result = Gosu::scale(arg1,arg2,arg3,arg4);
3434
3494
  } catch(const std::runtime_error& e) {
3435
3495
  SWIG_exception(SWIG_RuntimeError, e.what());
3436
3496
  }
@@ -3444,11 +3504,11 @@ fail:
3444
3504
 
3445
3505
  SWIGINTERN VALUE _wrap_scale(int nargs, VALUE *args, VALUE self) {
3446
3506
  int argc;
3447
- VALUE argv[2];
3507
+ VALUE argv[4];
3448
3508
  int ii;
3449
3509
 
3450
3510
  argc = nargs;
3451
- if (argc > 2) SWIG_fail;
3511
+ if (argc > 4) SWIG_fail;
3452
3512
  for (ii = 0; (ii < argc); ++ii) {
3453
3513
  argv[ii] = args[ii];
3454
3514
  }
@@ -3462,7 +3522,7 @@ SWIGINTERN VALUE _wrap_scale(int nargs, VALUE *args, VALUE self) {
3462
3522
  return _wrap_scale__SWIG_0(nargs, args, self);
3463
3523
  }
3464
3524
  }
3465
- if (argc == 2) {
3525
+ if ((argc >= 2) && (argc <= 4)) {
3466
3526
  int _v;
3467
3527
  {
3468
3528
  int res = SWIG_AsVal_double(argv[0], NULL);
@@ -3474,15 +3534,33 @@ SWIGINTERN VALUE _wrap_scale(int nargs, VALUE *args, VALUE self) {
3474
3534
  _v = SWIG_CheckState(res);
3475
3535
  }
3476
3536
  if (_v) {
3477
- return _wrap_scale__SWIG_1(nargs, args, self);
3537
+ if (argc <= 2) {
3538
+ return _wrap_scale__SWIG_1(nargs, args, self);
3539
+ }
3540
+ {
3541
+ int res = SWIG_AsVal_double(argv[2], NULL);
3542
+ _v = SWIG_CheckState(res);
3543
+ }
3544
+ if (_v) {
3545
+ if (argc <= 3) {
3546
+ return _wrap_scale__SWIG_1(nargs, args, self);
3547
+ }
3548
+ {
3549
+ int res = SWIG_AsVal_double(argv[3], NULL);
3550
+ _v = SWIG_CheckState(res);
3551
+ }
3552
+ if (_v) {
3553
+ return _wrap_scale__SWIG_1(nargs, args, self);
3554
+ }
3555
+ }
3478
3556
  }
3479
3557
  }
3480
3558
  }
3481
3559
 
3482
3560
  fail:
3483
- Ruby_Format_OverloadedError( argc, 2, "scale",
3561
+ Ruby_Format_OverloadedError( argc, 4, "scale",
3484
3562
  " Gosu::Transform scale(double factor)\n"
3485
- " Gosu::Transform scale(double factorX, double factorY)\n");
3563
+ " Gosu::Transform scale(double factorX, double factorY, double fromX, double fromY)\n");
3486
3564
 
3487
3565
  return Qnil;
3488
3566
  }
@@ -3506,28 +3584,6 @@ fail:
3506
3584
  }
3507
3585
 
3508
3586
 
3509
- SWIGINTERN VALUE
3510
- _wrap___max_texture_size(int argc, VALUE *argv, VALUE self) {
3511
- unsigned int result;
3512
- VALUE vresult = Qnil;
3513
-
3514
- if ((argc < 0) || (argc > 0)) {
3515
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3516
- }
3517
- {
3518
- try {
3519
- result = (unsigned int)Gosu::__maxTextureSize();
3520
- } catch(const std::runtime_error& e) {
3521
- SWIG_exception(SWIG_RuntimeError, e.what());
3522
- }
3523
- }
3524
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
3525
- return vresult;
3526
- fail:
3527
- return Qnil;
3528
- }
3529
-
3530
-
3531
3587
  SWIGINTERN VALUE
3532
3588
  _wrap_register_entity(int argc, VALUE *argv, VALUE self) {
3533
3589
  std::wstring *arg1 = 0 ;
@@ -6034,6 +6090,36 @@ fail:
6034
6090
  }
6035
6091
 
6036
6092
 
6093
+ SWIGINTERN VALUE
6094
+ _wrap_Image_get_data(int argc, VALUE *argv, VALUE self) {
6095
+ Gosu::Image *arg1 = (Gosu::Image *) 0 ;
6096
+ void *argp1 = 0 ;
6097
+ int res1 = 0 ;
6098
+ Gosu::ImageData *result = 0 ;
6099
+ VALUE vresult = Qnil;
6100
+
6101
+ if ((argc < 0) || (argc > 0)) {
6102
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6103
+ }
6104
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Image, 0 | 0 );
6105
+ if (!SWIG_IsOK(res1)) {
6106
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Image const *","getData", 1, self ));
6107
+ }
6108
+ arg1 = reinterpret_cast< Gosu::Image * >(argp1);
6109
+ {
6110
+ try {
6111
+ result = (Gosu::ImageData *) &((Gosu::Image const *)arg1)->getData();
6112
+ } catch(const std::runtime_error& e) {
6113
+ SWIG_exception(SWIG_RuntimeError, e.what());
6114
+ }
6115
+ }
6116
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Gosu__ImageData, 0 | 0 );
6117
+ return vresult;
6118
+ fail:
6119
+ return Qnil;
6120
+ }
6121
+
6122
+
6037
6123
  SWIGINTERN VALUE
6038
6124
  _wrap_new_Image__SWIG_0(int argc, VALUE *argv, VALUE self) {
6039
6125
  Gosu::Window *arg1 = 0 ;
@@ -8238,6 +8324,129 @@ fail:
8238
8324
  }
8239
8325
 
8240
8326
 
8327
+ SWIGINTERN VALUE
8328
+ _wrap_Window_needs_cursorq___(int argc, VALUE *argv, VALUE self) {
8329
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
8330
+ void *argp1 = 0 ;
8331
+ int res1 = 0 ;
8332
+ Swig::Director *director = 0;
8333
+ bool upcall = false;
8334
+ bool result;
8335
+ VALUE vresult = Qnil;
8336
+
8337
+ if ((argc < 0) || (argc > 0)) {
8338
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8339
+ }
8340
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
8341
+ if (!SWIG_IsOK(res1)) {
8342
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window const *","needsCursor", 1, self ));
8343
+ }
8344
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
8345
+ director = dynamic_cast<Swig::Director *>(arg1);
8346
+ upcall = (director && (director->swig_get_self() == self));
8347
+ try {
8348
+ {
8349
+ try {
8350
+ if (upcall) {
8351
+ result = (bool)((Gosu::Window const *)arg1)->Gosu::Window::needsCursor();
8352
+ } else {
8353
+ result = (bool)((Gosu::Window const *)arg1)->needsCursor();
8354
+ }
8355
+ } catch(const std::runtime_error& e) {
8356
+ SWIG_exception(SWIG_RuntimeError, e.what());
8357
+ }
8358
+ }
8359
+ } catch (Swig::DirectorException& e) {
8360
+ rb_exc_raise(e.getError());
8361
+ SWIG_fail;
8362
+ }
8363
+ vresult = SWIG_From_bool(static_cast< bool >(result));
8364
+ return vresult;
8365
+ fail:
8366
+ return Qnil;
8367
+ }
8368
+
8369
+
8370
+ SWIGINTERN VALUE
8371
+ _wrap_Window_lose_focus(int argc, VALUE *argv, VALUE self) {
8372
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
8373
+ void *argp1 = 0 ;
8374
+ int res1 = 0 ;
8375
+ Swig::Director *director = 0;
8376
+ bool upcall = false;
8377
+
8378
+ if ((argc < 0) || (argc > 0)) {
8379
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8380
+ }
8381
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
8382
+ if (!SWIG_IsOK(res1)) {
8383
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","loseFocus", 1, self ));
8384
+ }
8385
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
8386
+ director = dynamic_cast<Swig::Director *>(arg1);
8387
+ upcall = (director && (director->swig_get_self() == self));
8388
+ try {
8389
+ {
8390
+ try {
8391
+ if (upcall) {
8392
+ (arg1)->Gosu::Window::loseFocus();
8393
+ } else {
8394
+ (arg1)->loseFocus();
8395
+ }
8396
+ } catch(const std::runtime_error& e) {
8397
+ SWIG_exception(SWIG_RuntimeError, e.what());
8398
+ }
8399
+ }
8400
+ } catch (Swig::DirectorException& e) {
8401
+ rb_exc_raise(e.getError());
8402
+ SWIG_fail;
8403
+ }
8404
+ return Qnil;
8405
+ fail:
8406
+ return Qnil;
8407
+ }
8408
+
8409
+
8410
+ SWIGINTERN VALUE
8411
+ _wrap_Window_release_memory(int argc, VALUE *argv, VALUE self) {
8412
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
8413
+ void *argp1 = 0 ;
8414
+ int res1 = 0 ;
8415
+ Swig::Director *director = 0;
8416
+ bool upcall = false;
8417
+
8418
+ if ((argc < 0) || (argc > 0)) {
8419
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8420
+ }
8421
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
8422
+ if (!SWIG_IsOK(res1)) {
8423
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","releaseMemory", 1, self ));
8424
+ }
8425
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
8426
+ director = dynamic_cast<Swig::Director *>(arg1);
8427
+ upcall = (director && (director->swig_get_self() == self));
8428
+ try {
8429
+ {
8430
+ try {
8431
+ if (upcall) {
8432
+ (arg1)->Gosu::Window::releaseMemory();
8433
+ } else {
8434
+ (arg1)->releaseMemory();
8435
+ }
8436
+ } catch(const std::runtime_error& e) {
8437
+ SWIG_exception(SWIG_RuntimeError, e.what());
8438
+ }
8439
+ }
8440
+ } catch (Swig::DirectorException& e) {
8441
+ rb_exc_raise(e.getError());
8442
+ SWIG_fail;
8443
+ }
8444
+ return Qnil;
8445
+ fail:
8446
+ return Qnil;
8447
+ }
8448
+
8449
+
8241
8450
  SWIGINTERN VALUE
8242
8451
  _wrap_Window_button_down(int argc, VALUE *argv, VALUE self) {
8243
8452
  Gosu::Window *arg1 = (Gosu::Window *) 0 ;
@@ -8737,6 +8946,33 @@ fail:
8737
8946
  }
8738
8947
 
8739
8948
 
8949
+ SWIGINTERN VALUE
8950
+ _wrap_Window_flush(int argc, VALUE *argv, VALUE self) {
8951
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
8952
+ void *argp1 = 0 ;
8953
+ int res1 = 0 ;
8954
+
8955
+ if ((argc < 0) || (argc > 0)) {
8956
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8957
+ }
8958
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
8959
+ if (!SWIG_IsOK(res1)) {
8960
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","flush", 1, self ));
8961
+ }
8962
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
8963
+ {
8964
+ try {
8965
+ Gosu_Window_flush(arg1);
8966
+ } catch(const std::runtime_error& e) {
8967
+ SWIG_exception(SWIG_RuntimeError, e.what());
8968
+ }
8969
+ }
8970
+ return Qnil;
8971
+ fail:
8972
+ return Qnil;
8973
+ }
8974
+
8975
+
8740
8976
  SWIGINTERN VALUE
8741
8977
  _wrap_Window_button_downq___(int argc, VALUE *argv, VALUE self) {
8742
8978
  Gosu::Window *arg1 = (Gosu::Window *) 0 ;
@@ -9712,6 +9948,7 @@ static swig_type_info _swigt__p_Gosu__Color = {"_p_Gosu__Color", "Gosu::Color *"
9712
9948
  static swig_type_info _swigt__p_Gosu__Font = {"_p_Gosu__Font", "Gosu::Font *", 0, 0, (void*)0, 0};
9713
9949
  static swig_type_info _swigt__p_Gosu__GLTexInfo = {"_p_Gosu__GLTexInfo", "Gosu::GLTexInfo *", 0, 0, (void*)0, 0};
9714
9950
  static swig_type_info _swigt__p_Gosu__Image = {"_p_Gosu__Image", "Gosu::Image *", 0, 0, (void*)0, 0};
9951
+ static swig_type_info _swigt__p_Gosu__ImageData = {"_p_Gosu__ImageData", "Gosu::ImageData *", 0, 0, (void*)0, 0};
9715
9952
  static swig_type_info _swigt__p_Gosu__Sample = {"_p_Gosu__Sample", "Gosu::Sample *", 0, 0, (void*)0, 0};
9716
9953
  static swig_type_info _swigt__p_Gosu__SampleInstance = {"_p_Gosu__SampleInstance", "Gosu::SampleInstance *", 0, 0, (void*)0, 0};
9717
9954
  static swig_type_info _swigt__p_Gosu__Song = {"_p_Gosu__Song", "Gosu::Song *", 0, 0, (void*)0, 0};
@@ -9729,6 +9966,7 @@ static swig_type_info *swig_type_initial[] = {
9729
9966
  &_swigt__p_Gosu__Font,
9730
9967
  &_swigt__p_Gosu__GLTexInfo,
9731
9968
  &_swigt__p_Gosu__Image,
9969
+ &_swigt__p_Gosu__ImageData,
9732
9970
  &_swigt__p_Gosu__Sample,
9733
9971
  &_swigt__p_Gosu__SampleInstance,
9734
9972
  &_swigt__p_Gosu__Song,
@@ -9746,6 +9984,7 @@ static swig_cast_info _swigc__p_Gosu__Color[] = { {&_swigt__p_Gosu__Color, 0, 0
9746
9984
  static swig_cast_info _swigc__p_Gosu__Font[] = { {&_swigt__p_Gosu__Font, 0, 0, 0},{0, 0, 0, 0}};
9747
9985
  static swig_cast_info _swigc__p_Gosu__GLTexInfo[] = { {&_swigt__p_Gosu__GLTexInfo, 0, 0, 0},{0, 0, 0, 0}};
9748
9986
  static swig_cast_info _swigc__p_Gosu__Image[] = { {&_swigt__p_Gosu__Image, 0, 0, 0},{0, 0, 0, 0}};
9987
+ static swig_cast_info _swigc__p_Gosu__ImageData[] = { {&_swigt__p_Gosu__ImageData, 0, 0, 0},{0, 0, 0, 0}};
9749
9988
  static swig_cast_info _swigc__p_Gosu__Sample[] = { {&_swigt__p_Gosu__Sample, 0, 0, 0},{0, 0, 0, 0}};
9750
9989
  static swig_cast_info _swigc__p_Gosu__SampleInstance[] = { {&_swigt__p_Gosu__SampleInstance, 0, 0, 0},{0, 0, 0, 0}};
9751
9990
  static swig_cast_info _swigc__p_Gosu__Song[] = { {&_swigt__p_Gosu__Song, 0, 0, 0},{0, 0, 0, 0}};
@@ -9763,6 +10002,7 @@ static swig_cast_info *swig_cast_initial[] = {
9763
10002
  _swigc__p_Gosu__Font,
9764
10003
  _swigc__p_Gosu__GLTexInfo,
9765
10004
  _swigc__p_Gosu__Image,
10005
+ _swigc__p_Gosu__ImageData,
9766
10006
  _swigc__p_Gosu__Sample,
9767
10007
  _swigc__p_Gosu__SampleInstance,
9768
10008
  _swigc__p_Gosu__Song,
@@ -10034,8 +10274,8 @@ SWIGEXPORT void Init_gosu(void) {
10034
10274
  SWIG_RubyInitializeTrackings();
10035
10275
  rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(0)));
10036
10276
  rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(7)));
10037
- rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(22)));
10038
- rb_define_const(mGosu, "VERSION", SWIG_FromCharPtr("0.7.22"));
10277
+ rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(23)));
10278
+ rb_define_const(mGosu, "VERSION", SWIG_FromCharPtr("0.7.23"));
10039
10279
  rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
10040
10280
  rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
10041
10281
  rb_define_module_function(mGosu, "degrees_to_radians", VALUEFUNC(_wrap_degrees_to_radians), -1);
@@ -10047,13 +10287,14 @@ SWIGEXPORT void Init_gosu(void) {
10047
10287
  rb_define_module_function(mGosu, "normalize_angle", VALUEFUNC(_wrap_normalize_angle), -1);
10048
10288
  rb_define_module_function(mGosu, "distance", VALUEFUNC(_wrap_distance), -1);
10049
10289
  rb_define_module_function(mGosu, "default_font_name", VALUEFUNC(_wrap_default_font_name), -1);
10290
+ rb_define_singleton_method(mGosu, "zImmediate", VALUEFUNC(_wrap_zImmediate_get), 0);
10050
10291
  rb_define_module_function(mGosu, "screen_width", VALUEFUNC(_wrap_screen_width), -1);
10051
10292
  rb_define_module_function(mGosu, "screen_height", VALUEFUNC(_wrap_screen_height), -1);
10052
- rb_define_module_function(mGosu, "rotate", VALUEFUNC(_wrap_rotate), -1);
10053
10293
  rb_define_module_function(mGosu, "translate", VALUEFUNC(_wrap_translate), -1);
10294
+ rb_define_module_function(mGosu, "rotate", VALUEFUNC(_wrap_rotate), -1);
10054
10295
  rb_define_module_function(mGosu, "scale", VALUEFUNC(_wrap_scale), -1);
10296
+ rb_define_const(mGosu, "MAX_TEXTURE_SIZE", SWIG_From_unsigned_SS_int(static_cast< unsigned int >(Gosu::MAX_TEXTURE_SIZE)));
10055
10297
  rb_define_module_function(mGosu, "enable_undocumented_retrofication", VALUEFUNC(_wrap_enable_undocumented_retrofication), -1);
10056
- rb_define_module_function(mGosu, "__max_texture_size", VALUEFUNC(_wrap___max_texture_size), -1);
10057
10298
  rb_define_module_function(mGosu, "register_entity", VALUEFUNC(_wrap_register_entity), -1);
10058
10299
 
10059
10300
  SwigClassColor.klass = rb_define_class_under(mGosu, "Color", rb_cObject);
@@ -10140,6 +10381,7 @@ SWIGEXPORT void Init_gosu(void) {
10140
10381
  rb_define_method(SwigClassImage.klass, "draw", VALUEFUNC(_wrap_Image_draw), -1);
10141
10382
  rb_define_method(SwigClassImage.klass, "draw_mod", VALUEFUNC(_wrap_Image_draw_mod), -1);
10142
10383
  rb_define_method(SwigClassImage.klass, "draw_rot", VALUEFUNC(_wrap_Image_draw_rot), -1);
10384
+ rb_define_method(SwigClassImage.klass, "get_data", VALUEFUNC(_wrap_Image_get_data), -1);
10143
10385
  rb_define_method(SwigClassImage.klass, "draw_as_quad", VALUEFUNC(_wrap_Image_draw_as_quad), -1);
10144
10386
  rb_define_method(SwigClassImage.klass, "gl_tex_info", VALUEFUNC(_wrap_Image_gl_tex_info), -1);
10145
10387
  rb_define_singleton_method(SwigClassImage.klass, "from_text4", VALUEFUNC(_wrap_Image_from_text4), -1);
@@ -10351,11 +10593,15 @@ SWIGEXPORT void Init_gosu(void) {
10351
10593
  rb_define_method(SwigClassWindow.klass, "update", VALUEFUNC(_wrap_Window_update), -1);
10352
10594
  rb_define_method(SwigClassWindow.klass, "draw", VALUEFUNC(_wrap_Window_draw), -1);
10353
10595
  rb_define_method(SwigClassWindow.klass, "needs_redraw?", VALUEFUNC(_wrap_Window_needs_redrawq___), -1);
10596
+ rb_define_method(SwigClassWindow.klass, "needs_cursor?", VALUEFUNC(_wrap_Window_needs_cursorq___), -1);
10597
+ rb_define_method(SwigClassWindow.klass, "lose_focus", VALUEFUNC(_wrap_Window_lose_focus), -1);
10598
+ rb_define_method(SwigClassWindow.klass, "release_memory", VALUEFUNC(_wrap_Window_release_memory), -1);
10354
10599
  rb_define_method(SwigClassWindow.klass, "button_down", VALUEFUNC(_wrap_Window_button_down), -1);
10355
10600
  rb_define_method(SwigClassWindow.klass, "button_up", VALUEFUNC(_wrap_Window_button_up), -1);
10356
10601
  rb_define_method(SwigClassWindow.klass, "draw_line", VALUEFUNC(_wrap_Window_draw_line), -1);
10357
10602
  rb_define_method(SwigClassWindow.klass, "draw_triangle", VALUEFUNC(_wrap_Window_draw_triangle), -1);
10358
10603
  rb_define_method(SwigClassWindow.klass, "draw_quad", VALUEFUNC(_wrap_Window_draw_quad), -1);
10604
+ rb_define_method(SwigClassWindow.klass, "flush", VALUEFUNC(_wrap_Window_flush), -1);
10359
10605
  rb_define_method(SwigClassWindow.klass, "button_down?", VALUEFUNC(_wrap_Window_button_downq___), -1);
10360
10606
  rb_define_singleton_method(SwigClassWindow.klass, "char_to_button_id", VALUEFUNC(_wrap_Window_char_to_button_id), -1);
10361
10607
  rb_define_singleton_method(SwigClassWindow.klass, "button_id_to_char", VALUEFUNC(_wrap_Window_button_id_to_char), -1);