gosu 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/include/Gosu/Color.hpp +48 -100
- data/include/Gosu/Fwd.hpp +1 -1
- data/include/Gosu/Math.hpp +4 -16
- data/include/Gosu/Platform.hpp +1 -51
- data/include/Gosu/Text.hpp +37 -40
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +2 -0
- data/lib/gosu/swig_patches.rb +31 -3
- data/rdoc/gosu.rb +9 -1
- data/src/Bitmap.cpp +13 -13
- data/src/Color.cpp +50 -46
- data/src/GosuViewController.cpp +2 -0
- data/src/LargeImageData.cpp +19 -19
- data/src/RubyGosu.cxx +386 -419
- data/src/RubyGosu.h +1 -0
- data/src/Text.cpp +31 -32
- data/src/TrueTypeFont.cpp +1 -1
- data/src/TrueTypeFontApple.cpp +0 -1
- data/src/Utility.cpp +31 -1
- data/src/WinUtility.hpp +2 -1
- data/src/Window.cpp +8 -0
- data/src/WindowUIKit.cpp +2 -2
- metadata +3 -3
data/src/RubyGosu.cxx
CHANGED
@@ -2562,6 +2562,13 @@ SWIG_From_unsigned_SS_int (unsigned int value)
|
|
2562
2562
|
#include <string>
|
2563
2563
|
|
2564
2564
|
|
2565
|
+
SWIGINTERNINLINE VALUE
|
2566
|
+
SWIG_From_unsigned_SS_char (unsigned char value)
|
2567
|
+
{
|
2568
|
+
return SWIG_From_unsigned_SS_long (value);
|
2569
|
+
}
|
2570
|
+
|
2571
|
+
|
2565
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
|
{
|
@@ -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
|
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
|
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
|
-
|
2625
|
-
|
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
|
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
|
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_%
|
2644
|
-
self->alpha
|
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
|
|
@@ -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 =
|
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
|
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
|
}
|
@@ -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
|
|
@@ -3913,271 +3923,97 @@ fail:
|
|
3913
3923
|
static swig_class SwigClassColor;
|
3914
3924
|
|
3915
3925
|
SWIGINTERN VALUE
|
3916
|
-
|
3917
|
-
|
3918
|
-
Gosu::Color
|
3919
|
-
|
3920
|
-
|
3921
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
3922
|
-
}
|
3923
|
-
{
|
3924
|
-
try {
|
3925
|
-
result = (Gosu::Color *)new Gosu::Color();
|
3926
|
-
DATA_PTR(self) = result;
|
3927
|
-
SWIG_RubyAddTracking(result, self);
|
3928
|
-
}
|
3929
|
-
catch (const std::exception& e) {
|
3930
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
3931
|
-
}
|
3932
|
-
}
|
3933
|
-
return self;
|
3934
|
-
fail:
|
3935
|
-
return Qnil;
|
3936
|
-
}
|
3937
|
-
|
3938
|
-
|
3939
|
-
SWIGINTERN VALUE
|
3940
|
-
_wrap_new_Color__SWIG_1(int argc, VALUE *argv, VALUE self) {
|
3941
|
-
unsigned int arg1 ;
|
3942
|
-
unsigned int val1 ;
|
3943
|
-
int ecode1 = 0 ;
|
3944
|
-
const char *classname SWIGUNUSED = "Gosu::Color";
|
3945
|
-
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 ;
|
3946
3931
|
|
3947
3932
|
if ((argc < 1) || (argc > 1)) {
|
3948
3933
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
3949
3934
|
}
|
3950
|
-
|
3951
|
-
if (!SWIG_IsOK(
|
3952
|
-
SWIG_exception_fail(SWIG_ArgError(
|
3953
|
-
}
|
3954
|
-
arg1 =
|
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);
|
3955
3940
|
{
|
3956
|
-
|
3957
|
-
result = (Gosu::Color *)new Gosu::Color(arg1);
|
3958
|
-
DATA_PTR(self) = result;
|
3959
|
-
SWIG_RubyAddTracking(result, self);
|
3960
|
-
}
|
3961
|
-
catch (const std::exception& e) {
|
3962
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
3963
|
-
}
|
3941
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
3964
3942
|
}
|
3965
|
-
|
3943
|
+
if (arg1) (arg1)->red = arg2;
|
3944
|
+
return Qnil;
|
3966
3945
|
fail:
|
3967
3946
|
return Qnil;
|
3968
3947
|
}
|
3969
3948
|
|
3970
3949
|
|
3971
3950
|
SWIGINTERN VALUE
|
3972
|
-
|
3973
|
-
Gosu::Color
|
3974
|
-
|
3975
|
-
|
3976
|
-
|
3977
|
-
|
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;
|
3978
3957
|
|
3979
|
-
if ((argc <
|
3980
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
3981
|
-
}
|
3982
|
-
{
|
3983
|
-
arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
3984
|
-
}
|
3985
|
-
{
|
3986
|
-
arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
|
3987
|
-
}
|
3988
|
-
{
|
3989
|
-
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;
|
3990
3960
|
}
|
3991
|
-
|
3992
|
-
|
3993
|
-
|
3994
|
-
DATA_PTR(self) = result;
|
3995
|
-
SWIG_RubyAddTracking(result, self);
|
3996
|
-
}
|
3997
|
-
catch (const std::exception& e) {
|
3998
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
3999
|
-
}
|
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 ));
|
4000
3964
|
}
|
4001
|
-
|
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;
|
4002
3969
|
fail:
|
4003
3970
|
return Qnil;
|
4004
3971
|
}
|
4005
3972
|
|
4006
3973
|
|
4007
3974
|
SWIGINTERN VALUE
|
4008
|
-
|
4009
|
-
|
4010
|
-
#else
|
4011
|
-
_wrap_Color_allocate(int argc, VALUE *argv, VALUE self)
|
4012
|
-
#endif
|
4013
|
-
{
|
4014
|
-
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Gosu__Color);
|
4015
|
-
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
|
4016
|
-
rb_obj_call_init(vresult, argc, argv);
|
4017
|
-
#endif
|
4018
|
-
return vresult;
|
4019
|
-
}
|
4020
|
-
|
4021
|
-
|
4022
|
-
SWIGINTERN VALUE
|
4023
|
-
_wrap_new_Color__SWIG_3(int argc, VALUE *argv, VALUE self) {
|
4024
|
-
Gosu::Color::Channel arg1 ;
|
3975
|
+
_wrap_Color_green_set(int argc, VALUE *argv, VALUE self) {
|
3976
|
+
Gosu::Color *arg1 = (Gosu::Color *) 0 ;
|
4025
3977
|
Gosu::Color::Channel arg2 ;
|
4026
|
-
|
4027
|
-
|
4028
|
-
const char *classname SWIGUNUSED = "Gosu::Color";
|
4029
|
-
Gosu::Color *result = 0 ;
|
3978
|
+
void *argp1 = 0 ;
|
3979
|
+
int res1 = 0 ;
|
4030
3980
|
|
4031
|
-
if ((argc <
|
4032
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
4033
|
-
}
|
4034
|
-
{
|
4035
|
-
arg1 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4036
|
-
}
|
4037
|
-
{
|
4038
|
-
arg2 = Gosu::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
|
4039
|
-
}
|
4040
|
-
{
|
4041
|
-
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;
|
4042
3983
|
}
|
4043
|
-
|
4044
|
-
|
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 ));
|
4045
3987
|
}
|
3988
|
+
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4046
3989
|
{
|
4047
|
-
|
4048
|
-
result = (Gosu::Color *)new Gosu::Color(arg1,arg2,arg3,arg4);
|
4049
|
-
DATA_PTR(self) = result;
|
4050
|
-
SWIG_RubyAddTracking(result, self);
|
4051
|
-
}
|
4052
|
-
catch (const std::exception& e) {
|
4053
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
4054
|
-
}
|
3990
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4055
3991
|
}
|
4056
|
-
|
4057
|
-
fail:
|
3992
|
+
if (arg1) (arg1)->green = arg2;
|
4058
3993
|
return Qnil;
|
4059
|
-
}
|
4060
|
-
|
4061
|
-
|
4062
|
-
SWIGINTERN VALUE _wrap_new_Color(int nargs, VALUE *args, VALUE self) {
|
4063
|
-
int argc;
|
4064
|
-
VALUE argv[4];
|
4065
|
-
int ii;
|
4066
|
-
|
4067
|
-
argc = nargs;
|
4068
|
-
if (argc > 4) SWIG_fail;
|
4069
|
-
for (ii = 0; (ii < argc); ++ii) {
|
4070
|
-
argv[ii] = args[ii];
|
4071
|
-
}
|
4072
|
-
if (argc == 0) {
|
4073
|
-
return _wrap_new_Color__SWIG_0(nargs, args, self);
|
4074
|
-
}
|
4075
|
-
if (argc == 1) {
|
4076
|
-
int _v;
|
4077
|
-
{
|
4078
|
-
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
|
4079
|
-
_v = SWIG_CheckState(res);
|
4080
|
-
}
|
4081
|
-
if (_v) {
|
4082
|
-
return _wrap_new_Color__SWIG_1(nargs, args, self);
|
4083
|
-
}
|
4084
|
-
}
|
4085
|
-
if (argc == 3) {
|
4086
|
-
int _v;
|
4087
|
-
{
|
4088
|
-
_v = !!rb_respond_to(argv[0], rb_intern("to_i"));
|
4089
|
-
}
|
4090
|
-
if (_v) {
|
4091
|
-
{
|
4092
|
-
_v = !!rb_respond_to(argv[1], rb_intern("to_i"));
|
4093
|
-
}
|
4094
|
-
if (_v) {
|
4095
|
-
{
|
4096
|
-
_v = !!rb_respond_to(argv[2], rb_intern("to_i"));
|
4097
|
-
}
|
4098
|
-
if (_v) {
|
4099
|
-
return _wrap_new_Color__SWIG_2(nargs, args, self);
|
4100
|
-
}
|
4101
|
-
}
|
4102
|
-
}
|
4103
|
-
}
|
4104
|
-
if (argc == 4) {
|
4105
|
-
int _v;
|
4106
|
-
{
|
4107
|
-
_v = !!rb_respond_to(argv[0], rb_intern("to_i"));
|
4108
|
-
}
|
4109
|
-
if (_v) {
|
4110
|
-
{
|
4111
|
-
_v = !!rb_respond_to(argv[1], rb_intern("to_i"));
|
4112
|
-
}
|
4113
|
-
if (_v) {
|
4114
|
-
{
|
4115
|
-
_v = !!rb_respond_to(argv[2], rb_intern("to_i"));
|
4116
|
-
}
|
4117
|
-
if (_v) {
|
4118
|
-
{
|
4119
|
-
_v = !!rb_respond_to(argv[3], rb_intern("to_i"));
|
4120
|
-
}
|
4121
|
-
if (_v) {
|
4122
|
-
return _wrap_new_Color__SWIG_3(nargs, args, self);
|
4123
|
-
}
|
4124
|
-
}
|
4125
|
-
}
|
4126
|
-
}
|
4127
|
-
}
|
4128
|
-
|
4129
3994
|
fail:
|
4130
|
-
Ruby_Format_OverloadedError( argc, 4, "Color.new",
|
4131
|
-
" Color.new()\n"
|
4132
|
-
" Color.new(unsigned int argb)\n"
|
4133
|
-
" Color.new(Gosu::Color::Channel red, Gosu::Color::Channel green, Gosu::Color::Channel blue)\n"
|
4134
|
-
" Color.new(Gosu::Color::Channel alpha, Gosu::Color::Channel red, Gosu::Color::Channel green, Gosu::Color::Channel blue)\n");
|
4135
|
-
|
4136
3995
|
return Qnil;
|
4137
3996
|
}
|
4138
3997
|
|
4139
3998
|
|
4140
3999
|
SWIGINTERN VALUE
|
4141
|
-
|
4142
|
-
|
4143
|
-
|
4144
|
-
|
4145
|
-
|
4146
|
-
int ecode1 = 0 ;
|
4147
|
-
double val2 ;
|
4148
|
-
int ecode2 = 0 ;
|
4149
|
-
double val3 ;
|
4150
|
-
int ecode3 = 0 ;
|
4151
|
-
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;
|
4152
4005
|
VALUE vresult = Qnil;
|
4153
4006
|
|
4154
|
-
if ((argc <
|
4155
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
4007
|
+
if ((argc < 0) || (argc > 0)) {
|
4008
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
4156
4009
|
}
|
4157
|
-
|
4158
|
-
if (!SWIG_IsOK(
|
4159
|
-
SWIG_exception_fail(SWIG_ArgError(
|
4160
|
-
}
|
4161
|
-
arg1 = static_cast< double >(val1);
|
4162
|
-
ecode2 = SWIG_AsVal_double(argv[1], &val2);
|
4163
|
-
if (!SWIG_IsOK(ecode2)) {
|
4164
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 2, argv[1] ));
|
4165
|
-
}
|
4166
|
-
arg2 = static_cast< double >(val2);
|
4167
|
-
ecode3 = SWIG_AsVal_double(argv[2], &val3);
|
4168
|
-
if (!SWIG_IsOK(ecode3)) {
|
4169
|
-
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::Color::from_hsv", 3, argv[2] ));
|
4170
|
-
}
|
4171
|
-
arg3 = static_cast< double >(val3);
|
4172
|
-
{
|
4173
|
-
try {
|
4174
|
-
result = Gosu::Color::from_hsv(arg1,arg2,arg3);
|
4175
|
-
}
|
4176
|
-
catch (const std::exception& e) {
|
4177
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
4178
|
-
}
|
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 ));
|
4179
4013
|
}
|
4180
|
-
|
4014
|
+
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4015
|
+
result = ((arg1)->green);
|
4016
|
+
vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
|
4181
4017
|
return vresult;
|
4182
4018
|
fail:
|
4183
4019
|
return Qnil;
|
@@ -4185,58 +4021,32 @@ fail:
|
|
4185
4021
|
|
4186
4022
|
|
4187
4023
|
SWIGINTERN VALUE
|
4188
|
-
|
4189
|
-
Gosu::Color
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
double val2 ;
|
4194
|
-
int ecode2 = 0 ;
|
4195
|
-
double val3 ;
|
4196
|
-
int ecode3 = 0 ;
|
4197
|
-
double val4 ;
|
4198
|
-
int ecode4 = 0 ;
|
4199
|
-
Gosu::Color result;
|
4200
|
-
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 ;
|
4201
4029
|
|
4202
|
-
if ((argc <
|
4203
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
4030
|
+
if ((argc < 1) || (argc > 1)) {
|
4031
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
4204
4032
|
}
|
4205
|
-
|
4206
|
-
|
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 ));
|
4207
4036
|
}
|
4208
|
-
|
4209
|
-
if (!SWIG_IsOK(ecode2)) {
|
4210
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu::Color::from_ahsv", 2, argv[1] ));
|
4211
|
-
}
|
4212
|
-
arg2 = static_cast< double >(val2);
|
4213
|
-
ecode3 = SWIG_AsVal_double(argv[2], &val3);
|
4214
|
-
if (!SWIG_IsOK(ecode3)) {
|
4215
|
-
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Gosu::Color::from_ahsv", 3, argv[2] ));
|
4216
|
-
}
|
4217
|
-
arg3 = static_cast< double >(val3);
|
4218
|
-
ecode4 = SWIG_AsVal_double(argv[3], &val4);
|
4219
|
-
if (!SWIG_IsOK(ecode4)) {
|
4220
|
-
SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","Gosu::Color::from_ahsv", 4, argv[3] ));
|
4221
|
-
}
|
4222
|
-
arg4 = static_cast< double >(val4);
|
4037
|
+
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4223
4038
|
{
|
4224
|
-
|
4225
|
-
result = Gosu::Color::from_ahsv(arg1,arg2,arg3,arg4);
|
4226
|
-
}
|
4227
|
-
catch (const std::exception& e) {
|
4228
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
4229
|
-
}
|
4039
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4230
4040
|
}
|
4231
|
-
|
4232
|
-
return
|
4041
|
+
if (arg1) (arg1)->blue = arg2;
|
4042
|
+
return Qnil;
|
4233
4043
|
fail:
|
4234
4044
|
return Qnil;
|
4235
4045
|
}
|
4236
4046
|
|
4237
4047
|
|
4238
4048
|
SWIGINTERN VALUE
|
4239
|
-
|
4049
|
+
_wrap_Color_blue_get(int argc, VALUE *argv, VALUE self) {
|
4240
4050
|
Gosu::Color *arg1 = (Gosu::Color *) 0 ;
|
4241
4051
|
void *argp1 = 0 ;
|
4242
4052
|
int res1 = 0 ;
|
@@ -4248,17 +4058,10 @@ _wrap_Color_red(int argc, VALUE *argv, VALUE self) {
|
|
4248
4058
|
}
|
4249
4059
|
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
|
4250
4060
|
if (!SWIG_IsOK(res1)) {
|
4251
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color
|
4061
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","blue", 1, self ));
|
4252
4062
|
}
|
4253
4063
|
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4254
|
-
|
4255
|
-
try {
|
4256
|
-
result = ((Gosu::Color const *)arg1)->red();
|
4257
|
-
}
|
4258
|
-
catch (const std::exception& e) {
|
4259
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
4260
|
-
}
|
4261
|
-
}
|
4064
|
+
result = ((arg1)->blue);
|
4262
4065
|
vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
|
4263
4066
|
return vresult;
|
4264
4067
|
fail:
|
@@ -4267,38 +4070,32 @@ fail:
|
|
4267
4070
|
|
4268
4071
|
|
4269
4072
|
SWIGINTERN VALUE
|
4270
|
-
|
4073
|
+
_wrap_Color_alpha_set(int argc, VALUE *argv, VALUE self) {
|
4271
4074
|
Gosu::Color *arg1 = (Gosu::Color *) 0 ;
|
4075
|
+
Gosu::Color::Channel arg2 ;
|
4272
4076
|
void *argp1 = 0 ;
|
4273
4077
|
int res1 = 0 ;
|
4274
|
-
Gosu::Color::Channel result;
|
4275
|
-
VALUE vresult = Qnil;
|
4276
4078
|
|
4277
|
-
if ((argc <
|
4278
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
4079
|
+
if ((argc < 1) || (argc > 1)) {
|
4080
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
4279
4081
|
}
|
4280
4082
|
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
|
4281
4083
|
if (!SWIG_IsOK(res1)) {
|
4282
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color
|
4084
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","alpha", 1, self ));
|
4283
4085
|
}
|
4284
4086
|
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4285
4087
|
{
|
4286
|
-
|
4287
|
-
result = ((Gosu::Color const *)arg1)->green();
|
4288
|
-
}
|
4289
|
-
catch (const std::exception& e) {
|
4290
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
4291
|
-
}
|
4088
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4292
4089
|
}
|
4293
|
-
|
4294
|
-
return
|
4090
|
+
if (arg1) (arg1)->alpha = arg2;
|
4091
|
+
return Qnil;
|
4295
4092
|
fail:
|
4296
4093
|
return Qnil;
|
4297
4094
|
}
|
4298
4095
|
|
4299
4096
|
|
4300
4097
|
SWIGINTERN VALUE
|
4301
|
-
|
4098
|
+
_wrap_Color_alpha_get(int argc, VALUE *argv, VALUE self) {
|
4302
4099
|
Gosu::Color *arg1 = (Gosu::Color *) 0 ;
|
4303
4100
|
void *argp1 = 0 ;
|
4304
4101
|
int res1 = 0 ;
|
@@ -4310,17 +4107,10 @@ _wrap_Color_blue(int argc, VALUE *argv, VALUE self) {
|
|
4310
4107
|
}
|
4311
4108
|
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
|
4312
4109
|
if (!SWIG_IsOK(res1)) {
|
4313
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color
|
4110
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","alpha", 1, self ));
|
4314
4111
|
}
|
4315
4112
|
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4316
|
-
|
4317
|
-
try {
|
4318
|
-
result = ((Gosu::Color const *)arg1)->blue();
|
4319
|
-
}
|
4320
|
-
catch (const std::exception& e) {
|
4321
|
-
SWIG_exception(SWIG_RuntimeError, e.what());
|
4322
|
-
}
|
4323
|
-
}
|
4113
|
+
result = ((arg1)->alpha);
|
4324
4114
|
vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
|
4325
4115
|
return vresult;
|
4326
4116
|
fail:
|
@@ -4329,159 +4119,242 @@ fail:
|
|
4329
4119
|
|
4330
4120
|
|
4331
4121
|
SWIGINTERN VALUE
|
4332
|
-
|
4333
|
-
|
4334
|
-
|
4335
|
-
int res1 = 0 ;
|
4336
|
-
Gosu::Color::Channel result;
|
4337
|
-
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 ;
|
4338
4125
|
|
4339
4126
|
if ((argc < 0) || (argc > 0)) {
|
4340
4127
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
4341
4128
|
}
|
4342
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
|
4343
|
-
if (!SWIG_IsOK(res1)) {
|
4344
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color const *","alpha", 1, self ));
|
4345
|
-
}
|
4346
|
-
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4347
4129
|
{
|
4348
4130
|
try {
|
4349
|
-
result = (
|
4131
|
+
result = (Gosu::Color *)new Gosu::Color();
|
4132
|
+
DATA_PTR(self) = result;
|
4133
|
+
SWIG_RubyAddTracking(result, self);
|
4350
4134
|
}
|
4351
4135
|
catch (const std::exception& e) {
|
4352
4136
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
4353
4137
|
}
|
4354
4138
|
}
|
4355
|
-
|
4356
|
-
return vresult;
|
4139
|
+
return self;
|
4357
4140
|
fail:
|
4358
4141
|
return Qnil;
|
4359
4142
|
}
|
4360
4143
|
|
4361
4144
|
|
4362
4145
|
SWIGINTERN VALUE
|
4363
|
-
|
4364
|
-
|
4365
|
-
|
4366
|
-
|
4367
|
-
|
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 ;
|
4368
4152
|
|
4369
4153
|
if ((argc < 1) || (argc > 1)) {
|
4370
4154
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
4371
4155
|
}
|
4372
|
-
|
4373
|
-
if (!SWIG_IsOK(
|
4374
|
-
SWIG_exception_fail(SWIG_ArgError(
|
4375
|
-
}
|
4376
|
-
arg1 =
|
4377
|
-
{
|
4378
|
-
arg2 = Gosu::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4379
|
-
}
|
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);
|
4380
4161
|
{
|
4381
4162
|
try {
|
4382
|
-
(
|
4163
|
+
result = (Gosu::Color *)new Gosu::Color(arg1);
|
4164
|
+
DATA_PTR(self) = result;
|
4165
|
+
SWIG_RubyAddTracking(result, self);
|
4383
4166
|
}
|
4384
4167
|
catch (const std::exception& e) {
|
4385
4168
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
4386
4169
|
}
|
4387
4170
|
}
|
4388
|
-
return
|
4171
|
+
return self;
|
4389
4172
|
fail:
|
4390
4173
|
return Qnil;
|
4391
4174
|
}
|
4392
4175
|
|
4393
4176
|
|
4394
4177
|
SWIGINTERN VALUE
|
4395
|
-
|
4396
|
-
|
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 ;
|
4397
4195
|
Gosu::Color::Channel arg2 ;
|
4398
|
-
|
4399
|
-
|
4196
|
+
Gosu::Color::Channel arg3 ;
|
4197
|
+
const char *classname SWIGUNUSED = "Gosu::Color";
|
4198
|
+
Gosu::Color *result = 0 ;
|
4400
4199
|
|
4401
|
-
if ((argc <
|
4402
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
4200
|
+
if ((argc < 3) || (argc > 3)) {
|
4201
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
|
4403
4202
|
}
|
4404
|
-
|
4405
|
-
|
4406
|
-
|
4203
|
+
{
|
4204
|
+
arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4205
|
+
}
|
4206
|
+
{
|
4207
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
|
4407
4208
|
}
|
4408
|
-
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4409
4209
|
{
|
4410
|
-
|
4210
|
+
arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
|
4411
4211
|
}
|
4412
4212
|
{
|
4413
4213
|
try {
|
4414
|
-
(
|
4214
|
+
result = (Gosu::Color *)new Gosu::Color(arg1,arg2,arg3);
|
4215
|
+
DATA_PTR(self) = result;
|
4216
|
+
SWIG_RubyAddTracking(result, self);
|
4415
4217
|
}
|
4416
4218
|
catch (const std::exception& e) {
|
4417
4219
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
4418
4220
|
}
|
4419
4221
|
}
|
4222
|
+
return self;
|
4223
|
+
fail:
|
4420
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
|
+
|
4421
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
|
+
|
4422
4277
|
return Qnil;
|
4423
4278
|
}
|
4424
4279
|
|
4425
4280
|
|
4426
4281
|
SWIGINTERN VALUE
|
4427
|
-
|
4282
|
+
_wrap_Color_with_alpha(int argc, VALUE *argv, VALUE self) {
|
4428
4283
|
Gosu::Color *arg1 = (Gosu::Color *) 0 ;
|
4429
4284
|
Gosu::Color::Channel arg2 ;
|
4430
4285
|
void *argp1 = 0 ;
|
4431
4286
|
int res1 = 0 ;
|
4287
|
+
Gosu::Color result;
|
4288
|
+
VALUE vresult = Qnil;
|
4432
4289
|
|
4433
4290
|
if ((argc < 1) || (argc > 1)) {
|
4434
4291
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
4435
4292
|
}
|
4436
4293
|
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
|
4437
4294
|
if (!SWIG_IsOK(res1)) {
|
4438
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","
|
4295
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","with_alpha", 1, self ));
|
4439
4296
|
}
|
4440
4297
|
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4441
4298
|
{
|
4442
|
-
arg2 =
|
4299
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4443
4300
|
}
|
4444
4301
|
{
|
4445
4302
|
try {
|
4446
|
-
(arg1)->
|
4303
|
+
result = (arg1)->with_alpha(arg2);
|
4447
4304
|
}
|
4448
4305
|
catch (const std::exception& e) {
|
4449
4306
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
4450
4307
|
}
|
4451
4308
|
}
|
4452
|
-
|
4309
|
+
vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
|
4310
|
+
return vresult;
|
4453
4311
|
fail:
|
4454
4312
|
return Qnil;
|
4455
4313
|
}
|
4456
4314
|
|
4457
4315
|
|
4458
4316
|
SWIGINTERN VALUE
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
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;
|
4464
4329
|
|
4465
|
-
if ((argc <
|
4466
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
4467
|
-
}
|
4468
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Color, 0 | 0 );
|
4469
|
-
if (!SWIG_IsOK(res1)) {
|
4470
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Color *","set_alpha", 1, self ));
|
4471
|
-
}
|
4472
|
-
arg1 = reinterpret_cast< Gosu::Color * >(argp1);
|
4473
|
-
{
|
4474
|
-
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;
|
4475
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);
|
4476
4348
|
{
|
4477
4349
|
try {
|
4478
|
-
(arg1
|
4350
|
+
result = Gosu::Color::from_hsv(arg1,arg2,arg3);
|
4479
4351
|
}
|
4480
4352
|
catch (const std::exception& e) {
|
4481
4353
|
SWIG_exception(SWIG_RuntimeError, e.what());
|
4482
4354
|
}
|
4483
4355
|
}
|
4484
|
-
|
4356
|
+
vresult = SWIG_NewPointerObj((new Gosu::Color(static_cast< const Gosu::Color& >(result))), SWIGTYPE_p_Gosu__Color, SWIG_POINTER_OWN | 0 );
|
4357
|
+
return vresult;
|
4485
4358
|
fail:
|
4486
4359
|
return Qnil;
|
4487
4360
|
}
|
@@ -4824,13 +4697,13 @@ _wrap_Color_rgb(int argc, VALUE *argv, VALUE self) {
|
|
4824
4697
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
|
4825
4698
|
}
|
4826
4699
|
{
|
4827
|
-
arg1 =
|
4700
|
+
arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4828
4701
|
}
|
4829
4702
|
{
|
4830
|
-
arg2 =
|
4703
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
|
4831
4704
|
}
|
4832
4705
|
{
|
4833
|
-
arg3 =
|
4706
|
+
arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
|
4834
4707
|
}
|
4835
4708
|
{
|
4836
4709
|
try {
|
@@ -4860,16 +4733,16 @@ _wrap_Color_rgba__SWIG_0(int argc, VALUE *argv, VALUE self) {
|
|
4860
4733
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
|
4861
4734
|
}
|
4862
4735
|
{
|
4863
|
-
arg1 =
|
4736
|
+
arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4864
4737
|
}
|
4865
4738
|
{
|
4866
|
-
arg2 =
|
4739
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
|
4867
4740
|
}
|
4868
4741
|
{
|
4869
|
-
arg3 =
|
4742
|
+
arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
|
4870
4743
|
}
|
4871
4744
|
{
|
4872
|
-
arg4 =
|
4745
|
+
arg4 = std::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
|
4873
4746
|
}
|
4874
4747
|
{
|
4875
4748
|
try {
|
@@ -4984,16 +4857,16 @@ _wrap_Color_argb__SWIG_1(int argc, VALUE *argv, VALUE self) {
|
|
4984
4857
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
|
4985
4858
|
}
|
4986
4859
|
{
|
4987
|
-
arg1 =
|
4860
|
+
arg1 = std::clamp<int>(NUM2ULONG(argv[0]), 0, 255);
|
4988
4861
|
}
|
4989
4862
|
{
|
4990
|
-
arg2 =
|
4863
|
+
arg2 = std::clamp<int>(NUM2ULONG(argv[1]), 0, 255);
|
4991
4864
|
}
|
4992
4865
|
{
|
4993
|
-
arg3 =
|
4866
|
+
arg3 = std::clamp<int>(NUM2ULONG(argv[2]), 0, 255);
|
4994
4867
|
}
|
4995
4868
|
{
|
4996
|
-
arg4 =
|
4869
|
+
arg4 = std::clamp<int>(NUM2ULONG(argv[3]), 0, 255);
|
4997
4870
|
}
|
4998
4871
|
{
|
4999
4872
|
try {
|
@@ -5105,6 +4978,57 @@ fail:
|
|
5105
4978
|
}
|
5106
4979
|
|
5107
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
|
+
|
5108
5032
|
/*
|
5109
5033
|
Document-method: Gosu::Color.to_i
|
5110
5034
|
|
@@ -9936,6 +9860,47 @@ fail:
|
|
9936
9860
|
}
|
9937
9861
|
|
9938
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
|
+
|
9939
9904
|
SWIGINTERN VALUE
|
9940
9905
|
_wrap_Window_lose_focus(int argc, VALUE *argv, VALUE self) {
|
9941
9906
|
Gosu::Window *arg1 = (Gosu::Window *) 0 ;
|
@@ -12520,7 +12485,7 @@ SWIGEXPORT void Init_gosu(void) {
|
|
12520
12485
|
rb_define_const(mGosu, "VERSION", SWIG_From_std_string(static_cast< std::string >(Gosu::VERSION)));
|
12521
12486
|
rb_define_const(mGosu, "LICENSES", SWIG_From_std_string(static_cast< std::string >(Gosu::LICENSES)));
|
12522
12487
|
rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(1)));
|
12523
|
-
rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(
|
12488
|
+
rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(3)));
|
12524
12489
|
rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(0)));
|
12525
12490
|
rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
|
12526
12491
|
rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
|
@@ -12542,16 +12507,16 @@ SWIGEXPORT void Init_gosu(void) {
|
|
12542
12507
|
rb_define_alloc_func(SwigClassColor.klass, _wrap_Color_allocate);
|
12543
12508
|
rb_define_method(SwigClassColor.klass, "initialize", VALUEFUNC(_wrap_new_Color), -1);
|
12544
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);
|
12545
12519
|
rb_define_singleton_method(SwigClassColor.klass, "from_hsv", VALUEFUNC(_wrap_Color_from_hsv), -1);
|
12546
|
-
rb_define_singleton_method(SwigClassColor.klass, "from_ahsv", VALUEFUNC(_wrap_Color_from_ahsv), -1);
|
12547
|
-
rb_define_method(SwigClassColor.klass, "red", VALUEFUNC(_wrap_Color_red), -1);
|
12548
|
-
rb_define_method(SwigClassColor.klass, "green", VALUEFUNC(_wrap_Color_green), -1);
|
12549
|
-
rb_define_method(SwigClassColor.klass, "blue", VALUEFUNC(_wrap_Color_blue), -1);
|
12550
|
-
rb_define_method(SwigClassColor.klass, "alpha", VALUEFUNC(_wrap_Color_alpha), -1);
|
12551
|
-
rb_define_method(SwigClassColor.klass, "red=", VALUEFUNC(_wrap_Color_rede___), -1);
|
12552
|
-
rb_define_method(SwigClassColor.klass, "green=", VALUEFUNC(_wrap_Color_greene___), -1);
|
12553
|
-
rb_define_method(SwigClassColor.klass, "blue=", VALUEFUNC(_wrap_Color_bluee___), -1);
|
12554
|
-
rb_define_method(SwigClassColor.klass, "alpha=", VALUEFUNC(_wrap_Color_alphae___), -1);
|
12555
12520
|
rb_define_method(SwigClassColor.klass, "hue", VALUEFUNC(_wrap_Color_hue), -1);
|
12556
12521
|
rb_define_method(SwigClassColor.klass, "hue=", VALUEFUNC(_wrap_Color_huee___), -1);
|
12557
12522
|
rb_define_method(SwigClassColor.klass, "saturation", VALUEFUNC(_wrap_Color_saturation), -1);
|
@@ -12564,6 +12529,7 @@ SWIGEXPORT void Init_gosu(void) {
|
|
12564
12529
|
rb_define_singleton_method(SwigClassColor.klass, "rgb", VALUEFUNC(_wrap_Color_rgb), -1);
|
12565
12530
|
rb_define_singleton_method(SwigClassColor.klass, "rgba", VALUEFUNC(_wrap_Color_rgba), -1);
|
12566
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);
|
12567
12533
|
rb_define_method(SwigClassColor.klass, "to_i", VALUEFUNC(_wrap_Color_to_i), -1);
|
12568
12534
|
rb_define_method(SwigClassColor.klass, "dup", VALUEFUNC(_wrap_Color_dup), -1);
|
12569
12535
|
rb_define_method(SwigClassColor.klass, "inspect", VALUEFUNC(_wrap_Color_inspect), -1);
|
@@ -12990,6 +12956,7 @@ SWIGEXPORT void Init_gosu(void) {
|
|
12990
12956
|
rb_define_method(SwigClassWindow.klass, "draw", VALUEFUNC(_wrap_Window_draw), -1);
|
12991
12957
|
rb_define_method(SwigClassWindow.klass, "needs_redraw?", VALUEFUNC(_wrap_Window_needs_redrawq___), -1);
|
12992
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);
|
12993
12960
|
rb_define_method(SwigClassWindow.klass, "lose_focus", VALUEFUNC(_wrap_Window_lose_focus), -1);
|
12994
12961
|
rb_define_method(SwigClassWindow.klass, "release_memory", VALUEFUNC(_wrap_Window_release_memory), -1);
|
12995
12962
|
rb_define_method(SwigClassWindow.klass, "button_down", VALUEFUNC(_wrap_Window_button_down), -1);
|