gosu 0.14.0.pre2 → 0.14.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.
data/src/MarkupParser.hpp CHANGED
@@ -54,8 +54,8 @@ namespace Gosu
54
54
  void flush_to_consumer();
55
55
 
56
56
  public:
57
- MarkupParser(const char* markup, unsigned base_flags, bool split_words,
57
+ MarkupParser(unsigned base_flags, bool split_words,
58
58
  std::function<void (std::vector<FormattedString>)> consumer);
59
- void parse();
59
+ void parse(const std::string& markup);
60
60
  };
61
61
  }
data/src/Resolution.cpp CHANGED
@@ -1,86 +1,117 @@
1
- #include <Gosu/Gosu.hpp>
1
+ #include <Gosu/Platform.hpp>
2
+ #ifndef GOSU_IS_IPHONE // iPhone definitions live in WindowUIKit.cpp
2
3
 
3
- #ifdef GOSU_IS_WIN
4
- #include <windows.h>
4
+ #include <Gosu/Window.hpp>
5
+ #include "GraphicsImpl.hpp"
6
+ #include <SDL.h>
5
7
 
6
- // On Windows, do not use the SDL 2 code below. It reports 2560x1920 in my Windows VM, which is
7
- // running at 2560x1080. (SDL 2.0.3)
8
+ static SDL_DisplayMode display_mode(Gosu::Window* window)
9
+ {
10
+ static struct VideoSubsystem {
11
+ VideoSubsystem() { SDL_InitSubSystem(SDL_INIT_VIDEO); };
12
+ ~VideoSubsystem() { SDL_QuitSubSystem(SDL_INIT_VIDEO); };
13
+ } subsystem;
14
+
15
+ int index = window ? SDL_GetWindowDisplayIndex(Gosu::shared_window()) : 0;
16
+ SDL_DisplayMode result;
17
+ SDL_GetDesktopDisplayMode(index, &result);
18
+ return result;
19
+ }
8
20
 
9
- unsigned Gosu::screen_width()
21
+ unsigned Gosu::screen_width(Window* window)
10
22
  {
11
- return GetSystemMetrics(SM_CXSCREEN);
23
+ return display_mode(window).w;
12
24
  }
13
25
 
14
- unsigned Gosu::screen_height()
26
+ unsigned Gosu::screen_height(Window* window)
15
27
  {
16
- return GetSystemMetrics(SM_CYSCREEN);
28
+ return display_mode(window).h;
17
29
  }
18
30
 
19
- static SIZE calculate_available_size()
31
+ #ifdef GOSU_IS_MAC
32
+ #import <AppKit/AppKit.h>
33
+
34
+ static NSSize max_window_size(Gosu::Window* window)
35
+ {
36
+ // Keep in sync with SDL_cocoawindow.m.
37
+ auto style = NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable;
38
+
39
+ auto index = window ? SDL_GetWindowDisplayIndex(Gosu::shared_window()) : 0;
40
+ auto screen_frame = NSScreen.screens[index].visibleFrame;
41
+ return [NSWindow contentRectForFrameRect:screen_frame styleMask:style].size;
42
+ }
43
+
44
+ unsigned Gosu::available_width(Window* window)
45
+ {
46
+ return max_window_size(window).width;
47
+ }
48
+
49
+ unsigned Gosu::available_height(Window* window)
50
+ {
51
+ return max_window_size(window).height;
52
+ }
53
+ #endif
54
+
55
+ #ifdef GOSU_IS_WIN
56
+ #include <windows.h>
57
+ #include <SDL_syswm.h>
58
+
59
+ static SIZE max_window_size(Gosu::Window* window)
20
60
  {
21
61
  RECT work_area;
22
- SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0);
62
+
63
+ if (window == nullptr) {
64
+ // Easy case: Return the work area of the primary monitor.
65
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0);
66
+ } else {
67
+ // Return the work area of the monitor the window is on.
68
+ SDL_SysWMinfo wm_info;
69
+ SDL_VERSION(&wm_info.version);
70
+ SDL_GetWindowWMInfo(Gosu::shared_window(), &wm_info);
71
+ HMONITOR monitor = MonitorFromWindow(wm_info.info.win.window, MONITOR_DEFAULTTONEAREST);
72
+
73
+ MONITORINFO monitor_info;
74
+ monitor_info.cbSize = sizeof(monitor_info);
75
+ GetMonitorInfo(monitor, &monitor_info);
76
+ work_area = monitor_info.rcWork;
77
+ }
23
78
 
24
79
  RECT window_size = work_area;
25
- // Note: This should be kept in sync with STYLE_NORMAL in SDL_windowswindow.c.
80
+ // Keep in sync with STYLE_NORMAL in SDL_windowswindow.c.
26
81
  DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
27
82
  AdjustWindowRectEx(&window_size, style, FALSE, 0);
28
83
 
84
+ // Because AdjustWindowRectEx will make our rect larger, not smaller, we need to perform some
85
+ // unintuitive math here.
29
86
  SIZE size;
30
87
  size.cx = 2 * (work_area.right - work_area.left) - (window_size.right - window_size.left);
31
88
  size.cy = 2 * (work_area.bottom - work_area.top) - (window_size.bottom - window_size.top);
32
89
  return size;
33
90
  }
34
91
 
35
- static SIZE available_size = calculate_available_size();
36
-
37
- unsigned Gosu::available_width()
38
- {
39
- return available_size.cx;
40
- }
41
-
42
- unsigned Gosu::available_height()
43
- {
44
- return available_size.cy;
45
- }
46
- #elif !defined(GOSU_IS_IPHONE)
47
- #include <SDL.h>
48
-
49
- static SDL_DisplayMode current_display_mode = { 0, 0 };
50
-
51
- unsigned Gosu::screen_width()
92
+ unsigned Gosu::available_width(Window* window)
52
93
  {
53
- // TODO - not thread-safe
54
- if (current_display_mode.w == 0) {
55
- SDL_Init(SDL_INIT_VIDEO);
56
- SDL_GetDisplayMode(0, 0, &current_display_mode);
57
- SDL_QuitSubSystem(SDL_INIT_VIDEO);
58
- }
59
- return current_display_mode.w;
94
+ return max_window_size(window).cx;
60
95
  }
61
96
 
62
- unsigned Gosu::screen_height()
97
+ unsigned Gosu::available_height(Window* window)
63
98
  {
64
- // TODO - not thread-safe
65
- if (current_display_mode.h == 0) {
66
- SDL_Init(SDL_INIT_VIDEO);
67
- SDL_GetDisplayMode(0, 0, &current_display_mode);
68
- SDL_QuitSubSystem(SDL_INIT_VIDEO);
69
- }
70
- return current_display_mode.h;
99
+ return max_window_size(window).cy;
71
100
  }
101
+ #endif
72
102
 
103
+ #ifdef GOSU_IS_X
73
104
  // Pessimistic fallback implementation for available_width / available_height.
74
-
75
- #if !defined(GOSU_IS_MAC)
76
- unsigned Gosu::available_width()
105
+ // TODO: Look at this NET_WORKAREA based implementation: https://github.com/glfw/glfw/pull/989/files
106
+ unsigned Gosu::available_width(Window* window)
77
107
  {
78
- return static_cast<unsigned>(Gosu::screen_width() * 0.9);
108
+ return static_cast<unsigned>(Gosu::screen_width(window) * 0.9);
79
109
  }
80
110
 
81
- unsigned Gosu::available_height()
111
+ unsigned Gosu::available_height(Window* window)
82
112
  {
83
- return static_cast<unsigned>(Gosu::screen_height() * 0.8);
113
+ return static_cast<unsigned>(Gosu::screen_height(window) * 0.8);
84
114
  }
85
115
  #endif
116
+
86
117
  #endif
data/src/RubyGosu.cxx CHANGED
@@ -2786,6 +2786,7 @@ SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_0(Gosu::Window &window,std::string co
2786
2786
  }
2787
2787
  SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_1(int height,VALUE options=0){
2788
2788
  std::string font_name = Gosu::default_font_name();
2789
+ unsigned font_flags = 0;
2789
2790
 
2790
2791
  if (options) {
2791
2792
  Check_Type(options, T_HASH);
@@ -2802,7 +2803,15 @@ SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_1(int height,VALUE options=0){
2802
2803
  VALUE rb_string = rb_obj_as_string(value);
2803
2804
  font_name = StringValueCStr(rb_string);
2804
2805
  }
2805
- // TODO - would be nice & trivial to support :bold => false and :italic => true here
2806
+ else if (!strcmp(key_string, "bold")) {
2807
+ if (RTEST(value)) font_flags |= Gosu::FF_BOLD;
2808
+ }
2809
+ else if (!strcmp(key_string, "italic")) {
2810
+ if (RTEST(value)) font_flags |= Gosu::FF_ITALIC;
2811
+ }
2812
+ else if (!strcmp(key_string, "underline")) {
2813
+ if (RTEST(value)) font_flags |= Gosu::FF_UNDERLINE;
2814
+ }
2806
2815
  else {
2807
2816
  static bool issued_warning = false;
2808
2817
  if (!issued_warning) {
@@ -2813,7 +2822,15 @@ SWIGINTERN Gosu::Font *new_Gosu_Font__SWIG_1(int height,VALUE options=0){
2813
2822
  }
2814
2823
  }
2815
2824
 
2816
- return new Gosu::Font(height, font_name);
2825
+ return new Gosu::Font(height, font_name, font_flags);
2826
+ }
2827
+ SWIGINTERN double Gosu_Font_markup_width(Gosu::Font *self,std::string const &markup,double scale_x=1.0){
2828
+ static bool issued_warning = false;
2829
+ if (scale_x != 1.0 && !issued_warning) {
2830
+ issued_warning = true;
2831
+ rb_warn("The second argument to Font#markup_width and Font#text_width is deprecated, multiply the result instead");
2832
+ }
2833
+ return self->markup_width(markup) * scale_x;
2817
2834
  }
2818
2835
  SWIGINTERN Gosu::Image *new_Gosu_Image(VALUE source,VALUE options=0){
2819
2836
  Gosu::Bitmap bmp;
@@ -2877,12 +2894,13 @@ SWIGINTERN Gosu::Image *Gosu_Image_subimage(Gosu::Image *self,int x,int y,int w,
2877
2894
  std::unique_ptr<Gosu::ImageData> image_data = self->data().subimage(x, y, w, h);
2878
2895
  return image_data.get() ? new Gosu::Image(std::move(image_data)) : nullptr;
2879
2896
  }
2880
- SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,int font_height,VALUE options=0){
2897
+ SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &markup,double font_height,VALUE options=0){
2881
2898
  std::string font = Gosu::default_font_name();
2882
- int width = 0;
2883
- int spacing = 0;
2899
+ int width = -1;
2900
+ double spacing = 0;
2884
2901
  Gosu::Alignment align = Gosu::AL_LEFT;
2885
- unsigned flags = 0;
2902
+ unsigned image_flags = 0;
2903
+ unsigned font_flags = 0;
2886
2904
 
2887
2905
  if (options) {
2888
2906
  Check_Type(options, T_HASH);
@@ -2898,6 +2916,15 @@ SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,int font_he
2898
2916
  if (!strcmp(key_string, "font")) {
2899
2917
  font = StringValuePtr(value);
2900
2918
  }
2919
+ else if (!strcmp(key_string, "bold")) {
2920
+ if (RTEST(value)) font_flags |= Gosu::FF_BOLD;
2921
+ }
2922
+ else if (!strcmp(key_string, "italic")) {
2923
+ if (RTEST(value)) font_flags |= Gosu::FF_ITALIC;
2924
+ }
2925
+ else if (!strcmp(key_string, "underline")) {
2926
+ if (RTEST(value)) font_flags |= Gosu::FF_UNDERLINE;
2927
+ }
2901
2928
  else if (!strcmp(key_string, "align")) {
2902
2929
  const char* cstr = Gosu::cstr_from_symbol(value);
2903
2930
 
@@ -2922,10 +2949,10 @@ SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,int font_he
2922
2949
  width = NUM2INT(value);
2923
2950
  }
2924
2951
  else if (!strcmp(key_string, "spacing")) {
2925
- spacing = NUM2INT(value);
2952
+ spacing = NUM2DBL(value);
2926
2953
  }
2927
2954
  else if (!strcmp(key_string, "retro")) {
2928
- if (RTEST(value)) flags |= Gosu::IF_RETRO;
2955
+ if (RTEST(value)) image_flags |= Gosu::IF_RETRO;
2929
2956
  }
2930
2957
  else {
2931
2958
  static bool issued_warning = false;
@@ -2937,14 +2964,9 @@ SWIGINTERN Gosu::Image *Gosu_Image_from_text(std::string const &text,int font_he
2937
2964
  }
2938
2965
  }
2939
2966
 
2940
- Gosu::Bitmap bitmap;
2941
- if (width == 0) {
2942
- bitmap = Gosu::create_text(text, font, font_height);
2943
- }
2944
- else {
2945
- bitmap = Gosu::create_text(text, font, font_height, spacing, width, align);
2946
- }
2947
- return new Gosu::Image(bitmap, flags);
2967
+ Gosu::Bitmap bitmap = Gosu::layout_markup(markup, font, font_height, spacing, width,
2968
+ align, font_flags);
2969
+ return new Gosu::Image(bitmap, image_flags);
2948
2970
  }
2949
2971
  SWIGINTERN std::vector< Gosu::Image > Gosu_Image_load_tiles__SWIG_0(VALUE source,int tile_width,int tile_height,VALUE options=0){
2950
2972
  Gosu::Bitmap bmp;
@@ -5193,63 +5215,7 @@ fail:
5193
5215
 
5194
5216
 
5195
5217
  SWIGINTERN VALUE
5196
- _wrap_Font_text_width(int argc, VALUE *argv, VALUE self) {
5197
- Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5198
- std::string *arg2 = 0 ;
5199
- double arg3 = (double) 1 ;
5200
- void *argp1 = 0 ;
5201
- int res1 = 0 ;
5202
- int res2 = SWIG_OLDOBJ ;
5203
- double val3 ;
5204
- int ecode3 = 0 ;
5205
- double result;
5206
- VALUE vresult = Qnil;
5207
-
5208
- if ((argc < 1) || (argc > 2)) {
5209
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
5210
- }
5211
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
5212
- if (!SWIG_IsOK(res1)) {
5213
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font const *","text_width", 1, self ));
5214
- }
5215
- arg1 = reinterpret_cast< Gosu::Font * >(argp1);
5216
- {
5217
- std::string *ptr = (std::string *)0;
5218
- res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
5219
- if (!SWIG_IsOK(res2)) {
5220
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","text_width", 2, argv[0] ));
5221
- }
5222
- if (!ptr) {
5223
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","text_width", 2, argv[0]));
5224
- }
5225
- arg2 = ptr;
5226
- }
5227
- if (argc > 1) {
5228
- ecode3 = SWIG_AsVal_double(argv[1], &val3);
5229
- if (!SWIG_IsOK(ecode3)) {
5230
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","text_width", 3, argv[1] ));
5231
- }
5232
- arg3 = static_cast< double >(val3);
5233
- }
5234
- {
5235
- try {
5236
- result = (double)((Gosu::Font const *)arg1)->text_width((std::string const &)*arg2,arg3);
5237
- }
5238
- catch (const std::exception& e) {
5239
- SWIG_exception(SWIG_RuntimeError, e.what());
5240
- }
5241
- }
5242
- vresult = SWIG_From_double(static_cast< double >(result));
5243
- if (SWIG_IsNewObj(res2)) delete arg2;
5244
- return vresult;
5245
- fail:
5246
- if (SWIG_IsNewObj(res2)) delete arg2;
5247
- return Qnil;
5248
- }
5249
-
5250
-
5251
- SWIGINTERN VALUE
5252
- _wrap_Font_draw(int argc, VALUE *argv, VALUE self) {
5218
+ _wrap_Font_draw_markup(int argc, VALUE *argv, VALUE self) {
5253
5219
  Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5254
5220
  std::string *arg2 = 0 ;
5255
5221
  double arg3 ;
@@ -5278,46 +5244,46 @@ _wrap_Font_draw(int argc, VALUE *argv, VALUE self) {
5278
5244
  }
5279
5245
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
5280
5246
  if (!SWIG_IsOK(res1)) {
5281
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font const *","draw", 1, self ));
5247
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font const *","draw_markup", 1, self ));
5282
5248
  }
5283
5249
  arg1 = reinterpret_cast< Gosu::Font * >(argp1);
5284
5250
  {
5285
5251
  std::string *ptr = (std::string *)0;
5286
5252
  res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
5287
5253
  if (!SWIG_IsOK(res2)) {
5288
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","draw", 2, argv[0] ));
5254
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","draw_markup", 2, argv[0] ));
5289
5255
  }
5290
5256
  if (!ptr) {
5291
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","draw", 2, argv[0]));
5257
+ SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","draw_markup", 2, argv[0]));
5292
5258
  }
5293
5259
  arg2 = ptr;
5294
5260
  }
5295
5261
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
5296
5262
  if (!SWIG_IsOK(ecode3)) {
5297
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw", 3, argv[1] ));
5263
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw_markup", 3, argv[1] ));
5298
5264
  }
5299
5265
  arg3 = static_cast< double >(val3);
5300
5266
  ecode4 = SWIG_AsVal_double(argv[2], &val4);
5301
5267
  if (!SWIG_IsOK(ecode4)) {
5302
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","draw", 4, argv[2] ));
5268
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","draw_markup", 4, argv[2] ));
5303
5269
  }
5304
5270
  arg4 = static_cast< double >(val4);
5305
5271
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
5306
5272
  if (!SWIG_IsOK(ecode5)) {
5307
- SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "Gosu::ZPos","draw", 5, argv[3] ));
5273
+ SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "Gosu::ZPos","draw_markup", 5, argv[3] ));
5308
5274
  }
5309
5275
  arg5 = static_cast< Gosu::ZPos >(val5);
5310
5276
  if (argc > 4) {
5311
5277
  ecode6 = SWIG_AsVal_double(argv[4], &val6);
5312
5278
  if (!SWIG_IsOK(ecode6)) {
5313
- SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","draw", 6, argv[4] ));
5279
+ SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","draw_markup", 6, argv[4] ));
5314
5280
  }
5315
5281
  arg6 = static_cast< double >(val6);
5316
5282
  }
5317
5283
  if (argc > 5) {
5318
5284
  ecode7 = SWIG_AsVal_double(argv[5], &val7);
5319
5285
  if (!SWIG_IsOK(ecode7)) {
5320
- SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","draw", 7, argv[5] ));
5286
+ SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","draw_markup", 7, argv[5] ));
5321
5287
  }
5322
5288
  arg7 = static_cast< double >(val7);
5323
5289
  }
@@ -5362,7 +5328,7 @@ _wrap_Font_draw(int argc, VALUE *argv, VALUE self) {
5362
5328
  }
5363
5329
  {
5364
5330
  try {
5365
- ((Gosu::Font const *)arg1)->draw((std::string const &)*arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
5331
+ ((Gosu::Font const *)arg1)->draw_markup((std::string const &)*arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
5366
5332
  }
5367
5333
  catch (const std::exception& e) {
5368
5334
  SWIG_exception(SWIG_RuntimeError, e.what());
@@ -5377,7 +5343,7 @@ fail:
5377
5343
 
5378
5344
 
5379
5345
  SWIGINTERN VALUE
5380
- _wrap_Font_draw_rel(int argc, VALUE *argv, VALUE self) {
5346
+ _wrap_Font_draw_markup_rel(int argc, VALUE *argv, VALUE self) {
5381
5347
  Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5382
5348
  std::string *arg2 = 0 ;
5383
5349
  double arg3 ;
@@ -5412,56 +5378,56 @@ _wrap_Font_draw_rel(int argc, VALUE *argv, VALUE self) {
5412
5378
  }
5413
5379
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
5414
5380
  if (!SWIG_IsOK(res1)) {
5415
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font const *","draw_rel", 1, self ));
5381
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font const *","draw_markup_rel", 1, self ));
5416
5382
  }
5417
5383
  arg1 = reinterpret_cast< Gosu::Font * >(argp1);
5418
5384
  {
5419
5385
  std::string *ptr = (std::string *)0;
5420
5386
  res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
5421
5387
  if (!SWIG_IsOK(res2)) {
5422
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","draw_rel", 2, argv[0] ));
5388
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","draw_markup_rel", 2, argv[0] ));
5423
5389
  }
5424
5390
  if (!ptr) {
5425
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","draw_rel", 2, argv[0]));
5391
+ SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","draw_markup_rel", 2, argv[0]));
5426
5392
  }
5427
5393
  arg2 = ptr;
5428
5394
  }
5429
5395
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
5430
5396
  if (!SWIG_IsOK(ecode3)) {
5431
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw_rel", 3, argv[1] ));
5397
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw_markup_rel", 3, argv[1] ));
5432
5398
  }
5433
5399
  arg3 = static_cast< double >(val3);
5434
5400
  ecode4 = SWIG_AsVal_double(argv[2], &val4);
5435
5401
  if (!SWIG_IsOK(ecode4)) {
5436
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","draw_rel", 4, argv[2] ));
5402
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","draw_markup_rel", 4, argv[2] ));
5437
5403
  }
5438
5404
  arg4 = static_cast< double >(val4);
5439
5405
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
5440
5406
  if (!SWIG_IsOK(ecode5)) {
5441
- SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "Gosu::ZPos","draw_rel", 5, argv[3] ));
5407
+ SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "Gosu::ZPos","draw_markup_rel", 5, argv[3] ));
5442
5408
  }
5443
5409
  arg5 = static_cast< Gosu::ZPos >(val5);
5444
5410
  ecode6 = SWIG_AsVal_double(argv[4], &val6);
5445
5411
  if (!SWIG_IsOK(ecode6)) {
5446
- SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","draw_rel", 6, argv[4] ));
5412
+ SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","draw_markup_rel", 6, argv[4] ));
5447
5413
  }
5448
5414
  arg6 = static_cast< double >(val6);
5449
5415
  ecode7 = SWIG_AsVal_double(argv[5], &val7);
5450
5416
  if (!SWIG_IsOK(ecode7)) {
5451
- SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","draw_rel", 7, argv[5] ));
5417
+ SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","draw_markup_rel", 7, argv[5] ));
5452
5418
  }
5453
5419
  arg7 = static_cast< double >(val7);
5454
5420
  if (argc > 6) {
5455
5421
  ecode8 = SWIG_AsVal_double(argv[6], &val8);
5456
5422
  if (!SWIG_IsOK(ecode8)) {
5457
- SWIG_exception_fail(SWIG_ArgError(ecode8), Ruby_Format_TypeError( "", "double","draw_rel", 8, argv[6] ));
5423
+ SWIG_exception_fail(SWIG_ArgError(ecode8), Ruby_Format_TypeError( "", "double","draw_markup_rel", 8, argv[6] ));
5458
5424
  }
5459
5425
  arg8 = static_cast< double >(val8);
5460
5426
  }
5461
5427
  if (argc > 7) {
5462
5428
  ecode9 = SWIG_AsVal_double(argv[7], &val9);
5463
5429
  if (!SWIG_IsOK(ecode9)) {
5464
- SWIG_exception_fail(SWIG_ArgError(ecode9), Ruby_Format_TypeError( "", "double","draw_rel", 9, argv[7] ));
5430
+ SWIG_exception_fail(SWIG_ArgError(ecode9), Ruby_Format_TypeError( "", "double","draw_markup_rel", 9, argv[7] ));
5465
5431
  }
5466
5432
  arg9 = static_cast< double >(val9);
5467
5433
  }
@@ -5506,7 +5472,7 @@ _wrap_Font_draw_rel(int argc, VALUE *argv, VALUE self) {
5506
5472
  }
5507
5473
  {
5508
5474
  try {
5509
- ((Gosu::Font const *)arg1)->draw_rel((std::string const &)*arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11);
5475
+ ((Gosu::Font const *)arg1)->draw_markup_rel((std::string const &)*arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11);
5510
5476
  }
5511
5477
  catch (const std::exception& e) {
5512
5478
  SWIG_exception(SWIG_RuntimeError, e.what());
@@ -5521,200 +5487,7 @@ fail:
5521
5487
 
5522
5488
 
5523
5489
  SWIGINTERN VALUE
5524
- _wrap_Font_draw_rot(int argc, VALUE *argv, VALUE self) {
5525
- Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5526
- std::string *arg2 = 0 ;
5527
- double arg3 ;
5528
- double arg4 ;
5529
- Gosu::ZPos arg5 ;
5530
- double arg6 ;
5531
- double arg7 = (double) 1 ;
5532
- double arg8 = (double) 1 ;
5533
- Gosu::Color arg9 = (Gosu::Color) Gosu::Color::WHITE ;
5534
- Gosu::AlphaMode arg10 = (Gosu::AlphaMode) Gosu::AM_DEFAULT ;
5535
- void *argp1 = 0 ;
5536
- int res1 = 0 ;
5537
- int res2 = SWIG_OLDOBJ ;
5538
- double val3 ;
5539
- int ecode3 = 0 ;
5540
- double val4 ;
5541
- int ecode4 = 0 ;
5542
- double val5 ;
5543
- int ecode5 = 0 ;
5544
- double val6 ;
5545
- int ecode6 = 0 ;
5546
- double val7 ;
5547
- int ecode7 = 0 ;
5548
- double val8 ;
5549
- int ecode8 = 0 ;
5550
-
5551
- if ((argc < 5) || (argc > 9)) {
5552
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
5553
- }
5554
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
5555
- if (!SWIG_IsOK(res1)) {
5556
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font const *","draw_rot", 1, self ));
5557
- }
5558
- arg1 = reinterpret_cast< Gosu::Font * >(argp1);
5559
- {
5560
- std::string *ptr = (std::string *)0;
5561
- res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
5562
- if (!SWIG_IsOK(res2)) {
5563
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","draw_rot", 2, argv[0] ));
5564
- }
5565
- if (!ptr) {
5566
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","draw_rot", 2, argv[0]));
5567
- }
5568
- arg2 = ptr;
5569
- }
5570
- ecode3 = SWIG_AsVal_double(argv[1], &val3);
5571
- if (!SWIG_IsOK(ecode3)) {
5572
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","draw_rot", 3, argv[1] ));
5573
- }
5574
- arg3 = static_cast< double >(val3);
5575
- ecode4 = SWIG_AsVal_double(argv[2], &val4);
5576
- if (!SWIG_IsOK(ecode4)) {
5577
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","draw_rot", 4, argv[2] ));
5578
- }
5579
- arg4 = static_cast< double >(val4);
5580
- ecode5 = SWIG_AsVal_double(argv[3], &val5);
5581
- if (!SWIG_IsOK(ecode5)) {
5582
- SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "Gosu::ZPos","draw_rot", 5, argv[3] ));
5583
- }
5584
- arg5 = static_cast< Gosu::ZPos >(val5);
5585
- ecode6 = SWIG_AsVal_double(argv[4], &val6);
5586
- if (!SWIG_IsOK(ecode6)) {
5587
- SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","draw_rot", 6, argv[4] ));
5588
- }
5589
- arg6 = static_cast< double >(val6);
5590
- if (argc > 5) {
5591
- ecode7 = SWIG_AsVal_double(argv[5], &val7);
5592
- if (!SWIG_IsOK(ecode7)) {
5593
- SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","draw_rot", 7, argv[5] ));
5594
- }
5595
- arg7 = static_cast< double >(val7);
5596
- }
5597
- if (argc > 6) {
5598
- ecode8 = SWIG_AsVal_double(argv[6], &val8);
5599
- if (!SWIG_IsOK(ecode8)) {
5600
- SWIG_exception_fail(SWIG_ArgError(ecode8), Ruby_Format_TypeError( "", "double","draw_rot", 8, argv[6] ));
5601
- }
5602
- arg8 = static_cast< double >(val8);
5603
- }
5604
- if (argc > 7) {
5605
- {
5606
- if (TYPE(argv[7]) == T_FIXNUM || TYPE(argv[7]) == T_BIGNUM) {
5607
- arg9 = Gosu::Color(NUM2ULONG(argv[7]));
5608
- }
5609
- else {
5610
- void* ptr;
5611
- int res = SWIG_ConvertPtr(argv[7], &ptr, SWIGTYPE_p_Gosu__Color, 0);
5612
- if (!SWIG_IsOK(res)) {
5613
- SWIG_exception_fail(SWIG_ValueError, "invalid value");
5614
- }
5615
- else if (ptr == nullptr) {
5616
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference of type Gosu::Color");
5617
- }
5618
- else {
5619
- arg9 = *reinterpret_cast<Gosu::Color*>(ptr);
5620
- }
5621
- }
5622
- }
5623
- }
5624
- if (argc > 8) {
5625
- {
5626
- const char* cstr = Gosu::cstr_from_symbol(argv[8]);
5627
-
5628
- if (!strcmp(cstr, "default")) {
5629
- arg10 = Gosu::AM_DEFAULT;
5630
- }
5631
- else if (!strcmp(cstr, "add") || !strcmp(cstr, "additive")) {
5632
- arg10 = Gosu::AM_ADD;
5633
- }
5634
- else if (!strcmp(cstr, "multiply")) {
5635
- arg10 = Gosu::AM_MULTIPLY;
5636
- }
5637
- else {
5638
- SWIG_exception_fail(SWIG_ValueError, "invalid alpha mode (expected one of :default, :add, "
5639
- ":multiply)");
5640
- }
5641
- }
5642
- }
5643
- {
5644
- try {
5645
- ((Gosu::Font const *)arg1)->draw_rot((std::string const &)*arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
5646
- }
5647
- catch (const std::exception& e) {
5648
- SWIG_exception(SWIG_RuntimeError, e.what());
5649
- }
5650
- }
5651
- if (SWIG_IsNewObj(res2)) delete arg2;
5652
- return Qnil;
5653
- fail:
5654
- if (SWIG_IsNewObj(res2)) delete arg2;
5655
- return Qnil;
5656
- }
5657
-
5658
-
5659
- SWIGINTERN VALUE
5660
- _wrap_Font_set_image__SWIG_0(int argc, VALUE *argv, VALUE self) {
5661
- Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5662
- std::string arg2 ;
5663
- unsigned int arg3 ;
5664
- Gosu::Image *arg4 = 0 ;
5665
- void *argp1 = 0 ;
5666
- int res1 = 0 ;
5667
- unsigned int val3 ;
5668
- int ecode3 = 0 ;
5669
- void *argp4 ;
5670
- int res4 = 0 ;
5671
-
5672
- if ((argc < 3) || (argc > 3)) {
5673
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
5674
- }
5675
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
5676
- if (!SWIG_IsOK(res1)) {
5677
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font *","set_image", 1, self ));
5678
- }
5679
- arg1 = reinterpret_cast< Gosu::Font * >(argp1);
5680
- {
5681
- std::string *ptr = (std::string *)0;
5682
- int res = SWIG_AsPtr_std_string(argv[0], &ptr);
5683
- if (!SWIG_IsOK(res) || !ptr) {
5684
- SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","set_image", 2, argv[0] ));
5685
- }
5686
- arg2 = *ptr;
5687
- if (SWIG_IsNewObj(res)) delete ptr;
5688
- }
5689
- ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
5690
- if (!SWIG_IsOK(ecode3)) {
5691
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","set_image", 3, argv[1] ));
5692
- }
5693
- arg3 = static_cast< unsigned int >(val3);
5694
- res4 = SWIG_ConvertPtr(argv[2], &argp4, SWIGTYPE_p_Gosu__Image, 0 );
5695
- if (!SWIG_IsOK(res4)) {
5696
- SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "Gosu::Image const &","set_image", 4, argv[2] ));
5697
- }
5698
- if (!argp4) {
5699
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Gosu::Image const &","set_image", 4, argv[2]));
5700
- }
5701
- arg4 = reinterpret_cast< Gosu::Image * >(argp4);
5702
- {
5703
- try {
5704
- (arg1)->set_image(arg2,arg3,(Gosu::Image const &)*arg4);
5705
- }
5706
- catch (const std::exception& e) {
5707
- SWIG_exception(SWIG_RuntimeError, e.what());
5708
- }
5709
- }
5710
- return Qnil;
5711
- fail:
5712
- return Qnil;
5713
- }
5714
-
5715
-
5716
- SWIGINTERN VALUE
5717
- _wrap_Font_set_image__SWIG_1(int argc, VALUE *argv, VALUE self) {
5490
+ _wrap_Font_set_image(int argc, VALUE *argv, VALUE self) {
5718
5491
  Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5719
5492
  std::string arg2 ;
5720
5493
  Gosu::Image *arg3 = 0 ;
@@ -5762,69 +5535,6 @@ fail:
5762
5535
  }
5763
5536
 
5764
5537
 
5765
- SWIGINTERN VALUE _wrap_Font_set_image(int nargs, VALUE *args, VALUE self) {
5766
- int argc;
5767
- VALUE argv[5];
5768
- int ii;
5769
-
5770
- argc = nargs + 1;
5771
- argv[0] = self;
5772
- if (argc > 5) SWIG_fail;
5773
- for (ii = 1; (ii < argc); ++ii) {
5774
- argv[ii] = args[ii-1];
5775
- }
5776
- if (argc == 3) {
5777
- int _v;
5778
- void *vptr = 0;
5779
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Font, 0);
5780
- _v = SWIG_CheckState(res);
5781
- if (_v) {
5782
- int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
5783
- _v = SWIG_CheckState(res);
5784
- if (_v) {
5785
- void *vptr = 0;
5786
- int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Gosu__Image, 0);
5787
- _v = SWIG_CheckState(res);
5788
- if (_v) {
5789
- return _wrap_Font_set_image__SWIG_1(nargs, args, self);
5790
- }
5791
- }
5792
- }
5793
- }
5794
- if (argc == 4) {
5795
- int _v;
5796
- void *vptr = 0;
5797
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Font, 0);
5798
- _v = SWIG_CheckState(res);
5799
- if (_v) {
5800
- int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
5801
- _v = SWIG_CheckState(res);
5802
- if (_v) {
5803
- {
5804
- int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
5805
- _v = SWIG_CheckState(res);
5806
- }
5807
- if (_v) {
5808
- void *vptr = 0;
5809
- int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_Gosu__Image, 0);
5810
- _v = SWIG_CheckState(res);
5811
- if (_v) {
5812
- return _wrap_Font_set_image__SWIG_0(nargs, args, self);
5813
- }
5814
- }
5815
- }
5816
- }
5817
- }
5818
-
5819
- fail:
5820
- Ruby_Format_OverloadedError( argc, 5, "Font.set_image",
5821
- " void Font.set_image(std::string codepoint, unsigned int font_flags, Gosu::Image const &image)\n"
5822
- " void Font.set_image(std::string codepoint, Gosu::Image const &image)\n");
5823
-
5824
- return Qnil;
5825
- }
5826
-
5827
-
5828
5538
  SWIGINTERN VALUE
5829
5539
  _wrap_new_Font__SWIG_0(int argc, VALUE *argv, VALUE self) {
5830
5540
  Gosu::Window *arg1 = 0 ;
@@ -5960,31 +5670,87 @@ SWIGINTERN VALUE _wrap_new_Font(int nargs, VALUE *args, VALUE self) {
5960
5670
  }
5961
5671
  }
5962
5672
  }
5963
- if (argc == 3) {
5964
- int _v;
5965
- void *vptr = 0;
5966
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Window, 0);
5967
- _v = SWIG_CheckState(res);
5968
- if (_v) {
5969
- int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
5970
- _v = SWIG_CheckState(res);
5971
- if (_v) {
5972
- {
5973
- int res = SWIG_AsVal_int(argv[2], NULL);
5974
- _v = SWIG_CheckState(res);
5975
- }
5976
- if (_v) {
5977
- return _wrap_new_Font__SWIG_0(nargs, args, self);
5978
- }
5979
- }
5673
+ if (argc == 3) {
5674
+ int _v;
5675
+ void *vptr = 0;
5676
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Gosu__Window, 0);
5677
+ _v = SWIG_CheckState(res);
5678
+ if (_v) {
5679
+ int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
5680
+ _v = SWIG_CheckState(res);
5681
+ if (_v) {
5682
+ {
5683
+ int res = SWIG_AsVal_int(argv[2], NULL);
5684
+ _v = SWIG_CheckState(res);
5685
+ }
5686
+ if (_v) {
5687
+ return _wrap_new_Font__SWIG_0(nargs, args, self);
5688
+ }
5689
+ }
5690
+ }
5691
+ }
5692
+
5693
+ fail:
5694
+ Ruby_Format_OverloadedError( argc, 3, "Font.new",
5695
+ " Font.new(Gosu::Window &window, std::string const &font_name, int height)\n"
5696
+ " Font.new(int height, VALUE options)\n");
5697
+
5698
+ return Qnil;
5699
+ }
5700
+
5701
+
5702
+ SWIGINTERN VALUE
5703
+ _wrap_Font_markup_width(int argc, VALUE *argv, VALUE self) {
5704
+ Gosu::Font *arg1 = (Gosu::Font *) 0 ;
5705
+ std::string *arg2 = 0 ;
5706
+ double arg3 = (double) 1.0 ;
5707
+ void *argp1 = 0 ;
5708
+ int res1 = 0 ;
5709
+ int res2 = SWIG_OLDOBJ ;
5710
+ double val3 ;
5711
+ int ecode3 = 0 ;
5712
+ double result;
5713
+ VALUE vresult = Qnil;
5714
+
5715
+ if ((argc < 1) || (argc > 2)) {
5716
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
5717
+ }
5718
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Font, 0 | 0 );
5719
+ if (!SWIG_IsOK(res1)) {
5720
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Font *","markup_width", 1, self ));
5721
+ }
5722
+ arg1 = reinterpret_cast< Gosu::Font * >(argp1);
5723
+ {
5724
+ std::string *ptr = (std::string *)0;
5725
+ res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
5726
+ if (!SWIG_IsOK(res2)) {
5727
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","markup_width", 2, argv[0] ));
5728
+ }
5729
+ if (!ptr) {
5730
+ SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","markup_width", 2, argv[0]));
5731
+ }
5732
+ arg2 = ptr;
5733
+ }
5734
+ if (argc > 1) {
5735
+ ecode3 = SWIG_AsVal_double(argv[1], &val3);
5736
+ if (!SWIG_IsOK(ecode3)) {
5737
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","markup_width", 3, argv[1] ));
5738
+ }
5739
+ arg3 = static_cast< double >(val3);
5740
+ }
5741
+ {
5742
+ try {
5743
+ result = (double)Gosu_Font_markup_width(arg1,(std::string const &)*arg2,arg3);
5744
+ }
5745
+ catch (const std::exception& e) {
5746
+ SWIG_exception(SWIG_RuntimeError, e.what());
5980
5747
  }
5981
5748
  }
5982
-
5749
+ vresult = SWIG_From_double(static_cast< double >(result));
5750
+ if (SWIG_IsNewObj(res2)) delete arg2;
5751
+ return vresult;
5983
5752
  fail:
5984
- Ruby_Format_OverloadedError( argc, 3, "Font.new",
5985
- " Font.new(Gosu::Window &window, std::string const &font_name, int height)\n"
5986
- " Font.new(int height, VALUE options)\n");
5987
-
5753
+ if (SWIG_IsNewObj(res2)) delete arg2;
5988
5754
  return Qnil;
5989
5755
  }
5990
5756
 
@@ -7129,10 +6895,10 @@ fail:
7129
6895
  SWIGINTERN VALUE
7130
6896
  _wrap_Image_from_text(int argc, VALUE *argv, VALUE self) {
7131
6897
  std::string *arg1 = 0 ;
7132
- int arg2 ;
6898
+ double arg2 ;
7133
6899
  VALUE arg3 = (VALUE) 0 ;
7134
6900
  int res1 = SWIG_OLDOBJ ;
7135
- int val2 ;
6901
+ double val2 ;
7136
6902
  int ecode2 = 0 ;
7137
6903
  Gosu::Image *result = 0 ;
7138
6904
  VALUE vresult = Qnil;
@@ -7151,11 +6917,11 @@ _wrap_Image_from_text(int argc, VALUE *argv, VALUE self) {
7151
6917
  }
7152
6918
  arg1 = ptr;
7153
6919
  }
7154
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
6920
+ ecode2 = SWIG_AsVal_double(argv[1], &val2);
7155
6921
  if (!SWIG_IsOK(ecode2)) {
7156
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Gosu_Image_from_text", 2, argv[1] ));
6922
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Gosu_Image_from_text", 2, argv[1] ));
7157
6923
  }
7158
- arg2 = static_cast< int >(val2);
6924
+ arg2 = static_cast< double >(val2);
7159
6925
  if (argc > 2) {
7160
6926
  arg3 = argv[2];
7161
6927
  }
@@ -8881,98 +8647,6 @@ fail:
8881
8647
  }
8882
8648
 
8883
8649
 
8884
- SWIGINTERN VALUE
8885
- _wrap_screen_width(int argc, VALUE *argv, VALUE self) {
8886
- unsigned int result;
8887
- VALUE vresult = Qnil;
8888
-
8889
- if ((argc < 0) || (argc > 0)) {
8890
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8891
- }
8892
- {
8893
- try {
8894
- result = (unsigned int)Gosu::screen_width();
8895
- }
8896
- catch (const std::exception& e) {
8897
- SWIG_exception(SWIG_RuntimeError, e.what());
8898
- }
8899
- }
8900
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
8901
- return vresult;
8902
- fail:
8903
- return Qnil;
8904
- }
8905
-
8906
-
8907
- SWIGINTERN VALUE
8908
- _wrap_screen_height(int argc, VALUE *argv, VALUE self) {
8909
- unsigned int result;
8910
- VALUE vresult = Qnil;
8911
-
8912
- if ((argc < 0) || (argc > 0)) {
8913
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8914
- }
8915
- {
8916
- try {
8917
- result = (unsigned int)Gosu::screen_height();
8918
- }
8919
- catch (const std::exception& e) {
8920
- SWIG_exception(SWIG_RuntimeError, e.what());
8921
- }
8922
- }
8923
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
8924
- return vresult;
8925
- fail:
8926
- return Qnil;
8927
- }
8928
-
8929
-
8930
- SWIGINTERN VALUE
8931
- _wrap_available_width(int argc, VALUE *argv, VALUE self) {
8932
- unsigned int result;
8933
- VALUE vresult = Qnil;
8934
-
8935
- if ((argc < 0) || (argc > 0)) {
8936
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8937
- }
8938
- {
8939
- try {
8940
- result = (unsigned int)Gosu::available_width();
8941
- }
8942
- catch (const std::exception& e) {
8943
- SWIG_exception(SWIG_RuntimeError, e.what());
8944
- }
8945
- }
8946
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
8947
- return vresult;
8948
- fail:
8949
- return Qnil;
8950
- }
8951
-
8952
-
8953
- SWIGINTERN VALUE
8954
- _wrap_available_height(int argc, VALUE *argv, VALUE self) {
8955
- unsigned int result;
8956
- VALUE vresult = Qnil;
8957
-
8958
- if ((argc < 0) || (argc > 0)) {
8959
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
8960
- }
8961
- {
8962
- try {
8963
- result = (unsigned int)Gosu::available_height();
8964
- }
8965
- catch (const std::exception& e) {
8966
- SWIG_exception(SWIG_RuntimeError, e.what());
8967
- }
8968
- }
8969
- vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
8970
- return vresult;
8971
- fail:
8972
- return Qnil;
8973
- }
8974
-
8975
-
8976
8650
  static swig_class SwigClassWindow;
8977
8651
 
8978
8652
  SWIGINTERN VALUE
@@ -10235,6 +9909,138 @@ fail:
10235
9909
  }
10236
9910
 
10237
9911
 
9912
+ SWIGINTERN VALUE
9913
+ _wrap_screen_width(int argc, VALUE *argv, VALUE self) {
9914
+ Gosu::Window *arg1 = (Gosu::Window *) nullptr ;
9915
+ void *argp1 = 0 ;
9916
+ int res1 = 0 ;
9917
+ unsigned int result;
9918
+ VALUE vresult = Qnil;
9919
+
9920
+ if ((argc < 0) || (argc > 1)) {
9921
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
9922
+ }
9923
+ if (argc > 0) {
9924
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
9925
+ if (!SWIG_IsOK(res1)) {
9926
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","Gosu::screen_width", 1, argv[0] ));
9927
+ }
9928
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
9929
+ }
9930
+ {
9931
+ try {
9932
+ result = (unsigned int)Gosu::screen_width(arg1);
9933
+ }
9934
+ catch (const std::exception& e) {
9935
+ SWIG_exception(SWIG_RuntimeError, e.what());
9936
+ }
9937
+ }
9938
+ vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
9939
+ return vresult;
9940
+ fail:
9941
+ return Qnil;
9942
+ }
9943
+
9944
+
9945
+ SWIGINTERN VALUE
9946
+ _wrap_screen_height(int argc, VALUE *argv, VALUE self) {
9947
+ Gosu::Window *arg1 = (Gosu::Window *) nullptr ;
9948
+ void *argp1 = 0 ;
9949
+ int res1 = 0 ;
9950
+ unsigned int result;
9951
+ VALUE vresult = Qnil;
9952
+
9953
+ if ((argc < 0) || (argc > 1)) {
9954
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
9955
+ }
9956
+ if (argc > 0) {
9957
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
9958
+ if (!SWIG_IsOK(res1)) {
9959
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","Gosu::screen_height", 1, argv[0] ));
9960
+ }
9961
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
9962
+ }
9963
+ {
9964
+ try {
9965
+ result = (unsigned int)Gosu::screen_height(arg1);
9966
+ }
9967
+ catch (const std::exception& e) {
9968
+ SWIG_exception(SWIG_RuntimeError, e.what());
9969
+ }
9970
+ }
9971
+ vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
9972
+ return vresult;
9973
+ fail:
9974
+ return Qnil;
9975
+ }
9976
+
9977
+
9978
+ SWIGINTERN VALUE
9979
+ _wrap_available_width(int argc, VALUE *argv, VALUE self) {
9980
+ Gosu::Window *arg1 = (Gosu::Window *) nullptr ;
9981
+ void *argp1 = 0 ;
9982
+ int res1 = 0 ;
9983
+ unsigned int result;
9984
+ VALUE vresult = Qnil;
9985
+
9986
+ if ((argc < 0) || (argc > 1)) {
9987
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
9988
+ }
9989
+ if (argc > 0) {
9990
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
9991
+ if (!SWIG_IsOK(res1)) {
9992
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","Gosu::available_width", 1, argv[0] ));
9993
+ }
9994
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
9995
+ }
9996
+ {
9997
+ try {
9998
+ result = (unsigned int)Gosu::available_width(arg1);
9999
+ }
10000
+ catch (const std::exception& e) {
10001
+ SWIG_exception(SWIG_RuntimeError, e.what());
10002
+ }
10003
+ }
10004
+ vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
10005
+ return vresult;
10006
+ fail:
10007
+ return Qnil;
10008
+ }
10009
+
10010
+
10011
+ SWIGINTERN VALUE
10012
+ _wrap_available_height(int argc, VALUE *argv, VALUE self) {
10013
+ Gosu::Window *arg1 = (Gosu::Window *) nullptr ;
10014
+ void *argp1 = 0 ;
10015
+ int res1 = 0 ;
10016
+ unsigned int result;
10017
+ VALUE vresult = Qnil;
10018
+
10019
+ if ((argc < 0) || (argc > 1)) {
10020
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
10021
+ }
10022
+ if (argc > 0) {
10023
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
10024
+ if (!SWIG_IsOK(res1)) {
10025
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Gosu::Window *","Gosu::available_height", 1, argv[0] ));
10026
+ }
10027
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
10028
+ }
10029
+ {
10030
+ try {
10031
+ result = (unsigned int)Gosu::available_height(arg1);
10032
+ }
10033
+ catch (const std::exception& e) {
10034
+ SWIG_exception(SWIG_RuntimeError, e.what());
10035
+ }
10036
+ }
10037
+ vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
10038
+ return vresult;
10039
+ fail:
10040
+ return Qnil;
10041
+ }
10042
+
10043
+
10238
10044
  SWIGINTERN VALUE
10239
10045
  _wrap_char_to_button_id(int argc, VALUE *argv, VALUE self) {
10240
10046
  std::string arg1 ;
@@ -11864,8 +11670,8 @@ SWIGEXPORT void Init_gosu(void) {
11864
11670
  rb_define_const(mGosu, "VERSION", SWIG_From_std_string(static_cast< std::string >(Gosu::VERSION)));
11865
11671
  rb_define_const(mGosu, "LICENSES", SWIG_From_std_string(static_cast< std::string >(Gosu::LICENSES)));
11866
11672
  rb_define_const(mGosu, "MAJOR_VERSION", SWIG_From_int(static_cast< int >(0)));
11867
- rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(13)));
11868
- rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(3)));
11673
+ rb_define_const(mGosu, "MINOR_VERSION", SWIG_From_int(static_cast< int >(14)));
11674
+ rb_define_const(mGosu, "POINT_VERSION", SWIG_From_int(static_cast< int >(0)));
11869
11675
  rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
11870
11676
  rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
11871
11677
  rb_define_module_function(mGosu, "degrees_to_radians", VALUEFUNC(_wrap_degrees_to_radians), -1);
@@ -11923,11 +11729,10 @@ SWIGEXPORT void Init_gosu(void) {
11923
11729
  rb_define_method(SwigClassFont.klass, "name", VALUEFUNC(_wrap_Font_name), -1);
11924
11730
  rb_define_method(SwigClassFont.klass, "height", VALUEFUNC(_wrap_Font_height), -1);
11925
11731
  rb_define_method(SwigClassFont.klass, "flags", VALUEFUNC(_wrap_Font_flags), -1);
11926
- rb_define_method(SwigClassFont.klass, "text_width", VALUEFUNC(_wrap_Font_text_width), -1);
11927
- rb_define_method(SwigClassFont.klass, "draw", VALUEFUNC(_wrap_Font_draw), -1);
11928
- rb_define_method(SwigClassFont.klass, "draw_rel", VALUEFUNC(_wrap_Font_draw_rel), -1);
11929
- rb_define_method(SwigClassFont.klass, "draw_rot", VALUEFUNC(_wrap_Font_draw_rot), -1);
11732
+ rb_define_method(SwigClassFont.klass, "draw_markup", VALUEFUNC(_wrap_Font_draw_markup), -1);
11733
+ rb_define_method(SwigClassFont.klass, "draw_markup_rel", VALUEFUNC(_wrap_Font_draw_markup_rel), -1);
11930
11734
  rb_define_method(SwigClassFont.klass, "set_image", VALUEFUNC(_wrap_Font_set_image), -1);
11735
+ rb_define_method(SwigClassFont.klass, "markup_width", VALUEFUNC(_wrap_Font_markup_width), -1);
11931
11736
  SwigClassFont.mark = 0;
11932
11737
  SwigClassFont.destroy = (void (*)(void *)) free_Gosu_Font;
11933
11738
  SwigClassFont.trackObjects = 1;
@@ -12252,10 +12057,6 @@ SWIGEXPORT void Init_gosu(void) {
12252
12057
  SwigClassTextInput.mark = 0;
12253
12058
  SwigClassTextInput.destroy = (void (*)(void *)) free_Gosu_TextInput;
12254
12059
  SwigClassTextInput.trackObjects = 1;
12255
- rb_define_module_function(mGosu, "screen_width", VALUEFUNC(_wrap_screen_width), -1);
12256
- rb_define_module_function(mGosu, "screen_height", VALUEFUNC(_wrap_screen_height), -1);
12257
- rb_define_module_function(mGosu, "available_width", VALUEFUNC(_wrap_available_width), -1);
12258
- rb_define_module_function(mGosu, "available_height", VALUEFUNC(_wrap_available_height), -1);
12259
12060
  rb_define_module_function(mGosu, "disown_Window", VALUEFUNC(_wrap_disown_Window), -1);
12260
12061
 
12261
12062
  SwigClassWindow.klass = rb_define_class_under(mGosu, "Window", rb_cObject);
@@ -12295,6 +12096,10 @@ SWIGEXPORT void Init_gosu(void) {
12295
12096
  SwigClassWindow.mark = (void (*)(void *)) mark_window;
12296
12097
  SwigClassWindow.destroy = (void (*)(void *)) free_Gosu_Window;
12297
12098
  SwigClassWindow.trackObjects = 1;
12099
+ rb_define_module_function(mGosu, "screen_width", VALUEFUNC(_wrap_screen_width), -1);
12100
+ rb_define_module_function(mGosu, "screen_height", VALUEFUNC(_wrap_screen_height), -1);
12101
+ rb_define_module_function(mGosu, "available_width", VALUEFUNC(_wrap_available_width), -1);
12102
+ rb_define_module_function(mGosu, "available_height", VALUEFUNC(_wrap_available_height), -1);
12298
12103
  rb_define_module_function(mGosu, "char_to_button_id", VALUEFUNC(_wrap_char_to_button_id), -1);
12299
12104
  rb_define_module_function(mGosu, "button_id_to_char", VALUEFUNC(_wrap_button_id_to_char), -1);
12300
12105
  rb_define_module_function(mGosu, "button_down?", VALUEFUNC(_wrap_button_downq___), -1);