gosu 1.1.0.pre2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/src/RubyGosu.cxx CHANGED
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 4.1.0
3
+ * Version 4.0.2
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -2203,7 +2203,7 @@ static VALUE mGosu;
2203
2203
  #define SWIG_RUBY_THREAD_END_BLOCK
2204
2204
 
2205
2205
 
2206
- #define SWIGVERSION 0x040100
2206
+ #define SWIGVERSION 0x040002
2207
2207
  #define SWIG_VERSION SWIGVERSION
2208
2208
 
2209
2209
 
@@ -2353,7 +2353,7 @@ namespace Gosu
2353
2353
  {
2354
2354
  void draw_line(double x1, double y1, Gosu::Color c1,
2355
2355
  double x2, double y2, Gosu::Color c2,
2356
- Gosu::ZPos z = 0, Gosu::AlphaMode mode = Gosu::AM_DEFAULT)
2356
+ Gosu::ZPos z = 0, Gosu::BlendMode mode = Gosu::BM_DEFAULT)
2357
2357
  {
2358
2358
  Gosu::Graphics::draw_line(x1, y1, c1, x2, y2, c2, z, mode);
2359
2359
  }
@@ -2361,7 +2361,7 @@ namespace Gosu
2361
2361
  void draw_triangle(double x1, double y1, Gosu::Color c1,
2362
2362
  double x2, double y2, Gosu::Color c2,
2363
2363
  double x3, double y3, Gosu::Color c3,
2364
- Gosu::ZPos z = 0, Gosu::AlphaMode mode = Gosu::AM_DEFAULT)
2364
+ Gosu::ZPos z = 0, Gosu::BlendMode mode = Gosu::BM_DEFAULT)
2365
2365
  {
2366
2366
  Gosu::Graphics::draw_triangle(x1, y1, c1, x2, y2, c2, x3, y3, c3, z, mode);
2367
2367
  }
@@ -2370,13 +2370,13 @@ namespace Gosu
2370
2370
  double x2, double y2, Gosu::Color c2,
2371
2371
  double x3, double y3, Gosu::Color c3,
2372
2372
  double x4, double y4, Gosu::Color c4,
2373
- Gosu::ZPos z = 0, Gosu::AlphaMode mode = Gosu::AM_DEFAULT)
2373
+ Gosu::ZPos z = 0, Gosu::BlendMode mode = Gosu::BM_DEFAULT)
2374
2374
  {
2375
2375
  Gosu::Graphics::draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode);
2376
2376
  }
2377
2377
 
2378
2378
  void draw_rect(double x, double y, double width, double height, Gosu::Color c,
2379
- Gosu::ZPos z = 0, Gosu::AlphaMode mode = Gosu::AM_DEFAULT)
2379
+ Gosu::ZPos z = 0, Gosu::BlendMode mode = Gosu::BM_DEFAULT)
2380
2380
  {
2381
2381
  Gosu::Graphics::draw_rect(x, y, width, height, c, z, mode);
2382
2382
  }
@@ -2519,7 +2519,7 @@ SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
2519
2519
  }
2520
2520
 
2521
2521
 
2522
- /*@SWIG:/usr/local/Cellar/swig/HEAD-975f8fc/share/swig/4.1.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2522
+ /*@SWIG:/opt/homebrew/Cellar/swig/4.0.2/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2523
2523
  SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg)
2524
2524
  {
2525
2525
  VALUE *args = (VALUE *)arg;
@@ -2562,7 +2562,14 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2562
2562
  #include <string>
2563
2563
 
2564
2564
 
2565
- /*@SWIG:/usr/local/Cellar/swig/HEAD-975f8fc/share/swig/4.1.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2565
+ SWIGINTERNINLINE VALUE
2566
+ SWIG_From_unsigned_SS_char (unsigned char value)
2567
+ {
2568
+ return SWIG_From_unsigned_SS_long (value);
2569
+ }
2570
+
2571
+
2572
+ /*@SWIG:/opt/homebrew/Cellar/swig/4.0.2/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2566
2573
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg)
2567
2574
  {
2568
2575
  VALUE *args = (VALUE *)arg;
@@ -2591,44 +2598,24 @@ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
2591
2598
  return SWIG_TypeError;
2592
2599
  }
2593
2600
 
2594
-
2595
- SWIGINTERN int
2596
- SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
2597
- {
2598
- unsigned long v;
2599
- int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
2600
- if (SWIG_IsOK(res)) {
2601
- if ((v > UINT_MAX)) {
2602
- return SWIG_OverflowError;
2603
- } else {
2604
- if (val) *val = static_cast< unsigned int >(v);
2605
- }
2606
- }
2607
- return res;
2608
- }
2609
-
2610
-
2611
- SWIGINTERNINLINE VALUE
2612
- SWIG_From_unsigned_SS_char (unsigned char value)
2613
- {
2614
- return SWIG_From_unsigned_SS_long (value);
2615
- }
2616
-
2617
2601
  SWIGINTERN Gosu::Color Gosu_Color_rgb(Gosu::Color::Channel r,Gosu::Color::Channel g,Gosu::Color::Channel b){
2618
- return Gosu::Color(r, g, b);
2602
+ return Gosu::Color{r, g, b};
2619
2603
  }
2620
2604
  SWIGINTERN Gosu::Color Gosu_Color_rgba__SWIG_0(Gosu::Color::Channel r,Gosu::Color::Channel g,Gosu::Color::Channel b,Gosu::Color::Channel a){
2621
- return Gosu::Color(a, r, g, b);
2605
+ return Gosu::Color{r, g, b}.with_alpha(a);
2622
2606
  }
2623
2607
  SWIGINTERN Gosu::Color Gosu_Color_rgba__SWIG_1(std::uint32_t rgba){
2624
- return Gosu::Color((rgba >> 0) & 0xff, (rgba >> 24) & 0xff,
2625
- (rgba >> 16) & 0xff, (rgba >> 8) & 0xff);
2608
+ const std::uint32_t argb = (rgba >> 8) & 0xffffff | ((rgba & 0xff) << 24);
2609
+ return Gosu::Color{argb};
2626
2610
  }
2627
2611
  SWIGINTERN Gosu::Color Gosu_Color_argb__SWIG_1(Gosu::Color::Channel a,Gosu::Color::Channel r,Gosu::Color::Channel g,Gosu::Color::Channel b){
2628
- return Gosu::Color(a, r, g, b);
2612
+ return Gosu::Color{r, g, b}.with_alpha(a);
2629
2613
  }
2630
2614
  SWIGINTERN Gosu::Color Gosu_Color_argb__SWIG_2(std::uint32_t argb){
2631
- return Gosu::Color(argb);
2615
+ return Gosu::Color{argb};
2616
+ }
2617
+ SWIGINTERN Gosu::Color Gosu_Color_from_ahsv(Gosu::Color::Channel alpha,double h,double s,double v){
2618
+ return Gosu::Color::from_hsv(h, s, v).with_alpha(alpha);
2632
2619
  }
2633
2620
  SWIGINTERN std::uint32_t Gosu_Color_to_i(Gosu::Color const *self){
2634
2621
  return self->argb();
@@ -2638,10 +2625,10 @@ SWIGINTERN Gosu::Color Gosu_Color_dup(Gosu::Color const *self){
2638
2625
  }
2639
2626
  SWIGINTERN std::string Gosu_Color_inspect(Gosu::Color const *self){
2640
2627
  char buffer[32];
2641
- // snprintf is either member of std:: or a #define for ruby_snprintf.
2628
+ // snprintf is either a member of std:: or a #define for ruby_snprintf.
2642
2629
  using namespace std;
2643
- snprintf(buffer, sizeof buffer, "#<Gosu::Color:ARGB=0x%02x_%06x>",
2644
- self->alpha(), self->argb() & 0xffffff);
2630
+ snprintf(buffer, sizeof buffer, "#<Gosu::Color:ARGB=0x%02x_%02x%02x%02x>",
2631
+ self->alpha, self->red, self->green, self->blue);
2645
2632
  return buffer;
2646
2633
  }
2647
2634
 
@@ -2768,7 +2755,7 @@ SWIG_AsPtr_std_string (VALUE obj, std::string **val)
2768
2755
  }
2769
2756
 
2770
2757
 
2771
- /*@SWIG:/usr/local/Cellar/swig/HEAD-975f8fc/share/swig/4.1.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2758
+ /*@SWIG:/opt/homebrew/Cellar/swig/4.0.2/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2772
2759
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg)
2773
2760
  {
2774
2761
  VALUE *args = (VALUE *)arg;
@@ -2923,7 +2910,7 @@ SWIGINTERN Gosu::Image *new_Gosu_Image(VALUE source,VALUE options=0){
2923
2910
 
2924
2911
  return new Gosu::Image(bmp, src_x, src_y, src_width, src_height, flags);
2925
2912
  }
2926
- SWIGINTERN void Gosu_Image_draw_as_quad(Gosu::Image *self,double x1,double y1,Gosu::Color c1,double x2,double y2,Gosu::Color c2,double x3,double y3,Gosu::Color c3,double x4,double y4,Gosu::Color c4,Gosu::ZPos z,Gosu::AlphaMode mode=Gosu::AM_DEFAULT){
2913
+ SWIGINTERN void Gosu_Image_draw_as_quad(Gosu::Image *self,double x1,double y1,Gosu::Color c1,double x2,double y2,Gosu::Color c2,double x3,double y3,Gosu::Color c3,double x4,double y4,Gosu::Color c4,Gosu::ZPos z,Gosu::BlendMode mode=Gosu::BM_DEFAULT){
2927
2914
  self->data().draw(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode);
2928
2915
  }
2929
2916
  SWIGINTERN Gosu::GLTexInfo *Gosu_Image_gl_tex_info(Gosu::Image const *self){
@@ -3167,7 +3154,7 @@ SWIGINTERN std::string Gosu_Image_inspect(Gosu::Image const *self,int max_width=
3167
3154
  Gosu::Bitmap bmp = self->data().to_bitmap();
3168
3155
  // This is the scaled image width inside the ASCII art border, so make sure
3169
3156
  // there will be room for a leading and trailing '#' character.
3170
- int w = Gosu::clamp<int>(max_width - 2, 0, bmp.width());
3157
+ int w = std::clamp<int>(max_width - 2, 0, bmp.width());
3171
3158
  // For images with width == 0, the output will have one line per pixel.
3172
3159
  // Otherwise, scale proportionally.
3173
3160
  int h = (w ? bmp.height() * w / bmp.width() : bmp.height());
@@ -3183,7 +3170,7 @@ SWIGINTERN std::string Gosu_Image_inspect(Gosu::Image const *self,int max_width=
3183
3170
  for (int x = 0; x < w; ++x) {
3184
3171
  int scaled_x = x * bmp.width() / w;
3185
3172
  int scaled_y = y * bmp.height() / h;
3186
- int alpha3bit = bmp.get_pixel(scaled_x, scaled_y).alpha() / 32;
3173
+ int alpha3bit = bmp.get_pixel(scaled_x, scaled_y).alpha / 32;
3187
3174
  str[(y + 1) * stride + (x + 1)] = " .:ioVM@"[alpha3bit];
3188
3175
  }
3189
3176
  str[(y + 1) * stride + (w + 2)] = '\n'; // newline after row of pixels
@@ -3218,6 +3205,22 @@ SWIGINTERN void Gosu_TextInput_set_selection_start(Gosu::TextInput *self,VALUE s
3218
3205
  std::string prefix = StringValueCStr(rb_prefix);
3219
3206
  self->set_selection_start(std::min(prefix.length(), self->text().length()));
3220
3207
  }
3208
+
3209
+ SWIGINTERN int
3210
+ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
3211
+ {
3212
+ unsigned long v;
3213
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
3214
+ if (SWIG_IsOK(res)) {
3215
+ if ((v > UINT_MAX)) {
3216
+ return SWIG_OverflowError;
3217
+ } else {
3218
+ if (val) *val = static_cast< unsigned int >(v);
3219
+ }
3220
+ }
3221
+ return res;
3222
+ }
3223
+
3221
3224
  SWIGINTERN void Gosu_Window_set_width(Gosu::Window *self,unsigned int width){
3222
3225
  self->resize(width, self->height(), self->fullscreen());
3223
3226
  }
@@ -3300,7 +3303,7 @@ std::string SwigDirector_TextInput::filter(std::string text) const {
3300
3303
  }
3301
3304
 
3302
3305
 
3303
- SwigDirector_Window::SwigDirector_Window(VALUE self,int width,int height,unsigned int window_flags,double update_interval): Gosu::Window(width, height, window_flags, update_interval), Swig::Director(self) {
3306
+ SwigDirector_Window::SwigDirector_Window(VALUE self, int width, int height, unsigned int window_flags, double update_interval): Gosu::Window(width, height, window_flags, update_interval), Swig::Director(self) {
3304
3307
 
3305
3308
  }
3306
3309
 
@@ -3382,6 +3385,13 @@ bool SwigDirector_Window::needs_cursor() const {
3382
3385
  }
3383
3386
 
3384
3387
 
3388
+ void SwigDirector_Window::gain_focus() {
3389
+ VALUE SWIGUNUSED result;
3390
+
3391
+ result = rb_funcall(swig_get_self(), rb_intern("protected_gain_focus"), 0, Qnil);
3392
+ }
3393
+
3394
+
3385
3395
  void SwigDirector_Window::lose_focus() {
3386
3396
  VALUE SWIGUNUSED result;
3387
3397
 
@@ -3864,8 +3874,8 @@ fail:
3864
3874
 
3865
3875
 
3866
3876
  SWIGINTERN VALUE
3867
- _wrap_language(int argc, VALUE *argv, VALUE self) {
3868
- std::string result;
3877
+ _wrap_user_languages(int argc, VALUE *argv, VALUE self) {
3878
+ SwigValueWrapper< std::vector< std::string > > result;
3869
3879
  VALUE vresult = Qnil;
3870
3880
 
3871
3881
  if ((argc < 0) || (argc > 0)) {
@@ -3873,15 +3883,17 @@ _wrap_language(int argc, VALUE *argv, VALUE self) {
3873
3883
  }
3874
3884
  {
3875
3885
  try {
3876
- result = Gosu::language();
3886
+ result = Gosu::user_languages();
3877
3887
  }
3878
3888
  catch (const std::exception& e) {
3879
3889
  SWIG_exception(SWIG_RuntimeError, e.what());
3880
3890
  }
3881
3891
  }
3882
3892
  {
3883
- vresult = rb_str_new2((&result)->c_str());
3884
- ENFORCE_UTF8(vresult);
3893
+ vresult = rb_ary_new2((&result)->size());
3894
+ for (std::size_t i = 0; i < (&result)->size(); i++) {
3895
+ rb_ary_store(vresult, i, rb_str_new2((*&result)[i].c_str()));
3896
+ }
3885
3897
  }
3886
3898
  return vresult;
3887
3899
  fail:
@@ -3911,271 +3923,97 @@ fail:
3911
3923
  static swig_class SwigClassColor;
3912
3924
 
3913
3925
  SWIGINTERN VALUE
3914
- _wrap_new_Color__SWIG_0(int argc, VALUE *argv, VALUE self) {
3915
- const char *classname SWIGUNUSED = "Gosu::Color";
3916
- Gosu::Color *result = 0 ;
3917
-
3918
- if ((argc < 0) || (argc > 0)) {
3919
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3920
- }
3921
- {
3922
- try {
3923
- result = (Gosu::Color *)new Gosu::Color();
3924
- DATA_PTR(self) = result;
3925
- SWIG_RubyAddTracking(result, self);
3926
- }
3927
- catch (const std::exception& e) {
3928
- SWIG_exception(SWIG_RuntimeError, e.what());
3929
- }
3930
- }
3931
- return self;
3932
- fail:
3933
- return Qnil;
3934
- }
3935
-
3936
-
3937
- SWIGINTERN VALUE
3938
- _wrap_new_Color__SWIG_1(int argc, VALUE *argv, VALUE self) {
3939
- unsigned int arg1 ;
3940
- unsigned int val1 ;
3941
- int ecode1 = 0 ;
3942
- const char *classname SWIGUNUSED = "Gosu::Color";
3943
- Gosu::Color *result = 0 ;
3926
+ _wrap_Color_red_set(int argc, VALUE *argv, VALUE self) {
3927
+ Gosu::Color *arg1 = (Gosu::Color *) 0 ;
3928
+ Gosu::Color::Channel arg2 ;
3929
+ void *argp1 = 0 ;
3930
+ int res1 = 0 ;
3944
3931
 
3945
3932
  if ((argc < 1) || (argc > 1)) {
3946
3933
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3947
3934
  }
3948
- ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
3949
- if (!SWIG_IsOK(ecode1)) {
3950
- SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","Color", 1, argv[0] ));
3951
- }
3952
- arg1 = static_cast< unsigned int >(val1);
3935
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
3936
+ if (!SWIG_IsOK(res1)) {
3937
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","red", 1, self ));
3938
+ }
3939
+ arg1 = reinterpret_cast< Gosu::Color * >(argp1);
3953
3940
  {
3954
- try {
3955
- result = (Gosu::Color *)new Gosu::Color(arg1);
3956
- DATA_PTR(self) = result;
3957
- SWIG_RubyAddTracking(result, self);
3958
- }
3959
- catch (const std::exception& e) {
3960
- SWIG_exception(SWIG_RuntimeError, e.what());
3961
- }
3941
+ arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
3962
3942
  }
3963
- return self;
3943
+ if (arg1) (arg1)->red = arg2;
3944
+ return Qnil;
3964
3945
  fail:
3965
3946
  return Qnil;
3966
3947
  }
3967
3948
 
3968
3949
 
3969
3950
  SWIGINTERN VALUE
3970
- _wrap_new_Color__SWIG_2(int argc, VALUE *argv, VALUE self) {
3971
- Gosu::Color::Channel arg1 ;
3972
- Gosu::Color::Channel arg2 ;
3973
- Gosu::Color::Channel arg3 ;
3974
- const char *classname SWIGUNUSED = "Gosu::Color";
3975
- Gosu::Color *result = 0 ;
3951
+ _wrap_Color_red_get(int argc, VALUE *argv, VALUE self) {
3952
+ Gosu::Color *arg1 = (Gosu::Color *) 0 ;
3953
+ void *argp1 = 0 ;
3954
+ int res1 = 0 ;
3955
+ Gosu::Color::Channel result;
3956
+ VALUE vresult = Qnil;
3976
3957
 
3977
- if ((argc < 3) || (argc > 3)) {
3978
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3979
- }
3980
- {
3981
- arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
3982
- }
3983
- {
3984
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
3985
- }
3986
- {
3987
- arg3 = Gosu::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
3958
+ if ((argc < 0) || (argc > 0)) {
3959
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3988
3960
  }
3989
- {
3990
- try {
3991
- result = (Gosu::Color *)new Gosu::Color(arg1,arg2,arg3);
3992
- DATA_PTR(self) = result;
3993
- SWIG_RubyAddTracking(result, self);
3994
- }
3995
- catch (const std::exception& e) {
3996
- SWIG_exception(SWIG_RuntimeError, e.what());
3997
- }
3961
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
3962
+ if (!SWIG_IsOK(res1)) {
3963
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","red", 1, self ));
3998
3964
  }
3999
- return self;
3965
+ arg1 = reinterpret_cast< Gosu::Color * >(argp1);
3966
+ result = ((arg1)->red);
3967
+ vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
3968
+ return vresult;
4000
3969
  fail:
4001
3970
  return Qnil;
4002
3971
  }
4003
3972
 
4004
3973
 
4005
3974
  SWIGINTERN VALUE
4006
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
4007
- _wrap_Color_allocate(VALUE self)
4008
- #else
4009
- _wrap_Color_allocate(int argc, VALUE *argv, VALUE self)
4010
- #endif
4011
- {
4012
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Gosu__Color);
4013
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
4014
- rb_obj_call_init(vresult, argc, argv);
4015
- #endif
4016
- return vresult;
4017
- }
4018
-
4019
-
4020
- SWIGINTERN VALUE
4021
- _wrap_new_Color__SWIG_3(int argc, VALUE *argv, VALUE self) {
4022
- Gosu::Color::Channel arg1 ;
3975
+ _wrap_Color_green_set(int argc, VALUE *argv, VALUE self) {
3976
+ Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4023
3977
  Gosu::Color::Channel arg2 ;
4024
- Gosu::Color::Channel arg3 ;
4025
- Gosu::Color::Channel arg4 ;
4026
- const char *classname SWIGUNUSED = "Gosu::Color";
4027
- Gosu::Color *result = 0 ;
3978
+ void *argp1 = 0 ;
3979
+ int res1 = 0 ;
4028
3980
 
4029
- if ((argc < 4) || (argc > 4)) {
4030
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
4031
- }
4032
- {
4033
- arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4034
- }
4035
- {
4036
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4037
- }
4038
- {
4039
- arg3 = Gosu::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
3981
+ if ((argc < 1) || (argc > 1)) {
3982
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4040
3983
  }
4041
- {
4042
- arg4 = Gosu::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
3984
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
3985
+ if (!SWIG_IsOK(res1)) {
3986
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","green", 1, self ));
4043
3987
  }
3988
+ arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4044
3989
  {
4045
- try {
4046
- result = (Gosu::Color *)new Gosu::Color(arg1,arg2,arg3,arg4);
4047
- DATA_PTR(self) = result;
4048
- SWIG_RubyAddTracking(result, self);
4049
- }
4050
- catch (const std::exception& e) {
4051
- SWIG_exception(SWIG_RuntimeError, e.what());
4052
- }
3990
+ arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4053
3991
  }
4054
- return self;
4055
- fail:
3992
+ if (arg1) (arg1)->green = arg2;
4056
3993
  return Qnil;
4057
- }
4058
-
4059
-
4060
- SWIGINTERN VALUE _wrap_new_Color(int nargs, VALUE *args, VALUE self) {
4061
- int argc;
4062
- VALUE argv[4];
4063
- int ii;
4064
-
4065
- argc = nargs;
4066
- if (argc > 4) SWIG_fail;
4067
- for (ii = 0; (ii < argc); ++ii) {
4068
- argv[ii] = args[ii];
4069
- }
4070
- if (argc == 0) {
4071
- return _wrap_new_Color__SWIG_0(nargs, args, self);
4072
- }
4073
- if (argc == 1) {
4074
- int _v;
4075
- {
4076
- int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
4077
- _v = SWIG_CheckState(res);
4078
- }
4079
- if (_v) {
4080
- return _wrap_new_Color__SWIG_1(nargs, args, self);
4081
- }
4082
- }
4083
- if (argc == 3) {
4084
- int _v;
4085
- {
4086
- _v = !!rb_respond_to(argv[0], rb_intern("to_i"));
4087
- }
4088
- if (_v) {
4089
- {
4090
- _v = !!rb_respond_to(argv[1], rb_intern("to_i"));
4091
- }
4092
- if (_v) {
4093
- {
4094
- _v = !!rb_respond_to(argv[2], rb_intern("to_i"));
4095
- }
4096
- if (_v) {
4097
- return _wrap_new_Color__SWIG_2(nargs, args, self);
4098
- }
4099
- }
4100
- }
4101
- }
4102
- if (argc == 4) {
4103
- int _v;
4104
- {
4105
- _v = !!rb_respond_to(argv[0], rb_intern("to_i"));
4106
- }
4107
- if (_v) {
4108
- {
4109
- _v = !!rb_respond_to(argv[1], rb_intern("to_i"));
4110
- }
4111
- if (_v) {
4112
- {
4113
- _v = !!rb_respond_to(argv[2], rb_intern("to_i"));
4114
- }
4115
- if (_v) {
4116
- {
4117
- _v = !!rb_respond_to(argv[3], rb_intern("to_i"));
4118
- }
4119
- if (_v) {
4120
- return _wrap_new_Color__SWIG_3(nargs, args, self);
4121
- }
4122
- }
4123
- }
4124
- }
4125
- }
4126
-
4127
3994
  fail:
4128
- Ruby_Format_OverloadedError( argc, 4, "Color.new",
4129
- " Color.new()\n"
4130
- " Color.new(unsigned int argb)\n"
4131
- " Color.new(Gosu::Color::Channel red, Gosu::Color::Channel green, Gosu::Color::Channel blue)\n"
4132
- " Color.new(Gosu::Color::Channel alpha, Gosu::Color::Channel red, Gosu::Color::Channel green, Gosu::Color::Channel blue)\n");
4133
-
4134
3995
  return Qnil;
4135
3996
  }
4136
3997
 
4137
3998
 
4138
3999
  SWIGINTERN VALUE
4139
- _wrap_Color_from_hsv(int argc, VALUE *argv, VALUE self) {
4140
- double arg1 ;
4141
- double arg2 ;
4142
- double arg3 ;
4143
- double val1 ;
4144
- int ecode1 = 0 ;
4145
- double val2 ;
4146
- int ecode2 = 0 ;
4147
- double val3 ;
4148
- int ecode3 = 0 ;
4149
- Gosu::Color result;
4000
+ _wrap_Color_green_get(int argc, VALUE *argv, VALUE self) {
4001
+ Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4002
+ void *argp1 = 0 ;
4003
+ int res1 = 0 ;
4004
+ Gosu::Color::Channel result;
4150
4005
  VALUE vresult = Qnil;
4151
4006
 
4152
- if ((argc < 3) || (argc > 3)) {
4153
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
4007
+ if ((argc < 0) || (argc > 0)) {
4008
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4154
4009
  }
4155
- ecode1 = SWIG_AsVal_double(argv[0], &val1);
4156
- if (!SWIG_IsOK(ecode1)) {
4157
- SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 1, argv[0] ));
4158
- }
4159
- arg1 = static_cast< double >(val1);
4160
- ecode2 = SWIG_AsVal_double(argv[1], &val2);
4161
- if (!SWIG_IsOK(ecode2)) {
4162
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 2, argv[1] ));
4163
- }
4164
- arg2 = static_cast< double >(val2);
4165
- ecode3 = SWIG_AsVal_double(argv[2], &val3);
4166
- if (!SWIG_IsOK(ecode3)) {
4167
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 3, argv[2] ));
4168
- }
4169
- arg3 = static_cast< double >(val3);
4170
- {
4171
- try {
4172
- result = Gosu::Color::from_hsv(arg1,arg2,arg3);
4173
- }
4174
- catch (const std::exception& e) {
4175
- SWIG_exception(SWIG_RuntimeError, e.what());
4176
- }
4010
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4011
+ if (!SWIG_IsOK(res1)) {
4012
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","green", 1, self ));
4177
4013
  }
4178
- vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
4014
+ arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4015
+ result = ((arg1)->green);
4016
+ vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
4179
4017
  return vresult;
4180
4018
  fail:
4181
4019
  return Qnil;
@@ -4183,58 +4021,32 @@ fail:
4183
4021
 
4184
4022
 
4185
4023
  SWIGINTERN VALUE
4186
- _wrap_Color_from_ahsv(int argc, VALUE *argv, VALUE self) {
4187
- Gosu::Color::Channel arg1 ;
4188
- double arg2 ;
4189
- double arg3 ;
4190
- double arg4 ;
4191
- double val2 ;
4192
- int ecode2 = 0 ;
4193
- double val3 ;
4194
- int ecode3 = 0 ;
4195
- double val4 ;
4196
- int ecode4 = 0 ;
4197
- Gosu::Color result;
4198
- VALUE vresult = Qnil;
4024
+ _wrap_Color_blue_set(int argc, VALUE *argv, VALUE self) {
4025
+ Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4026
+ Gosu::Color::Channel arg2 ;
4027
+ void *argp1 = 0 ;
4028
+ int res1 = 0 ;
4199
4029
 
4200
- if ((argc < 4) || (argc > 4)) {
4201
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
4030
+ if ((argc < 1) || (argc > 1)) {
4031
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4202
4032
  }
4203
- {
4204
- arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4033
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4034
+ if (!SWIG_IsOK(res1)) {
4035
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","blue", 1, self ));
4205
4036
  }
4206
- ecode2 = SWIG_AsVal_double(argv[1], &val2);
4207
- if (!SWIG_IsOK(ecode2)) {
4208
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::Color::from_ahsv", 2, argv[1] ));
4209
- }
4210
- arg2 = static_cast< double >(val2);
4211
- ecode3 = SWIG_AsVal_double(argv[2], &val3);
4212
- if (!SWIG_IsOK(ecode3)) {
4213
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::Color::from_ahsv", 3, argv[2] ));
4214
- }
4215
- arg3 = static_cast< double >(val3);
4216
- ecode4 = SWIG_AsVal_double(argv[3], &val4);
4217
- if (!SWIG_IsOK(ecode4)) {
4218
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","Gosu::Color::from_ahsv", 4, argv[3] ));
4219
- }
4220
- arg4 = static_cast< double >(val4);
4037
+ arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4221
4038
  {
4222
- try {
4223
- result = Gosu::Color::from_ahsv(arg1,arg2,arg3,arg4);
4224
- }
4225
- catch (const std::exception& e) {
4226
- SWIG_exception(SWIG_RuntimeError, e.what());
4227
- }
4039
+ arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4228
4040
  }
4229
- vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
4230
- return vresult;
4041
+ if (arg1) (arg1)->blue = arg2;
4042
+ return Qnil;
4231
4043
  fail:
4232
4044
  return Qnil;
4233
4045
  }
4234
4046
 
4235
4047
 
4236
4048
  SWIGINTERN VALUE
4237
- _wrap_Color_red(int argc, VALUE *argv, VALUE self) {
4049
+ _wrap_Color_blue_get(int argc, VALUE *argv, VALUE self) {
4238
4050
  Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4239
4051
  void *argp1 = 0 ;
4240
4052
  int res1 = 0 ;
@@ -4246,17 +4058,10 @@ _wrap_Color_red(int argc, VALUE *argv, VALUE self) {
4246
4058
  }
4247
4059
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4248
4060
  if (!SWIG_IsOK(res1)) {
4249
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color const *","red", 1, self ));
4061
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","blue", 1, self ));
4250
4062
  }
4251
4063
  arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4252
- {
4253
- try {
4254
- result = ((Gosu::Color const *)arg1)->red();
4255
- }
4256
- catch (const std::exception& e) {
4257
- SWIG_exception(SWIG_RuntimeError, e.what());
4258
- }
4259
- }
4064
+ result = ((arg1)->blue);
4260
4065
  vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
4261
4066
  return vresult;
4262
4067
  fail:
@@ -4265,38 +4070,32 @@ fail:
4265
4070
 
4266
4071
 
4267
4072
  SWIGINTERN VALUE
4268
- _wrap_Color_green(int argc, VALUE *argv, VALUE self) {
4073
+ _wrap_Color_alpha_set(int argc, VALUE *argv, VALUE self) {
4269
4074
  Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4075
+ Gosu::Color::Channel arg2 ;
4270
4076
  void *argp1 = 0 ;
4271
4077
  int res1 = 0 ;
4272
- Gosu::Color::Channel result;
4273
- VALUE vresult = Qnil;
4274
4078
 
4275
- if ((argc < 0) || (argc > 0)) {
4276
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4079
+ if ((argc < 1) || (argc > 1)) {
4080
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4277
4081
  }
4278
4082
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4279
4083
  if (!SWIG_IsOK(res1)) {
4280
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color const *","green", 1, self ));
4084
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","alpha", 1, self ));
4281
4085
  }
4282
4086
  arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4283
4087
  {
4284
- try {
4285
- result = ((Gosu::Color const *)arg1)->green();
4286
- }
4287
- catch (const std::exception& e) {
4288
- SWIG_exception(SWIG_RuntimeError, e.what());
4289
- }
4088
+ arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4290
4089
  }
4291
- vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
4292
- return vresult;
4090
+ if (arg1) (arg1)->alpha = arg2;
4091
+ return Qnil;
4293
4092
  fail:
4294
4093
  return Qnil;
4295
4094
  }
4296
4095
 
4297
4096
 
4298
4097
  SWIGINTERN VALUE
4299
- _wrap_Color_blue(int argc, VALUE *argv, VALUE self) {
4098
+ _wrap_Color_alpha_get(int argc, VALUE *argv, VALUE self) {
4300
4099
  Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4301
4100
  void *argp1 = 0 ;
4302
4101
  int res1 = 0 ;
@@ -4308,17 +4107,10 @@ _wrap_Color_blue(int argc, VALUE *argv, VALUE self) {
4308
4107
  }
4309
4108
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4310
4109
  if (!SWIG_IsOK(res1)) {
4311
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color const *","blue", 1, self ));
4110
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","alpha", 1, self ));
4312
4111
  }
4313
4112
  arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4314
- {
4315
- try {
4316
- result = ((Gosu::Color const *)arg1)->blue();
4317
- }
4318
- catch (const std::exception& e) {
4319
- SWIG_exception(SWIG_RuntimeError, e.what());
4320
- }
4321
- }
4113
+ result = ((arg1)->alpha);
4322
4114
  vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
4323
4115
  return vresult;
4324
4116
  fail:
@@ -4327,159 +4119,242 @@ fail:
4327
4119
 
4328
4120
 
4329
4121
  SWIGINTERN VALUE
4330
- _wrap_Color_alpha(int argc, VALUE *argv, VALUE self) {
4331
- Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4332
- void *argp1 = 0 ;
4333
- int res1 = 0 ;
4334
- Gosu::Color::Channel result;
4335
- VALUE vresult = Qnil;
4122
+ _wrap_new_Color__SWIG_0(int argc, VALUE *argv, VALUE self) {
4123
+ const char *classname SWIGUNUSED = "Gosu::Color";
4124
+ Gosu::Color *result = 0 ;
4336
4125
 
4337
4126
  if ((argc < 0) || (argc > 0)) {
4338
4127
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4339
4128
  }
4340
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4341
- if (!SWIG_IsOK(res1)) {
4342
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color const *","alpha", 1, self ));
4343
- }
4344
- arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4345
4129
  {
4346
4130
  try {
4347
- result = ((Gosu::Color const *)arg1)->alpha();
4131
+ result = (Gosu::Color *)new Gosu::Color();
4132
+ DATA_PTR(self) = result;
4133
+ SWIG_RubyAddTracking(result, self);
4348
4134
  }
4349
4135
  catch (const std::exception& e) {
4350
4136
  SWIG_exception(SWIG_RuntimeError, e.what());
4351
4137
  }
4352
4138
  }
4353
- vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
4354
- return vresult;
4139
+ return self;
4355
4140
  fail:
4356
4141
  return Qnil;
4357
4142
  }
4358
4143
 
4359
4144
 
4360
4145
  SWIGINTERN VALUE
4361
- _wrap_Color_rede___(int argc, VALUE *argv, VALUE self) {
4362
- Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4363
- Gosu::Color::Channel arg2 ;
4364
- void *argp1 = 0 ;
4365
- int res1 = 0 ;
4146
+ _wrap_new_Color__SWIG_1(int argc, VALUE *argv, VALUE self) {
4147
+ std::uint32_t arg1 ;
4148
+ unsigned long val1 ;
4149
+ int ecode1 = 0 ;
4150
+ const char *classname SWIGUNUSED = "Gosu::Color";
4151
+ Gosu::Color *result = 0 ;
4366
4152
 
4367
4153
  if ((argc < 1) || (argc > 1)) {
4368
4154
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4369
4155
  }
4370
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4371
- if (!SWIG_IsOK(res1)) {
4372
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","set_red", 1, self ));
4373
- }
4374
- arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4375
- {
4376
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4377
- }
4156
+ ecode1 = SWIG_AsVal_unsigned_SS_long(argv[0], &val1);
4157
+ if (!SWIG_IsOK(ecode1)) {
4158
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::uint32_t","Color", 1, argv[0] ));
4159
+ }
4160
+ arg1 = static_cast< std::uint32_t >(val1);
4378
4161
  {
4379
4162
  try {
4380
- (arg1)->set_red(arg2);
4163
+ result = (Gosu::Color *)new Gosu::Color(arg1);
4164
+ DATA_PTR(self) = result;
4165
+ SWIG_RubyAddTracking(result, self);
4381
4166
  }
4382
4167
  catch (const std::exception& e) {
4383
4168
  SWIG_exception(SWIG_RuntimeError, e.what());
4384
4169
  }
4385
4170
  }
4386
- return Qnil;
4171
+ return self;
4387
4172
  fail:
4388
4173
  return Qnil;
4389
4174
  }
4390
4175
 
4391
4176
 
4392
4177
  SWIGINTERN VALUE
4393
- _wrap_Color_greene___(int argc, VALUE *argv, VALUE self) {
4394
- Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4178
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
4179
+ _wrap_Color_allocate(VALUE self)
4180
+ #else
4181
+ _wrap_Color_allocate(int argc, VALUE *argv, VALUE self)
4182
+ #endif
4183
+ {
4184
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Gosu__Color);
4185
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
4186
+ rb_obj_call_init(vresult, argc, argv);
4187
+ #endif
4188
+ return vresult;
4189
+ }
4190
+
4191
+
4192
+ SWIGINTERN VALUE
4193
+ _wrap_new_Color__SWIG_2(int argc, VALUE *argv, VALUE self) {
4194
+ Gosu::Color::Channel arg1 ;
4395
4195
  Gosu::Color::Channel arg2 ;
4396
- void *argp1 = 0 ;
4397
- int res1 = 0 ;
4196
+ Gosu::Color::Channel arg3 ;
4197
+ const char *classname SWIGUNUSED = "Gosu::Color";
4198
+ Gosu::Color *result = 0 ;
4398
4199
 
4399
- if ((argc < 1) || (argc > 1)) {
4400
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4200
+ if ((argc < 3) || (argc > 3)) {
4201
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
4401
4202
  }
4402
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4403
- if (!SWIG_IsOK(res1)) {
4404
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","set_green", 1, self ));
4203
+ {
4204
+ arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4205
+ }
4206
+ {
4207
+ arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4405
4208
  }
4406
- arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4407
4209
  {
4408
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4210
+ arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4409
4211
  }
4410
4212
  {
4411
4213
  try {
4412
- (arg1)->set_green(arg2);
4214
+ result = (Gosu::Color *)new Gosu::Color(arg1,arg2,arg3);
4215
+ DATA_PTR(self) = result;
4216
+ SWIG_RubyAddTracking(result, self);
4413
4217
  }
4414
4218
  catch (const std::exception& e) {
4415
4219
  SWIG_exception(SWIG_RuntimeError, e.what());
4416
4220
  }
4417
4221
  }
4222
+ return self;
4223
+ fail:
4418
4224
  return Qnil;
4225
+ }
4226
+
4227
+
4228
+ SWIGINTERN VALUE _wrap_new_Color(int nargs, VALUE *args, VALUE self) {
4229
+ int argc;
4230
+ VALUE argv[3];
4231
+ int ii;
4232
+
4233
+ argc = nargs;
4234
+ if (argc > 3) SWIG_fail;
4235
+ for (ii = 0; (ii < argc); ++ii) {
4236
+ argv[ii] = args[ii];
4237
+ }
4238
+ if (argc == 0) {
4239
+ return _wrap_new_Color__SWIG_0(nargs, args, self);
4240
+ }
4241
+ if (argc == 1) {
4242
+ int _v;
4243
+ {
4244
+ int res = SWIG_AsVal_unsigned_SS_long(argv[0], NULL);
4245
+ _v = SWIG_CheckState(res);
4246
+ }
4247
+ if (_v) {
4248
+ return _wrap_new_Color__SWIG_1(nargs, args, self);
4249
+ }
4250
+ }
4251
+ if (argc == 3) {
4252
+ int _v;
4253
+ {
4254
+ _v = !!rb_respond_to(argv[0], rb_intern("to_i"));
4255
+ }
4256
+ if (_v) {
4257
+ {
4258
+ _v = !!rb_respond_to(argv[1], rb_intern("to_i"));
4259
+ }
4260
+ if (_v) {
4261
+ {
4262
+ _v = !!rb_respond_to(argv[2], rb_intern("to_i"));
4263
+ }
4264
+ if (_v) {
4265
+ return _wrap_new_Color__SWIG_2(nargs, args, self);
4266
+ }
4267
+ }
4268
+ }
4269
+ }
4270
+
4419
4271
  fail:
4272
+ Ruby_Format_OverloadedError( argc, 3, "Color.new",
4273
+ " Color.new()\n"
4274
+ " Color.new(std::uint32_t argb)\n"
4275
+ " Color.new(Gosu::Color::Channel red, Gosu::Color::Channel green, Gosu::Color::Channel blue)\n");
4276
+
4420
4277
  return Qnil;
4421
4278
  }
4422
4279
 
4423
4280
 
4424
4281
  SWIGINTERN VALUE
4425
- _wrap_Color_bluee___(int argc, VALUE *argv, VALUE self) {
4282
+ _wrap_Color_with_alpha(int argc, VALUE *argv, VALUE self) {
4426
4283
  Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4427
4284
  Gosu::Color::Channel arg2 ;
4428
4285
  void *argp1 = 0 ;
4429
4286
  int res1 = 0 ;
4287
+ Gosu::Color result;
4288
+ VALUE vresult = Qnil;
4430
4289
 
4431
4290
  if ((argc < 1) || (argc > 1)) {
4432
4291
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4433
4292
  }
4434
4293
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4435
4294
  if (!SWIG_IsOK(res1)) {
4436
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","set_blue", 1, self ));
4295
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","with_alpha", 1, self ));
4437
4296
  }
4438
4297
  arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4439
4298
  {
4440
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4299
+ arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4441
4300
  }
4442
4301
  {
4443
4302
  try {
4444
- (arg1)->set_blue(arg2);
4303
+ result = (arg1)->with_alpha(arg2);
4445
4304
  }
4446
4305
  catch (const std::exception& e) {
4447
4306
  SWIG_exception(SWIG_RuntimeError, e.what());
4448
4307
  }
4449
4308
  }
4450
- return Qnil;
4309
+ vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
4310
+ return vresult;
4451
4311
  fail:
4452
4312
  return Qnil;
4453
4313
  }
4454
4314
 
4455
4315
 
4456
4316
  SWIGINTERN VALUE
4457
- _wrap_Color_alphae___(int argc, VALUE *argv, VALUE self) {
4458
- Gosu::Color *arg1 = (Gosu::Color *) 0 ;
4459
- Gosu::Color::Channel arg2 ;
4460
- void *argp1 = 0 ;
4461
- int res1 = 0 ;
4317
+ _wrap_Color_from_hsv(int argc, VALUE *argv, VALUE self) {
4318
+ double arg1 ;
4319
+ double arg2 ;
4320
+ double arg3 ;
4321
+ double val1 ;
4322
+ int ecode1 = 0 ;
4323
+ double val2 ;
4324
+ int ecode2 = 0 ;
4325
+ double val3 ;
4326
+ int ecode3 = 0 ;
4327
+ Gosu::Color result;
4328
+ VALUE vresult = Qnil;
4462
4329
 
4463
- if ((argc < 1) || (argc > 1)) {
4464
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4465
- }
4466
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
4467
- if (!SWIG_IsOK(res1)) {
4468
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","set_alpha", 1, self ));
4469
- }
4470
- arg1 = reinterpret_cast< Gosu::Color * >(argp1);
4471
- {
4472
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4330
+ if ((argc < 3) || (argc > 3)) {
4331
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
4473
4332
  }
4333
+ ecode1 = SWIG_AsVal_double(argv[0], &val1);
4334
+ if (!SWIG_IsOK(ecode1)) {
4335
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 1, argv[0] ));
4336
+ }
4337
+ arg1 = static_cast< double >(val1);
4338
+ ecode2 = SWIG_AsVal_double(argv[1], &val2);
4339
+ if (!SWIG_IsOK(ecode2)) {
4340
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 2, argv[1] ));
4341
+ }
4342
+ arg2 = static_cast< double >(val2);
4343
+ ecode3 = SWIG_AsVal_double(argv[2], &val3);
4344
+ if (!SWIG_IsOK(ecode3)) {
4345
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 3, argv[2] ));
4346
+ }
4347
+ arg3 = static_cast< double >(val3);
4474
4348
  {
4475
4349
  try {
4476
- (arg1)->set_alpha(arg2);
4350
+ result = Gosu::Color::from_hsv(arg1,arg2,arg3);
4477
4351
  }
4478
4352
  catch (const std::exception& e) {
4479
4353
  SWIG_exception(SWIG_RuntimeError, e.what());
4480
4354
  }
4481
4355
  }
4482
- return Qnil;
4356
+ vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
4357
+ return vresult;
4483
4358
  fail:
4484
4359
  return Qnil;
4485
4360
  }
@@ -4822,13 +4697,13 @@ _wrap_Color_rgb(int argc, VALUE *argv, VALUE self) {
4822
4697
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
4823
4698
  }
4824
4699
  {
4825
- arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4700
+ arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4826
4701
  }
4827
4702
  {
4828
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4703
+ arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4829
4704
  }
4830
4705
  {
4831
- arg3 = Gosu::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4706
+ arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4832
4707
  }
4833
4708
  {
4834
4709
  try {
@@ -4858,16 +4733,16 @@ _wrap_Color_rgba__SWIG_0(int argc, VALUE *argv, VALUE self) {
4858
4733
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
4859
4734
  }
4860
4735
  {
4861
- arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4736
+ arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4862
4737
  }
4863
4738
  {
4864
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4739
+ arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4865
4740
  }
4866
4741
  {
4867
- arg3 = Gosu::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4742
+ arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4868
4743
  }
4869
4744
  {
4870
- arg4 = Gosu::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
4745
+ arg4 = std::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
4871
4746
  }
4872
4747
  {
4873
4748
  try {
@@ -4982,16 +4857,16 @@ _wrap_Color_argb__SWIG_1(int argc, VALUE *argv, VALUE self) {
4982
4857
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
4983
4858
  }
4984
4859
  {
4985
- arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4860
+ arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
4986
4861
  }
4987
4862
  {
4988
- arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4863
+ arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
4989
4864
  }
4990
4865
  {
4991
- arg3 = Gosu::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4866
+ arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
4992
4867
  }
4993
4868
  {
4994
- arg4 = Gosu::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
4869
+ arg4 = std::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
4995
4870
  }
4996
4871
  {
4997
4872
  try {
@@ -5103,6 +4978,57 @@ fail:
5103
4978
  }
5104
4979
 
5105
4980
 
4981
+ SWIGINTERN VALUE
4982
+ _wrap_Color_from_ahsv(int argc, VALUE *argv, VALUE self) {
4983
+ Gosu::Color::Channel arg1 ;
4984
+ double arg2 ;
4985
+ double arg3 ;
4986
+ double arg4 ;
4987
+ double val2 ;
4988
+ int ecode2 = 0 ;
4989
+ double val3 ;
4990
+ int ecode3 = 0 ;
4991
+ double val4 ;
4992
+ int ecode4 = 0 ;
4993
+ Gosu::Color result;
4994
+ VALUE vresult = Qnil;
4995
+
4996
+ if ((argc < 4) || (argc > 4)) {
4997
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
4998
+ }
4999
+ {
5000
+ arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
5001
+ }
5002
+ ecode2 = SWIG_AsVal_double(argv[1], &val2);
5003
+ if (!SWIG_IsOK(ecode2)) {
5004
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu_Color_from_ahsv", 2, argv[1] ));
5005
+ }
5006
+ arg2 = static_cast< double >(val2);
5007
+ ecode3 = SWIG_AsVal_double(argv[2], &val3);
5008
+ if (!SWIG_IsOK(ecode3)) {
5009
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu_Color_from_ahsv", 3, argv[2] ));
5010
+ }
5011
+ arg3 = static_cast< double >(val3);
5012
+ ecode4 = SWIG_AsVal_double(argv[3], &val4);
5013
+ if (!SWIG_IsOK(ecode4)) {
5014
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","Gosu_Color_from_ahsv", 4, argv[3] ));
5015
+ }
5016
+ arg4 = static_cast< double >(val4);
5017
+ {
5018
+ try {
5019
+ result = Gosu_Color_from_ahsv(arg1,arg2,arg3,arg4);
5020
+ }
5021
+ catch (const std::exception& e) {
5022
+ SWIG_exception(SWIG_RuntimeError, e.what());
5023
+ }
5024
+ }
5025
+ vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
5026
+ return vresult;
5027
+ fail:
5028
+ return Qnil;
5029
+ }
5030
+
5031
+
5106
5032
  /*
5107
5033
  Document-method: Gosu::Color.to_i
5108
5034
 
@@ -5373,7 +5299,7 @@ _wrap_Font_draw_text(int argc, VALUE *argv, VALUE self) {
5373
5299
  double arg6 = (double) 1 ;
5374
5300
  double arg7 = (double) 1 ;
5375
5301
  Gosu::Color arg8 = (Gosu::Color) Gosu::Color::WHITE ;
5376
- Gosu::AlphaMode arg9 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
5302
+ Gosu::BlendMode arg9 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
5377
5303
  void *argp1 = 0 ;
5378
5304
  int res1 = 0 ;
5379
5305
  int res2 = SWIG_OLDOBJ ;
@@ -5461,16 +5387,16 @@ _wrap_Font_draw_text(int argc, VALUE *argv, VALUE self) {
5461
5387
  const char* cstr = Gosu::cstr_from_symbol(argv[7]);
5462
5388
 
5463
5389
  if (!strcmp(cstr, "default")) {
5464
- arg9 = Gosu::AM_DEFAULT;
5390
+ arg9 = Gosu::BM_DEFAULT;
5465
5391
  }
5466
5392
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
5467
- arg9 = Gosu::AM_ADD;
5393
+ arg9 = Gosu::BM_ADD;
5468
5394
  }
5469
5395
  else if (!strcmp(cstr, "multiply")) {
5470
- arg9 = Gosu::AM_MULTIPLY;
5396
+ arg9 = Gosu::BM_MULTIPLY;
5471
5397
  }
5472
5398
  else {
5473
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
5399
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
5474
5400
  ":multiply)");
5475
5401
  }
5476
5402
  }
@@ -5501,7 +5427,7 @@ _wrap_Font_draw_markup(int argc, VALUE *argv, VALUE self) {
5501
5427
  double arg6 = (double) 1 ;
5502
5428
  double arg7 = (double) 1 ;
5503
5429
  Gosu::Color arg8 = (Gosu::Color) Gosu::Color::WHITE ;
5504
- Gosu::AlphaMode arg9 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
5430
+ Gosu::BlendMode arg9 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
5505
5431
  void *argp1 = 0 ;
5506
5432
  int res1 = 0 ;
5507
5433
  int res2 = SWIG_OLDOBJ ;
@@ -5589,16 +5515,16 @@ _wrap_Font_draw_markup(int argc, VALUE *argv, VALUE self) {
5589
5515
  const char* cstr = Gosu::cstr_from_symbol(argv[7]);
5590
5516
 
5591
5517
  if (!strcmp(cstr, "default")) {
5592
- arg9 = Gosu::AM_DEFAULT;
5518
+ arg9 = Gosu::BM_DEFAULT;
5593
5519
  }
5594
5520
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
5595
- arg9 = Gosu::AM_ADD;
5521
+ arg9 = Gosu::BM_ADD;
5596
5522
  }
5597
5523
  else if (!strcmp(cstr, "multiply")) {
5598
- arg9 = Gosu::AM_MULTIPLY;
5524
+ arg9 = Gosu::BM_MULTIPLY;
5599
5525
  }
5600
5526
  else {
5601
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
5527
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
5602
5528
  ":multiply)");
5603
5529
  }
5604
5530
  }
@@ -5631,7 +5557,7 @@ _wrap_Font_draw_text_rel(int argc, VALUE *argv, VALUE self) {
5631
5557
  double arg8 = (double) 1 ;
5632
5558
  double arg9 = (double) 1 ;
5633
5559
  Gosu::Color arg10 = (Gosu::Color) Gosu::Color::WHITE ;
5634
- Gosu::AlphaMode arg11 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
5560
+ Gosu::BlendMode arg11 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
5635
5561
  void *argp1 = 0 ;
5636
5562
  int res1 = 0 ;
5637
5563
  int res2 = SWIG_OLDOBJ ;
@@ -5733,16 +5659,16 @@ _wrap_Font_draw_text_rel(int argc, VALUE *argv, VALUE self) {
5733
5659
  const char* cstr = Gosu::cstr_from_symbol(argv[9]);
5734
5660
 
5735
5661
  if (!strcmp(cstr, "default")) {
5736
- arg11 = Gosu::AM_DEFAULT;
5662
+ arg11 = Gosu::BM_DEFAULT;
5737
5663
  }
5738
5664
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
5739
- arg11 = Gosu::AM_ADD;
5665
+ arg11 = Gosu::BM_ADD;
5740
5666
  }
5741
5667
  else if (!strcmp(cstr, "multiply")) {
5742
- arg11 = Gosu::AM_MULTIPLY;
5668
+ arg11 = Gosu::BM_MULTIPLY;
5743
5669
  }
5744
5670
  else {
5745
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
5671
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
5746
5672
  ":multiply)");
5747
5673
  }
5748
5674
  }
@@ -5775,7 +5701,7 @@ _wrap_Font_draw_markup_rel(int argc, VALUE *argv, VALUE self) {
5775
5701
  double arg8 = (double) 1 ;
5776
5702
  double arg9 = (double) 1 ;
5777
5703
  Gosu::Color arg10 = (Gosu::Color) Gosu::Color::WHITE ;
5778
- Gosu::AlphaMode arg11 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
5704
+ Gosu::BlendMode arg11 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
5779
5705
  void *argp1 = 0 ;
5780
5706
  int res1 = 0 ;
5781
5707
  int res2 = SWIG_OLDOBJ ;
@@ -5877,16 +5803,16 @@ _wrap_Font_draw_markup_rel(int argc, VALUE *argv, VALUE self) {
5877
5803
  const char* cstr = Gosu::cstr_from_symbol(argv[9]);
5878
5804
 
5879
5805
  if (!strcmp(cstr, "default")) {
5880
- arg11 = Gosu::AM_DEFAULT;
5806
+ arg11 = Gosu::BM_DEFAULT;
5881
5807
  }
5882
5808
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
5883
- arg11 = Gosu::AM_ADD;
5809
+ arg11 = Gosu::BM_ADD;
5884
5810
  }
5885
5811
  else if (!strcmp(cstr, "multiply")) {
5886
- arg11 = Gosu::AM_MULTIPLY;
5812
+ arg11 = Gosu::BM_MULTIPLY;
5887
5813
  }
5888
5814
  else {
5889
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
5815
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
5890
5816
  ":multiply)");
5891
5817
  }
5892
5818
  }
@@ -6625,7 +6551,7 @@ _wrap_Image_draw(int argc, VALUE *argv, VALUE self) {
6625
6551
  double arg5 = (double) 1 ;
6626
6552
  double arg6 = (double) 1 ;
6627
6553
  Gosu::Color arg7 = (Gosu::Color) Gosu::Color::WHITE ;
6628
- Gosu::AlphaMode arg8 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
6554
+ Gosu::BlendMode arg8 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
6629
6555
  void *argp1 = 0 ;
6630
6556
  int res1 = 0 ;
6631
6557
  double val2 ;
@@ -6703,16 +6629,16 @@ _wrap_Image_draw(int argc, VALUE *argv, VALUE self) {
6703
6629
  const char* cstr = Gosu::cstr_from_symbol(argv[6]);
6704
6630
 
6705
6631
  if (!strcmp(cstr, "default")) {
6706
- arg8 = Gosu::AM_DEFAULT;
6632
+ arg8 = Gosu::BM_DEFAULT;
6707
6633
  }
6708
6634
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
6709
- arg8 = Gosu::AM_ADD;
6635
+ arg8 = Gosu::BM_ADD;
6710
6636
  }
6711
6637
  else if (!strcmp(cstr, "multiply")) {
6712
- arg8 = Gosu::AM_MULTIPLY;
6638
+ arg8 = Gosu::BM_MULTIPLY;
6713
6639
  }
6714
6640
  else {
6715
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
6641
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
6716
6642
  ":multiply)");
6717
6643
  }
6718
6644
  }
@@ -6743,7 +6669,7 @@ _wrap_Image_draw_mod(int argc, VALUE *argv, VALUE self) {
6743
6669
  Gosu::Color arg8 ;
6744
6670
  Gosu::Color arg9 ;
6745
6671
  Gosu::Color arg10 ;
6746
- Gosu::AlphaMode arg11 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
6672
+ Gosu::BlendMode arg11 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
6747
6673
  void *argp1 = 0 ;
6748
6674
  int res1 = 0 ;
6749
6675
  double val2 ;
@@ -6867,16 +6793,16 @@ _wrap_Image_draw_mod(int argc, VALUE *argv, VALUE self) {
6867
6793
  const char* cstr = Gosu::cstr_from_symbol(argv[9]);
6868
6794
 
6869
6795
  if (!strcmp(cstr, "default")) {
6870
- arg11 = Gosu::AM_DEFAULT;
6796
+ arg11 = Gosu::BM_DEFAULT;
6871
6797
  }
6872
6798
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
6873
- arg11 = Gosu::AM_ADD;
6799
+ arg11 = Gosu::BM_ADD;
6874
6800
  }
6875
6801
  else if (!strcmp(cstr, "multiply")) {
6876
- arg11 = Gosu::AM_MULTIPLY;
6802
+ arg11 = Gosu::BM_MULTIPLY;
6877
6803
  }
6878
6804
  else {
6879
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
6805
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
6880
6806
  ":multiply)");
6881
6807
  }
6882
6808
  }
@@ -6907,7 +6833,7 @@ _wrap_Image_draw_rot(int argc, VALUE *argv, VALUE self) {
6907
6833
  double arg8 = (double) 1 ;
6908
6834
  double arg9 = (double) 1 ;
6909
6835
  Gosu::Color arg10 = (Gosu::Color) Gosu::Color::WHITE ;
6910
- Gosu::AlphaMode arg11 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
6836
+ Gosu::BlendMode arg11 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
6911
6837
  void *argp1 = 0 ;
6912
6838
  int res1 = 0 ;
6913
6839
  double val2 ;
@@ -7012,16 +6938,16 @@ _wrap_Image_draw_rot(int argc, VALUE *argv, VALUE self) {
7012
6938
  const char* cstr = Gosu::cstr_from_symbol(argv[9]);
7013
6939
 
7014
6940
  if (!strcmp(cstr, "default")) {
7015
- arg11 = Gosu::AM_DEFAULT;
6941
+ arg11 = Gosu::BM_DEFAULT;
7016
6942
  }
7017
6943
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
7018
- arg11 = Gosu::AM_ADD;
6944
+ arg11 = Gosu::BM_ADD;
7019
6945
  }
7020
6946
  else if (!strcmp(cstr, "multiply")) {
7021
- arg11 = Gosu::AM_MULTIPLY;
6947
+ arg11 = Gosu::BM_MULTIPLY;
7022
6948
  }
7023
6949
  else {
7024
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
6950
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
7025
6951
  ":multiply)");
7026
6952
  }
7027
6953
  }
@@ -7101,7 +7027,7 @@ _wrap_Image_draw_as_quad(int argc, VALUE *argv, VALUE self) {
7101
7027
  double arg12 ;
7102
7028
  Gosu::Color arg13 ;
7103
7029
  Gosu::ZPos arg14 ;
7104
- Gosu::AlphaMode arg15 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
7030
+ Gosu::BlendMode arg15 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
7105
7031
  void *argp1 = 0 ;
7106
7032
  int res1 = 0 ;
7107
7033
  double val2 ;
@@ -7253,16 +7179,16 @@ _wrap_Image_draw_as_quad(int argc, VALUE *argv, VALUE self) {
7253
7179
  const char* cstr = Gosu::cstr_from_symbol(argv[13]);
7254
7180
 
7255
7181
  if (!strcmp(cstr, "default")) {
7256
- arg15 = Gosu::AM_DEFAULT;
7182
+ arg15 = Gosu::BM_DEFAULT;
7257
7183
  }
7258
7184
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
7259
- arg15 = Gosu::AM_ADD;
7185
+ arg15 = Gosu::BM_ADD;
7260
7186
  }
7261
7187
  else if (!strcmp(cstr, "multiply")) {
7262
- arg15 = Gosu::AM_MULTIPLY;
7188
+ arg15 = Gosu::BM_MULTIPLY;
7263
7189
  }
7264
7190
  else {
7265
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
7191
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
7266
7192
  ":multiply)");
7267
7193
  }
7268
7194
  }
@@ -9934,6 +9860,47 @@ fail:
9934
9860
  }
9935
9861
 
9936
9862
 
9863
+ SWIGINTERN VALUE
9864
+ _wrap_Window_gain_focus(int argc, VALUE *argv, VALUE self) {
9865
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
9866
+ void *argp1 = 0 ;
9867
+ int res1 = 0 ;
9868
+ Swig::Director *director = 0;
9869
+ bool upcall = false;
9870
+
9871
+ if ((argc < 0) || (argc > 0)) {
9872
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
9873
+ }
9874
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
9875
+ if (!SWIG_IsOK(res1)) {
9876
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","gain_focus", 1, self ));
9877
+ }
9878
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
9879
+ director = dynamic_cast<Swig::Director *>(arg1);
9880
+ upcall = (director && (director->swig_get_self() == self));
9881
+ try {
9882
+ {
9883
+ try {
9884
+ if (upcall) {
9885
+ (arg1)->Gosu::Window::gain_focus();
9886
+ } else {
9887
+ (arg1)->gain_focus();
9888
+ }
9889
+ }
9890
+ catch (const std::exception& e) {
9891
+ SWIG_exception(SWIG_RuntimeError, e.what());
9892
+ }
9893
+ }
9894
+ } catch (Swig::DirectorException& e) {
9895
+ rb_exc_raise(e.getError());
9896
+ SWIG_fail;
9897
+ }
9898
+ return Qnil;
9899
+ fail:
9900
+ return Qnil;
9901
+ }
9902
+
9903
+
9937
9904
  SWIGINTERN VALUE
9938
9905
  _wrap_Window_lose_focus(int argc, VALUE *argv, VALUE self) {
9939
9906
  Gosu::Window *arg1 = (Gosu::Window *) 0 ;
@@ -10987,7 +10954,7 @@ _wrap_draw_line(int argc, VALUE *argv, VALUE self) {
10987
10954
  double arg5 ;
10988
10955
  Gosu::Color arg6 ;
10989
10956
  Gosu::ZPos arg7 = (Gosu::ZPos) 0 ;
10990
- Gosu::AlphaMode arg8 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
10957
+ Gosu::BlendMode arg8 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
10991
10958
  double val1 ;
10992
10959
  int ecode1 = 0 ;
10993
10960
  double val2 ;
@@ -11070,16 +11037,16 @@ _wrap_draw_line(int argc, VALUE *argv, VALUE self) {
11070
11037
  const char* cstr = Gosu::cstr_from_symbol(argv[7]);
11071
11038
 
11072
11039
  if (!strcmp(cstr, "default")) {
11073
- arg8 = Gosu::AM_DEFAULT;
11040
+ arg8 = Gosu::BM_DEFAULT;
11074
11041
  }
11075
11042
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
11076
- arg8 = Gosu::AM_ADD;
11043
+ arg8 = Gosu::BM_ADD;
11077
11044
  }
11078
11045
  else if (!strcmp(cstr, "multiply")) {
11079
- arg8 = Gosu::AM_MULTIPLY;
11046
+ arg8 = Gosu::BM_MULTIPLY;
11080
11047
  }
11081
11048
  else {
11082
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
11049
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
11083
11050
  ":multiply)");
11084
11051
  }
11085
11052
  }
@@ -11110,7 +11077,7 @@ _wrap_draw_triangle(int argc, VALUE *argv, VALUE self) {
11110
11077
  double arg8 ;
11111
11078
  Gosu::Color arg9 ;
11112
11079
  Gosu::ZPos arg10 = (Gosu::ZPos) 0 ;
11113
- Gosu::AlphaMode arg11 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
11080
+ Gosu::BlendMode arg11 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
11114
11081
  double val1 ;
11115
11082
  int ecode1 = 0 ;
11116
11083
  double val2 ;
@@ -11225,16 +11192,16 @@ _wrap_draw_triangle(int argc, VALUE *argv, VALUE self) {
11225
11192
  const char* cstr = Gosu::cstr_from_symbol(argv[10]);
11226
11193
 
11227
11194
  if (!strcmp(cstr, "default")) {
11228
- arg11 = Gosu::AM_DEFAULT;
11195
+ arg11 = Gosu::BM_DEFAULT;
11229
11196
  }
11230
11197
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
11231
- arg11 = Gosu::AM_ADD;
11198
+ arg11 = Gosu::BM_ADD;
11232
11199
  }
11233
11200
  else if (!strcmp(cstr, "multiply")) {
11234
- arg11 = Gosu::AM_MULTIPLY;
11201
+ arg11 = Gosu::BM_MULTIPLY;
11235
11202
  }
11236
11203
  else {
11237
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
11204
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
11238
11205
  ":multiply)");
11239
11206
  }
11240
11207
  }
@@ -11268,7 +11235,7 @@ _wrap_draw_quad(int argc, VALUE *argv, VALUE self) {
11268
11235
  double arg11 ;
11269
11236
  Gosu::Color arg12 ;
11270
11237
  Gosu::ZPos arg13 = (Gosu::ZPos) 0 ;
11271
- Gosu::AlphaMode arg14 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
11238
+ Gosu::BlendMode arg14 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
11272
11239
  double val1 ;
11273
11240
  int ecode1 = 0 ;
11274
11241
  double val2 ;
@@ -11415,16 +11382,16 @@ _wrap_draw_quad(int argc, VALUE *argv, VALUE self) {
11415
11382
  const char* cstr = Gosu::cstr_from_symbol(argv[13]);
11416
11383
 
11417
11384
  if (!strcmp(cstr, "default")) {
11418
- arg14 = Gosu::AM_DEFAULT;
11385
+ arg14 = Gosu::BM_DEFAULT;
11419
11386
  }
11420
11387
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
11421
- arg14 = Gosu::AM_ADD;
11388
+ arg14 = Gosu::BM_ADD;
11422
11389
  }
11423
11390
  else if (!strcmp(cstr, "multiply")) {
11424
- arg14 = Gosu::AM_MULTIPLY;
11391
+ arg14 = Gosu::BM_MULTIPLY;
11425
11392
  }
11426
11393
  else {
11427
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
11394
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
11428
11395
  ":multiply)");
11429
11396
  }
11430
11397
  }
@@ -11451,7 +11418,7 @@ _wrap_draw_rect(int argc, VALUE *argv, VALUE self) {
11451
11418
  double arg4 ;
11452
11419
  Gosu::Color arg5 ;
11453
11420
  Gosu::ZPos arg6 = (Gosu::ZPos) 0 ;
11454
- Gosu::AlphaMode arg7 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
11421
+ Gosu::BlendMode arg7 = (Gosu::BlendMode) Gosu::BM_DEFAULT ;
11455
11422
  double val1 ;
11456
11423
  int ecode1 = 0 ;
11457
11424
  double val2 ;
@@ -11516,16 +11483,16 @@ _wrap_draw_rect(int argc, VALUE *argv, VALUE self) {
11516
11483
  const char* cstr = Gosu::cstr_from_symbol(argv[6]);
11517
11484
 
11518
11485
  if (!strcmp(cstr, "default")) {
11519
- arg7 = Gosu::AM_DEFAULT;
11486
+ arg7 = Gosu::BM_DEFAULT;
11520
11487
  }
11521
11488
  else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
11522
- arg7 = Gosu::AM_ADD;
11489
+ arg7 = Gosu::BM_ADD;
11523
11490
  }
11524
11491
  else if (!strcmp(cstr, "multiply")) {
11525
- arg7 = Gosu::AM_MULTIPLY;
11492
+ arg7 = Gosu::BM_MULTIPLY;
11526
11493
  }
11527
11494
  else {
11528
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
11495
+ SWIG_exception_fail(SWIG_ValueError, "invalid blend mode (expected one of :default, :add, "
11529
11496
  ":multiply)");
11530
11497
  }
11531
11498
  }
@@ -12518,7 +12485,7 @@ SWIGEXPORT void Init_gosu(void) {
12518
12485
  rb_define_const(mGosu, "VERSION", SWIG_From_std_string(static_cast< std::string >(Gosu::VERSION)));
12519
12486
  rb_define_const(mGosu, "LICENSES", SWIG_From_std_string(static_cast< std::string >(Gosu::LICENSES)));
12520
12487
  rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(1)));
12521
- rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(1)));
12488
+ rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(3)));
12522
12489
  rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(0)));
12523
12490
  rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
12524
12491
  rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
@@ -12532,7 +12499,7 @@ SWIGEXPORT void Init_gosu(void) {
12532
12499
  rb_define_module_function(mGosu, "distance", VALUEFUNC(_wrap_distance), -1);
12533
12500
  rb_define_module_function(mGosu, "default_font_name", VALUEFUNC(_wrap_default_font_name), -1);
12534
12501
  rb_define_const(mGosu, "MAX_TEXTURE_SIZE", SWIG_From_unsigned_SS_int(static_cast< unsigned int >(Gosu::MAX_TEXTURE_SIZE)));
12535
- rb_define_module_function(mGosu, "language", VALUEFUNC(_wrap_language), -1);
12502
+ rb_define_module_function(mGosu, "user_languages", VALUEFUNC(_wrap_user_languages), -1);
12536
12503
  rb_define_module_function(mGosu, "enable_undocumented_retrofication", VALUEFUNC(_wrap_enable_undocumented_retrofication), -1);
12537
12504
 
12538
12505
  SwigClassColor.klass = rb_define_class_under(mGosu, "Color", rb_cObject);
@@ -12540,16 +12507,16 @@ SWIGEXPORT void Init_gosu(void) {
12540
12507
  rb_define_alloc_func(SwigClassColor.klass, _wrap_Color_allocate);
12541
12508
  rb_define_method(SwigClassColor.klass, "initialize", VALUEFUNC(_wrap_new_Color), -1);
12542
12509
  rb_define_const(SwigClassColor.klass, "GL_FORMAT", SWIG_From_unsigned_SS_int(static_cast< unsigned int >(Gosu::Color::GL_FORMAT)));
12510
+ rb_define_method(SwigClassColor.klass, "red=", VALUEFUNC(_wrap_Color_red_set), -1);
12511
+ rb_define_method(SwigClassColor.klass, "red", VALUEFUNC(_wrap_Color_red_get), -1);
12512
+ rb_define_method(SwigClassColor.klass, "green=", VALUEFUNC(_wrap_Color_green_set), -1);
12513
+ rb_define_method(SwigClassColor.klass, "green", VALUEFUNC(_wrap_Color_green_get), -1);
12514
+ rb_define_method(SwigClassColor.klass, "blue=", VALUEFUNC(_wrap_Color_blue_set), -1);
12515
+ rb_define_method(SwigClassColor.klass, "blue", VALUEFUNC(_wrap_Color_blue_get), -1);
12516
+ rb_define_method(SwigClassColor.klass, "alpha=", VALUEFUNC(_wrap_Color_alpha_set), -1);
12517
+ rb_define_method(SwigClassColor.klass, "alpha", VALUEFUNC(_wrap_Color_alpha_get), -1);
12518
+ rb_define_method(SwigClassColor.klass, "with_alpha", VALUEFUNC(_wrap_Color_with_alpha), -1);
12543
12519
  rb_define_singleton_method(SwigClassColor.klass, "from_hsv", VALUEFUNC(_wrap_Color_from_hsv), -1);
12544
- rb_define_singleton_method(SwigClassColor.klass, "from_ahsv", VALUEFUNC(_wrap_Color_from_ahsv), -1);
12545
- rb_define_method(SwigClassColor.klass, "red", VALUEFUNC(_wrap_Color_red), -1);
12546
- rb_define_method(SwigClassColor.klass, "green", VALUEFUNC(_wrap_Color_green), -1);
12547
- rb_define_method(SwigClassColor.klass, "blue", VALUEFUNC(_wrap_Color_blue), -1);
12548
- rb_define_method(SwigClassColor.klass, "alpha", VALUEFUNC(_wrap_Color_alpha), -1);
12549
- rb_define_method(SwigClassColor.klass, "red=", VALUEFUNC(_wrap_Color_rede___), -1);
12550
- rb_define_method(SwigClassColor.klass, "green=", VALUEFUNC(_wrap_Color_greene___), -1);
12551
- rb_define_method(SwigClassColor.klass, "blue=", VALUEFUNC(_wrap_Color_bluee___), -1);
12552
- rb_define_method(SwigClassColor.klass, "alpha=", VALUEFUNC(_wrap_Color_alphae___), -1);
12553
12520
  rb_define_method(SwigClassColor.klass, "hue", VALUEFUNC(_wrap_Color_hue), -1);
12554
12521
  rb_define_method(SwigClassColor.klass, "hue=", VALUEFUNC(_wrap_Color_huee___), -1);
12555
12522
  rb_define_method(SwigClassColor.klass, "saturation", VALUEFUNC(_wrap_Color_saturation), -1);
@@ -12562,6 +12529,7 @@ SWIGEXPORT void Init_gosu(void) {
12562
12529
  rb_define_singleton_method(SwigClassColor.klass, "rgb", VALUEFUNC(_wrap_Color_rgb), -1);
12563
12530
  rb_define_singleton_method(SwigClassColor.klass, "rgba", VALUEFUNC(_wrap_Color_rgba), -1);
12564
12531
  rb_define_singleton_method(SwigClassColor.klass, "argb", VALUEFUNC(_wrap_Color_argb), -1);
12532
+ rb_define_singleton_method(SwigClassColor.klass, "from_ahsv", VALUEFUNC(_wrap_Color_from_ahsv), -1);
12565
12533
  rb_define_method(SwigClassColor.klass, "to_i", VALUEFUNC(_wrap_Color_to_i), -1);
12566
12534
  rb_define_method(SwigClassColor.klass, "dup", VALUEFUNC(_wrap_Color_dup), -1);
12567
12535
  rb_define_method(SwigClassColor.klass, "inspect", VALUEFUNC(_wrap_Color_inspect), -1);
@@ -12988,6 +12956,7 @@ SWIGEXPORT void Init_gosu(void) {
12988
12956
  rb_define_method(SwigClassWindow.klass, "draw", VALUEFUNC(_wrap_Window_draw), -1);
12989
12957
  rb_define_method(SwigClassWindow.klass, "needs_redraw?", VALUEFUNC(_wrap_Window_needs_redrawq___), -1);
12990
12958
  rb_define_method(SwigClassWindow.klass, "needs_cursor?", VALUEFUNC(_wrap_Window_needs_cursorq___), -1);
12959
+ rb_define_method(SwigClassWindow.klass, "gain_focus", VALUEFUNC(_wrap_Window_gain_focus), -1);
12991
12960
  rb_define_method(SwigClassWindow.klass, "lose_focus", VALUEFUNC(_wrap_Window_lose_focus), -1);
12992
12961
  rb_define_method(SwigClassWindow.klass, "release_memory", VALUEFUNC(_wrap_Window_release_memory), -1);
12993
12962
  rb_define_method(SwigClassWindow.klass, "button_down", VALUEFUNC(_wrap_Window_button_down), -1);