gosu 0.7.11 → 0.7.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/Gosu/Audio.hpp +33 -16
  2. data/Gosu/GraphicsBase.hpp +6 -1
  3. data/Gosu/Input.hpp +8 -2
  4. data/Gosu/Platform.hpp +63 -61
  5. data/Gosu/Window.hpp +11 -0
  6. data/GosuImpl/AudioFmod.cpp +89 -16
  7. data/GosuImpl/AudioSDL.cpp +59 -19
  8. data/GosuImpl/Graphics/BitmapUtils.cpp +3 -0
  9. data/GosuImpl/Graphics/Common.hpp +8 -3
  10. data/GosuImpl/Graphics/DrawOp.hpp +70 -7
  11. data/GosuImpl/Graphics/Graphics.cpp +34 -2
  12. data/GosuImpl/Graphics/TexChunk.cpp +7 -1
  13. data/GosuImpl/Graphics/Texture.cpp +31 -9
  14. data/GosuImpl/Iconv.hpp +3 -0
  15. data/GosuImpl/InputMac.mm +31 -10
  16. data/GosuImpl/InputWin.cpp +8 -0
  17. data/GosuImpl/InputX.cpp +64 -45
  18. data/GosuImpl/Math.cpp +1 -1
  19. data/GosuImpl/RubyGosu.swg +27 -7
  20. data/GosuImpl/RubyGosu_wrap.cxx +338 -205
  21. data/GosuImpl/Utility.cpp +1 -0
  22. data/GosuImpl/WindowMac.mm +29 -3
  23. data/GosuImpl/WindowWin.cpp +16 -5
  24. data/GosuImpl/WindowX.cpp +3 -3
  25. data/README.txt +7 -3
  26. data/Rakefile +2 -1
  27. data/mac/Gosu.icns +0 -0
  28. data/mac/Gosu.xcodeproj/jlnr.mode1v3 +74 -75
  29. data/mac/Gosu.xcodeproj/jlnr.pbxuser +731 -257
  30. data/mac/Gosu.xcodeproj/jlnr.perspectivev3 +1531 -0
  31. data/reference/Async_8hpp-source.html +1 -1
  32. data/reference/Audio_8hpp-source.html +68 -58
  33. data/reference/Audio_8hpp.html +1 -1
  34. data/reference/AutoLink_8hpp-source.html +1 -1
  35. data/reference/AutoLink_8hpp.html +1 -1
  36. data/reference/Bitmap_8hpp-source.html +1 -1
  37. data/reference/Bitmap_8hpp.html +1 -1
  38. data/reference/ButtonsMac_8hpp-source.html +1 -1
  39. data/reference/ButtonsWin_8hpp-source.html +1 -1
  40. data/reference/ButtonsX_8hpp-source.html +1 -1
  41. data/reference/Color_8hpp-source.html +1 -1
  42. data/reference/Color_8hpp.html +1 -1
  43. data/reference/Directories_8hpp-source.html +1 -1
  44. data/reference/Directories_8hpp.html +1 -1
  45. data/reference/Font_8hpp-source.html +1 -1
  46. data/reference/Font_8hpp.html +1 -1
  47. data/reference/Fwd_8hpp-source.html +1 -1
  48. data/reference/Fwd_8hpp.html +1 -1
  49. data/reference/Gosu_8hpp-source.html +1 -1
  50. data/reference/Gosu_8hpp.html +1 -1
  51. data/reference/GraphicsBase_8hpp-source.html +28 -26
  52. data/reference/GraphicsBase_8hpp.html +4 -1
  53. data/reference/Graphics_8hpp-source.html +1 -1
  54. data/reference/Graphics_8hpp.html +1 -1
  55. data/reference/IO_8hpp-source.html +1 -1
  56. data/reference/IO_8hpp.html +1 -1
  57. data/reference/ImageData_8hpp-source.html +1 -1
  58. data/reference/ImageData_8hpp.html +1 -1
  59. data/reference/Image_8hpp-source.html +1 -1
  60. data/reference/Image_8hpp.html +1 -1
  61. data/reference/Input_8hpp-source.html +19 -16
  62. data/reference/Input_8hpp.html +1 -1
  63. data/reference/Math_8hpp-source.html +1 -1
  64. data/reference/Math_8hpp.html +1 -1
  65. data/reference/Platform_8hpp-source.html +22 -20
  66. data/reference/Platform_8hpp.html +1 -1
  67. data/reference/RotFlip_8hpp-source.html +1 -1
  68. data/reference/RotFlip_8hpp.html +1 -1
  69. data/reference/Sockets_8hpp-source.html +1 -1
  70. data/reference/Sockets_8hpp.html +1 -1
  71. data/reference/TextInput_8hpp-source.html +1 -1
  72. data/reference/TextInput_8hpp.html +1 -1
  73. data/reference/Text_8hpp-source.html +1 -1
  74. data/reference/Text_8hpp.html +1 -1
  75. data/reference/Timing_8hpp-source.html +1 -1
  76. data/reference/Timing_8hpp.html +1 -1
  77. data/reference/Utility_8hpp-source.html +1 -1
  78. data/reference/Utility_8hpp.html +1 -1
  79. data/reference/WinUtility_8hpp-source.html +1 -1
  80. data/reference/WinUtility_8hpp.html +1 -1
  81. data/reference/Window_8hpp-source.html +67 -56
  82. data/reference/Window_8hpp.html +1 -1
  83. data/reference/annotated.html +1 -1
  84. data/reference/classGosu_1_1Audio-members.html +1 -1
  85. data/reference/classGosu_1_1Audio.html +1 -1
  86. data/reference/classGosu_1_1Bitmap-members.html +1 -1
  87. data/reference/classGosu_1_1Bitmap.html +1 -1
  88. data/reference/classGosu_1_1Buffer-members.html +1 -1
  89. data/reference/classGosu_1_1Buffer.html +1 -1
  90. data/reference/classGosu_1_1Button-members.html +1 -1
  91. data/reference/classGosu_1_1Button.html +1 -1
  92. data/reference/classGosu_1_1Color-members.html +1 -1
  93. data/reference/classGosu_1_1Color.html +1 -1
  94. data/reference/classGosu_1_1File-members.html +1 -1
  95. data/reference/classGosu_1_1File.html +1 -1
  96. data/reference/classGosu_1_1Font-members.html +1 -1
  97. data/reference/classGosu_1_1Font.html +1 -1
  98. data/reference/classGosu_1_1Graphics-members.html +1 -1
  99. data/reference/classGosu_1_1Graphics.html +1 -1
  100. data/reference/classGosu_1_1Image-members.html +1 -1
  101. data/reference/classGosu_1_1Image.html +1 -1
  102. data/reference/classGosu_1_1ImageData-members.html +1 -1
  103. data/reference/classGosu_1_1ImageData.html +1 -1
  104. data/reference/classGosu_1_1Input-members.html +2 -1
  105. data/reference/classGosu_1_1Input.html +34 -1
  106. data/reference/classGosu_1_1MessageSocket-members.html +1 -1
  107. data/reference/classGosu_1_1MessageSocket.html +1 -1
  108. data/reference/classGosu_1_1Resource-members.html +1 -1
  109. data/reference/classGosu_1_1Resource.html +1 -1
  110. data/reference/classGosu_1_1Sample-members.html +3 -3
  111. data/reference/classGosu_1_1Sample.html +23 -11
  112. data/reference/classGosu_1_1SampleInstance-members.html +4 -1
  113. data/reference/classGosu_1_1SampleInstance.html +11 -2
  114. data/reference/classGosu_1_1Song-members.html +5 -2
  115. data/reference/classGosu_1_1Song.html +78 -7
  116. data/reference/classGosu_1_1TextInput-members.html +1 -1
  117. data/reference/classGosu_1_1TextInput.html +1 -1
  118. data/reference/classGosu_1_1Window-members.html +1 -1
  119. data/reference/classGosu_1_1Window.html +1 -1
  120. data/reference/files.html +1 -1
  121. data/reference/functions.html +14 -6
  122. data/reference/functions_enum.html +1 -1
  123. data/reference/functions_func.html +14 -6
  124. data/reference/functions_vars.html +1 -1
  125. data/reference/hierarchy.html +1 -1
  126. data/reference/index.html +1 -1
  127. data/reference/namespaceGosu.html +20 -1
  128. data/reference/namespaceGosu_1_1Colors.html +1 -1
  129. data/reference/namespaceGosu_1_1Win.html +1 -1
  130. data/reference/namespacemembers.html +3 -1
  131. data/reference/namespacemembers_enum.html +1 -1
  132. data/reference/namespacemembers_eval.html +1 -1
  133. data/reference/namespacemembers_func.html +1 -1
  134. data/reference/namespacemembers_type.html +1 -1
  135. data/reference/namespacemembers_vars.html +3 -1
  136. data/reference/namespaces.html +1 -1
  137. data/windows/Gosu.sln +2 -2
  138. data/windows/Gosu.vcproj +8 -7
  139. data/windows/RubyGosu.vcproj +5 -5
  140. metadata +4 -3
  141. data/GosuImpl/Utility.cpp~RF6c566.TMP +0 -95
@@ -1,6 +1,8 @@
1
1
  #ifndef GOSIMPL_ICONV_HPP
2
2
  #define GOSIMPL_ICONV_HPP
3
3
 
4
+ #include <Gosu/Platform.hpp>
5
+
4
6
  #ifdef __APPLE__
5
7
  // We want Apple's iconv
6
8
  #include </usr/include/iconv.h>
@@ -58,5 +60,6 @@ namespace Gosu
58
60
  }
59
61
  }
60
62
 
63
+
61
64
  #endif
62
65
 
@@ -517,6 +517,20 @@ struct Gosu::Input::Impl
517
517
 
518
518
  currentMods = newMods;
519
519
  }
520
+
521
+ void refreshMousePosition()
522
+ {
523
+ NSPoint mousePos = [NSEvent mouseLocation];
524
+ if (window)
525
+ {
526
+ mousePos = [window convertScreenToBase: mousePos];
527
+ mousePos.y = [[window contentView] frame].size.height - mousePos.y;
528
+ }
529
+ else
530
+ mousePos.y = CGDisplayBounds(CGMainDisplayID()).size.height - mousePos.y;
531
+ mouseX = mousePos.x;
532
+ mouseY = mousePos.y;
533
+ }
520
534
  };
521
535
 
522
536
  Gosu::Input::Input(void* window)
@@ -623,6 +637,22 @@ double Gosu::Input::mouseY() const
623
637
  return pimpl->mouseY * pimpl->mouseFactorY;
624
638
  }
625
639
 
640
+ void Gosu::Input::setMousePosition(double x, double y)
641
+ {
642
+ NSPoint mousePos = NSMakePoint(x, y);
643
+ if (pimpl->window)
644
+ {
645
+ mousePos.y = [[pimpl->window contentView] frame].size.height - mousePos.y;
646
+ mousePos = [pimpl->window convertBaseToScreen: mousePos];
647
+ mousePos.y = CGDisplayBounds(CGMainDisplayID()).size.height - mousePos.y;
648
+ }
649
+
650
+ CGSetLocalEventsSuppressionInterval(0.0);
651
+ CGWarpMouseCursorPosition(CGPointMake(mousePos.x, mousePos.y));
652
+
653
+ pimpl->refreshMousePosition();
654
+ }
655
+
626
656
  void Gosu::Input::setMouseFactors(double factorX, double factorY)
627
657
  {
628
658
  pimpl->mouseFactorX = factorX;
@@ -631,16 +661,7 @@ void Gosu::Input::setMouseFactors(double factorX, double factorY)
631
661
 
632
662
  void Gosu::Input::update()
633
663
  {
634
- NSPoint mousePos = [NSEvent mouseLocation];
635
- if (pimpl->window)
636
- {
637
- mousePos = [pimpl->window convertScreenToBase: mousePos];
638
- mousePos.y = [[pimpl->window contentView] frame].size.height - mousePos.y;
639
- }
640
- else
641
- mousePos.y = CGDisplayBounds(CGMainDisplayID()).size.height - mousePos.y;
642
- pimpl->mouseX = mousePos.x;
643
- pimpl->mouseY = mousePos.y;
664
+ pimpl->refreshMousePosition();
644
665
 
645
666
  for (unsigned i = 0; i < pimpl->queue.size(); ++i)
646
667
  {
@@ -410,6 +410,14 @@ double Gosu::Input::mouseY() const
410
410
  return pimpl->mouseY * pimpl->mouseFactorY;
411
411
  }
412
412
 
413
+ void Gosu::Input::setMousePosition(double x, double y)
414
+ {
415
+ POINT pos = { x / pimpl->mouseFactorX, y / pimpl->mouseFactorY };
416
+ ::ClientToScreen(pimpl->window, &pos);
417
+ ::SetCursorPos(pos.x, pos.y);
418
+ pimpl->updateMousePos();
419
+ }
420
+
413
421
  void Gosu::Input::setMouseFactors(double factorX, double factorY)
414
422
  {
415
423
  pimpl->mouseFactorX = factorX;
@@ -3,8 +3,8 @@
3
3
  #include <Gosu/Utility.hpp>
4
4
  #include <vector>
5
5
  #include <map>
6
-
7
- #include <GosuImpl/Iconv.hpp>
6
+
7
+ #include <GosuImpl/Iconv.hpp>
8
8
 
9
9
  struct Gosu::Input::Impl
10
10
  {
@@ -13,24 +13,28 @@ struct Gosu::Input::Impl
13
13
  std::map<unsigned int, bool> keyMap;
14
14
  double mouseX, mouseY, mouseFactorX, mouseFactorY;
15
15
  ::Display* display;
16
+ ::Window window;
16
17
  Impl() : textInput(0) {}
17
18
  };
18
19
 
19
- Gosu::Input::Input(::Display* dpy)
20
+ Gosu::Input::Input(::Display* dpy, ::Window wnd)
20
21
  : pimpl(new Impl)
21
22
  {
22
23
  // IMPR: Get current position?
23
24
  pimpl->mouseX = pimpl->mouseY = 0;
24
25
  pimpl->mouseFactorX = pimpl->mouseFactorY = 1.0;
25
26
  pimpl->display = dpy;
27
+ pimpl->window = wnd;
26
28
  }
27
29
 
28
30
  Gosu::Input::~Input()
29
31
  {
30
32
  }
31
33
 
32
- bool Gosu::Input::feedXEvent(::XEvent& event, Gosu::Window* window)
34
+ bool Gosu::Input::feedXEvent(::XEvent& event)
33
35
  {
36
+ // IMPR: Wouldn't it make more sense to filter the other way around?
37
+
34
38
  if(event.type == VisibilityNotify ||
35
39
  event.type == CirculateRequest ||
36
40
  event.type == ConfigureRequest ||
@@ -38,7 +42,7 @@ bool Gosu::Input::feedXEvent(::XEvent& event, Gosu::Window* window)
38
42
  event.type == ResizeRequest ||
39
43
  event.type == ClientMessage)
40
44
  return false;
41
-
45
+
42
46
  pimpl->eventList.push_back(event);
43
47
  return true;
44
48
  }
@@ -53,39 +57,39 @@ bool Gosu::Input::down(Gosu::Button btn) const
53
57
  }
54
58
 
55
59
  Gosu::Button Gosu::Input::charToId(wchar_t ch)
56
- {
57
- // ASCII chars
60
+ {
61
+ // ASCII chars
58
62
  if (ch >= 32 && ch <= 255)
59
- return Button(ch);
63
+ return Button(ch);
60
64
  // Other chars are conceptually not findable :(
61
65
  return noButton;
62
- }
63
-
64
- namespace
65
- {
66
- extern const char LATIN[] = "ISO8859-1";
67
- extern const char UCS_4_INTERNAL[] = "UCS-4LE";
66
+ }
67
+
68
+ namespace
69
+ {
70
+ extern const char LATIN[] = "ISO8859-1";
71
+ extern const char UCS_4_INTERNAL[] = "UCS-4LE";
68
72
  }
69
73
 
70
74
  wchar_t Gosu::Input::idToChar(Button btn)
71
- {
72
- // ASCII chars
75
+ {
76
+ // ASCII chars
73
77
  if (btn.getId() >= 32 && btn.getId() <= 255)
74
- return btn.getId();
75
-
76
- // Looking at SDL source suggests that this is to be interpreted depending on the third byte.
77
- // Should find solid literature on that if it exists.
78
- // Commented out: This is pretty pointless since LATIN-1 maps to Unicode directly...
79
- // BUT could serve as a basis for more?!
80
- //if ((btn.getId() >> 8) == 0)
81
- //{
82
- // unsigned char in[] = { btn.getId() & 0xff, 0 };
83
- // std::wstring converted = iconvert<std::wstring, UCS_4_INTERNAL, LATIN>(std::string(reinterpret_cast<char*>(in)));
84
- // return converted.at(0);
85
- //}
86
-
87
- return 0;
88
- }
78
+ return btn.getId();
79
+
80
+ // Looking at SDL source suggests that this is to be interpreted depending on the third byte.
81
+ // Should find solid literature on that if it exists.
82
+ // Commented out: This is pretty pointless since LATIN-1 maps to Unicode directly...
83
+ // BUT could serve as a basis for more?!
84
+ //if ((btn.getId() >> 8) == 0)
85
+ //{
86
+ // unsigned char in[] = { btn.getId() & 0xff, 0 };
87
+ // std::wstring converted = iconvert<std::wstring, UCS_4_INTERNAL, LATIN>(std::string(reinterpret_cast<char*>(in)));
88
+ // return converted.at(0);
89
+ //}
90
+
91
+ return 0;
92
+ }
89
93
 
90
94
  double Gosu::Input::mouseX() const
91
95
  {
@@ -120,9 +124,9 @@ void Gosu::Input::update()
120
124
  // unsigned id = (chars == 0) ? keysym : widen(buf).at(0);
121
125
 
122
126
  unsigned id = XKeycodeToKeysym(pimpl->display, event.xkey.keycode, 0);
123
-
127
+
124
128
  pimpl->keyMap[id] = true;
125
- if (onButtonDown)
129
+ if (onButtonDown)
126
130
  onButtonDown(Button(id));
127
131
  }
128
132
  else if (event.type == KeyRelease)
@@ -131,21 +135,21 @@ void Gosu::Input::update()
131
135
  // unsigned chars = XLookupString(&event.xkey, buf, sizeof buf, 0, 0);
132
136
  // unsigned keysym = XKeycodeToKeysym(pimpl->display, event.xkey.keycode, 0);
133
137
  // unsigned id = (chars == 0) ? keysym : widen(buf).at(0);
134
-
135
- if (i < pimpl->eventList.size() - 1)
136
- {
137
- ::XEvent nextEvent = pimpl->eventList[i + 1];
138
- if (nextEvent.type == KeyPress && nextEvent.xkey.keycode == event.xkey.keycode)
139
- {
140
- i += 1;
141
- continue;
138
+
139
+ if (i < pimpl->eventList.size() - 1)
140
+ {
141
+ ::XEvent nextEvent = pimpl->eventList[i + 1];
142
+ if (nextEvent.type == KeyPress && nextEvent.xkey.keycode == event.xkey.keycode)
143
+ {
144
+ i += 1;
145
+ continue;
142
146
  }
143
147
  }
144
148
 
145
- unsigned id = XKeycodeToKeysym(pimpl->display, event.xkey.keycode, 0);
146
-
149
+ unsigned id = XKeycodeToKeysym(pimpl->display, event.xkey.keycode, 0);
150
+
147
151
  pimpl->keyMap[id] = false;
148
- if (onButtonUp)
152
+ if (onButtonUp)
149
153
  onButtonUp(Button(id));
150
154
  }
151
155
  else if (event.type == ButtonPress)
@@ -183,11 +187,26 @@ void Gosu::Input::update()
183
187
  {
184
188
  pimpl->mouseX = event.xbutton.x;
185
189
  pimpl->mouseY = event.xbutton.y;
186
- }
190
+ }
191
+ else if (event.type == EnterNotify || event.type == LeaveNotify)
192
+ {
193
+ pimpl->mouseX = event.xcrossing.x;
194
+ pimpl->mouseY = event.xcrossing.y;
195
+ }
187
196
  }
188
197
  pimpl->eventList.clear();
189
198
  }
190
199
 
200
+ void Gosu::Input::setMousePosition(double x, double y)
201
+ {
202
+ ::XWarpPointer(pimpl->display, None, pimpl->window, 0, 0, 0, 0,
203
+ x / pimpl->mouseFactorX, y / pimpl->mouseFactorY);
204
+ ::XSync(pimpl->display, False);
205
+ // Couldn't find a way to fetch the current mouse position. These
206
+ // values may not be correct if the cursor was grabbed, for example.
207
+ pimpl->mouseX = x, pimpl->mouseY = y;
208
+ }
209
+
191
210
  Gosu::TextInput* Gosu::Input::textInput() const
192
211
  {
193
212
  return pimpl->textInput;
@@ -32,7 +32,7 @@ double Gosu::angle(double fromX, double fromY, double toX, double toY,
32
32
 
33
33
  double Gosu::angleDiff(double from, double to)
34
34
  {
35
- return normalizeAngle(std::fmod(to - from + 180, 360) - 180);
35
+ return std::fmod(to - from + 180, 360) - 180;
36
36
  }
37
37
 
38
38
  double Gosu::normalizeAngle(double angle)
@@ -214,6 +214,11 @@ namespace Gosu
214
214
  %ignore Gosu::sleep;
215
215
  %include "../Gosu/Timing.hpp"
216
216
  %ignore Gosu::pi;
217
+ %ignore Gosu::distanceSqr;
218
+ %ignore Gosu::round;
219
+ %ignore Gosu::trunc;
220
+ %ignore Gosu::radiansToGosu;
221
+ %ignore Gosu::gosuToRadians;
217
222
  %include "../Gosu/Math.hpp"
218
223
  %ignore Gosu::textWidth;
219
224
  %ignore Gosu::createText;
@@ -225,6 +230,10 @@ namespace Gosu
225
230
  // Graphics:
226
231
 
227
232
  // ZPos, AlphaMode, FontFlags, TextAlign
233
+ %ignore Gosu::zImmediate;
234
+ %ignore Gosu::AlphaMode;
235
+ %ignore Gosu::FontFlags;
236
+ %ignore Gosu::TextAlign;
228
237
  %include "../Gosu/GraphicsBase.hpp"
229
238
 
230
239
  // Color
@@ -352,11 +361,13 @@ namespace Gosu
352
361
  // Audio:
353
362
 
354
363
  %ignore Gosu::Audio;
364
+ %Ignore Gosu::SongType;
355
365
  %ignore Gosu::Sample::Sample(Audio& audio, const std::wstring& filename);
356
366
  %ignore Gosu::Sample::Sample(Audio& audio, Reader reader);
357
367
  %ignore Gosu::Song::Song(Audio& audio, const std::wstring& filename);
358
368
  %ignore Gosu::Song::Song(Audio& audio, Type type, Reader reader);
359
369
  %rename("playing?") playing;
370
+ %rename("paused?") paused;
360
371
  %rename("volume=") changeVolume;
361
372
  %rename("pan=") changePan;
362
373
  %rename("speed=") changeSpeed;
@@ -379,18 +390,15 @@ namespace Gosu
379
390
  // Does not matter that it's the Mac file, %include only analyses symbols to export, not their values.
380
391
  %include "../Gosu/ButtonsMac.hpp"
381
392
  %init %{
382
- // Backwards compatibility: import the constants into Gosu::Button.
393
+ // Backwards compatibility: import the constants into Gosu::Button.
383
394
  rb_eval_string("module Gosu::Button; Gosu.constants.each { |c| const_set(c, Gosu.const_get(c)) }; end");
384
395
 
385
396
  // ARGH, SWIG workaround...
386
397
  rb_eval_string("class Gosu::Image; def self.from_text(*args); args.size == 4 ? from_text_4(*args) : from_text_7(*args); end; end");
387
-
388
- // Extend Numeric with simple angle conversion methods.
389
- rb_eval_string("class Numeric;"
390
- " def gosu_to_radians; (self - 90) * Math::PI / 180.0; end;"
391
- " def radians_to_gosu; self * 180.0 / Math::PI + 90; end;"
392
- "end");
393
398
 
399
+ // Extend Numeric with simple angle conversion methods.
400
+ rb_eval_string("class ::Numeric;def gosu_to_radians;(self-90)*Math::PI/180.0;end;def radians_to_gosu;self*180.0/Math::PI+90;end;end");
401
+
394
402
  GosusDarkSide::oncePerTick = GosusDarkSide::yieldToOtherRubyThreads;
395
403
  %}
396
404
 
@@ -416,6 +424,8 @@ namespace Gosu
416
424
  %rename("caption=") setCaption;
417
425
  %rename("button_down?") isButtonDown;
418
426
  %rename("text_input=") setTextInput;
427
+ %rename("mouse_x=") setMouseX;
428
+ %rename("mouse_y=") setMouseY;
419
429
  %markfunc Gosu::Window "markWindow";
420
430
  %include "../Gosu/Window.hpp"
421
431
 
@@ -474,6 +484,16 @@ namespace Gosu
474
484
  double mouseY() const {
475
485
  return $self->input().mouseY();
476
486
  }
487
+ void setMousePosition(double x, double y) {
488
+ $self->input().setMousePosition(x, y);
489
+ }
490
+ void setMouseX(double x) {
491
+ $self->input().setMousePosition(x, $self->input().mouseY());
492
+ }
493
+ void setMouseY(double y) {
494
+ $self->input().setMousePosition($self->input().mouseX(), y);
495
+ }
496
+
477
497
  int width() const {
478
498
  return $self->graphics().width();
479
499
  }
@@ -2119,13 +2119,6 @@ SWIG_AsVal_double (VALUE obj, double *val)
2119
2119
  #define SWIG_From_double rb_float_new
2120
2120
 
2121
2121
 
2122
- SWIGINTERNINLINE VALUE
2123
- SWIG_From_int (int value)
2124
- {
2125
- return SWIG_From_long (value);
2126
- }
2127
-
2128
-
2129
2122
  #include <string>
2130
2123
 
2131
2124
 
@@ -2301,6 +2294,13 @@ SWIGINTERN Gosu::Font *new_Gosu_Font(Gosu::Window &window,std::wstring const &fo
2301
2294
  return new Gosu::Font(window.graphics(), fontName, height);
2302
2295
  }
2303
2296
 
2297
+ SWIGINTERNINLINE VALUE
2298
+ SWIG_From_int (int value)
2299
+ {
2300
+ return SWIG_From_long (value);
2301
+ }
2302
+
2303
+
2304
2304
  SWIGINTERN int
2305
2305
  SWIG_AsVal_bool (VALUE obj, bool *val)
2306
2306
  {
@@ -2474,6 +2474,15 @@ SWIGINTERN double Gosu_Window_mouseX(Gosu::Window const *self){
2474
2474
  SWIGINTERN double Gosu_Window_mouseY(Gosu::Window const *self){
2475
2475
  return self->input().mouseY();
2476
2476
  }
2477
+ SWIGINTERN void Gosu_Window_setMousePosition(Gosu::Window *self,double x,double y){
2478
+ self->input().setMousePosition(x, y);
2479
+ }
2480
+ SWIGINTERN void Gosu_Window_setMouseX(Gosu::Window *self,double x){
2481
+ self->input().setMousePosition(x, self->input().mouseY());
2482
+ }
2483
+ SWIGINTERN void Gosu_Window_setMouseY(Gosu::Window *self,double y){
2484
+ self->input().setMousePosition(self->input().mouseX(), y);
2485
+ }
2477
2486
  SWIGINTERN int Gosu_Window_width(Gosu::Window const *self){
2478
2487
  return self->graphics().width();
2479
2488
  }
@@ -2580,66 +2589,6 @@ fail:
2580
2589
  }
2581
2590
 
2582
2591
 
2583
- SWIGINTERN VALUE
2584
- _wrap_trunc(int argc, VALUE *argv, VALUE self) {
2585
- double arg1 ;
2586
- long result;
2587
- double val1 ;
2588
- int ecode1 = 0 ;
2589
- VALUE vresult = Qnil;
2590
-
2591
- if ((argc < 1) || (argc > 1)) {
2592
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2593
- }
2594
- ecode1 = SWIG_AsVal_double(argv[0], &val1);
2595
- if (!SWIG_IsOK(ecode1)) {
2596
- SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Gosu::trunc" "', argument " "1"" of type '" "double""'");
2597
- }
2598
- arg1 = static_cast< double >(val1);
2599
- {
2600
- try {
2601
- result = (long)Gosu::trunc(arg1);
2602
- } catch(const std::runtime_error& e) {
2603
- SWIG_exception(SWIG_RuntimeError, e.what());
2604
- }
2605
- }
2606
- vresult = SWIG_From_long(static_cast< long >(result));
2607
- return vresult;
2608
- fail:
2609
- return Qnil;
2610
- }
2611
-
2612
-
2613
- SWIGINTERN VALUE
2614
- _wrap_round(int argc, VALUE *argv, VALUE self) {
2615
- double arg1 ;
2616
- long result;
2617
- double val1 ;
2618
- int ecode1 = 0 ;
2619
- VALUE vresult = Qnil;
2620
-
2621
- if ((argc < 1) || (argc > 1)) {
2622
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2623
- }
2624
- ecode1 = SWIG_AsVal_double(argv[0], &val1);
2625
- if (!SWIG_IsOK(ecode1)) {
2626
- SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Gosu::round" "', argument " "1"" of type '" "double""'");
2627
- }
2628
- arg1 = static_cast< double >(val1);
2629
- {
2630
- try {
2631
- result = (long)Gosu::round(arg1);
2632
- } catch(const std::runtime_error& e) {
2633
- SWIG_exception(SWIG_RuntimeError, e.what());
2634
- }
2635
- }
2636
- vresult = SWIG_From_long(static_cast< long >(result));
2637
- return vresult;
2638
- fail:
2639
- return Qnil;
2640
- }
2641
-
2642
-
2643
2592
  SWIGINTERN VALUE
2644
2593
  _wrap_random(int argc, VALUE *argv, VALUE self) {
2645
2594
  double arg1 ;
@@ -2678,66 +2627,6 @@ fail:
2678
2627
  }
2679
2628
 
2680
2629
 
2681
- SWIGINTERN VALUE
2682
- _wrap_gosu_to_radians(int argc, VALUE *argv, VALUE self) {
2683
- double arg1 ;
2684
- double result;
2685
- double val1 ;
2686
- int ecode1 = 0 ;
2687
- VALUE vresult = Qnil;
2688
-
2689
- if ((argc < 1) || (argc > 1)) {
2690
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2691
- }
2692
- ecode1 = SWIG_AsVal_double(argv[0], &val1);
2693
- if (!SWIG_IsOK(ecode1)) {
2694
- SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Gosu::gosuToRadians" "', argument " "1"" of type '" "double""'");
2695
- }
2696
- arg1 = static_cast< double >(val1);
2697
- {
2698
- try {
2699
- result = (double)Gosu::gosuToRadians(arg1);
2700
- } catch(const std::runtime_error& e) {
2701
- SWIG_exception(SWIG_RuntimeError, e.what());
2702
- }
2703
- }
2704
- vresult = SWIG_From_double(static_cast< double >(result));
2705
- return vresult;
2706
- fail:
2707
- return Qnil;
2708
- }
2709
-
2710
-
2711
- SWIGINTERN VALUE
2712
- _wrap_radians_to_gosu(int argc, VALUE *argv, VALUE self) {
2713
- double arg1 ;
2714
- double result;
2715
- double val1 ;
2716
- int ecode1 = 0 ;
2717
- VALUE vresult = Qnil;
2718
-
2719
- if ((argc < 1) || (argc > 1)) {
2720
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2721
- }
2722
- ecode1 = SWIG_AsVal_double(argv[0], &val1);
2723
- if (!SWIG_IsOK(ecode1)) {
2724
- SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Gosu::radiansToGosu" "', argument " "1"" of type '" "double""'");
2725
- }
2726
- arg1 = static_cast< double >(val1);
2727
- {
2728
- try {
2729
- result = (double)Gosu::radiansToGosu(arg1);
2730
- } catch(const std::runtime_error& e) {
2731
- SWIG_exception(SWIG_RuntimeError, e.what());
2732
- }
2733
- }
2734
- vresult = SWIG_From_double(static_cast< double >(result));
2735
- return vresult;
2736
- fail:
2737
- return Qnil;
2738
- }
2739
-
2740
-
2741
2630
  SWIGINTERN VALUE
2742
2631
  _wrap_offset_x(int argc, VALUE *argv, VALUE self) {
2743
2632
  double arg1 ;
@@ -2946,60 +2835,6 @@ fail:
2946
2835
  }
2947
2836
 
2948
2837
 
2949
- SWIGINTERN VALUE
2950
- _wrap_distance_sqr(int argc, VALUE *argv, VALUE self) {
2951
- double arg1 ;
2952
- double arg2 ;
2953
- double arg3 ;
2954
- double arg4 ;
2955
- double result;
2956
- double val1 ;
2957
- int ecode1 = 0 ;
2958
- double val2 ;
2959
- int ecode2 = 0 ;
2960
- double val3 ;
2961
- int ecode3 = 0 ;
2962
- double val4 ;
2963
- int ecode4 = 0 ;
2964
- VALUE vresult = Qnil;
2965
-
2966
- if ((argc < 4) || (argc > 4)) {
2967
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
2968
- }
2969
- ecode1 = SWIG_AsVal_double(argv[0], &val1);
2970
- if (!SWIG_IsOK(ecode1)) {
2971
- SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Gosu::distanceSqr" "', argument " "1"" of type '" "double""'");
2972
- }
2973
- arg1 = static_cast< double >(val1);
2974
- ecode2 = SWIG_AsVal_double(argv[1], &val2);
2975
- if (!SWIG_IsOK(ecode2)) {
2976
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Gosu::distanceSqr" "', argument " "2"" of type '" "double""'");
2977
- }
2978
- arg2 = static_cast< double >(val2);
2979
- ecode3 = SWIG_AsVal_double(argv[2], &val3);
2980
- if (!SWIG_IsOK(ecode3)) {
2981
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Gosu::distanceSqr" "', argument " "3"" of type '" "double""'");
2982
- }
2983
- arg3 = static_cast< double >(val3);
2984
- ecode4 = SWIG_AsVal_double(argv[3], &val4);
2985
- if (!SWIG_IsOK(ecode4)) {
2986
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Gosu::distanceSqr" "', argument " "4"" of type '" "double""'");
2987
- }
2988
- arg4 = static_cast< double >(val4);
2989
- {
2990
- try {
2991
- result = (double)Gosu::distanceSqr(arg1,arg2,arg3,arg4);
2992
- } catch(const std::runtime_error& e) {
2993
- SWIG_exception(SWIG_RuntimeError, e.what());
2994
- }
2995
- }
2996
- vresult = SWIG_From_double(static_cast< double >(result));
2997
- return vresult;
2998
- fail:
2999
- return Qnil;
3000
- }
3001
-
3002
-
3003
2838
  SWIGINTERN VALUE
3004
2839
  _wrap_distance(int argc, VALUE *argv, VALUE self) {
3005
2840
  double arg1 ;
@@ -6129,6 +5964,90 @@ fail:
6129
5964
  }
6130
5965
 
6131
5966
 
5967
+ SWIGINTERN VALUE
5968
+ _wrap_SampleInstance_pausedq___(int argc, VALUE *argv, VALUE self) {
5969
+ Gosu::SampleInstance *arg1 = (Gosu::SampleInstance *) 0 ;
5970
+ bool result;
5971
+ void *argp1 = 0 ;
5972
+ int res1 = 0 ;
5973
+ VALUE vresult = Qnil;
5974
+
5975
+ if ((argc < 0) || (argc > 0)) {
5976
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
5977
+ }
5978
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__SampleInstance, 0 | 0 );
5979
+ if (!SWIG_IsOK(res1)) {
5980
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "paused" "', argument " "1"" of type '" "Gosu::SampleInstance const *""'");
5981
+ }
5982
+ arg1 = reinterpret_cast< Gosu::SampleInstance * >(argp1);
5983
+ {
5984
+ try {
5985
+ result = (bool)((Gosu::SampleInstance const *)arg1)->paused();
5986
+ } catch(const std::runtime_error& e) {
5987
+ SWIG_exception(SWIG_RuntimeError, e.what());
5988
+ }
5989
+ }
5990
+ vresult = SWIG_From_bool(static_cast< bool >(result));
5991
+ return vresult;
5992
+ fail:
5993
+ return Qnil;
5994
+ }
5995
+
5996
+
5997
+ SWIGINTERN VALUE
5998
+ _wrap_SampleInstance_pause(int argc, VALUE *argv, VALUE self) {
5999
+ Gosu::SampleInstance *arg1 = (Gosu::SampleInstance *) 0 ;
6000
+ void *argp1 = 0 ;
6001
+ int res1 = 0 ;
6002
+
6003
+ if ((argc < 0) || (argc > 0)) {
6004
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6005
+ }
6006
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__SampleInstance, 0 | 0 );
6007
+ if (!SWIG_IsOK(res1)) {
6008
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pause" "', argument " "1"" of type '" "Gosu::SampleInstance *""'");
6009
+ }
6010
+ arg1 = reinterpret_cast< Gosu::SampleInstance * >(argp1);
6011
+ {
6012
+ try {
6013
+ (arg1)->pause();
6014
+ } catch(const std::runtime_error& e) {
6015
+ SWIG_exception(SWIG_RuntimeError, e.what());
6016
+ }
6017
+ }
6018
+ return Qnil;
6019
+ fail:
6020
+ return Qnil;
6021
+ }
6022
+
6023
+
6024
+ SWIGINTERN VALUE
6025
+ _wrap_SampleInstance_resume(int argc, VALUE *argv, VALUE self) {
6026
+ Gosu::SampleInstance *arg1 = (Gosu::SampleInstance *) 0 ;
6027
+ void *argp1 = 0 ;
6028
+ int res1 = 0 ;
6029
+
6030
+ if ((argc < 0) || (argc > 0)) {
6031
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6032
+ }
6033
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__SampleInstance, 0 | 0 );
6034
+ if (!SWIG_IsOK(res1)) {
6035
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "resume" "', argument " "1"" of type '" "Gosu::SampleInstance *""'");
6036
+ }
6037
+ arg1 = reinterpret_cast< Gosu::SampleInstance * >(argp1);
6038
+ {
6039
+ try {
6040
+ (arg1)->resume();
6041
+ } catch(const std::runtime_error& e) {
6042
+ SWIG_exception(SWIG_RuntimeError, e.what());
6043
+ }
6044
+ }
6045
+ return Qnil;
6046
+ fail:
6047
+ return Qnil;
6048
+ }
6049
+
6050
+
6132
6051
  SWIGINTERN VALUE
6133
6052
  _wrap_SampleInstance_stop(int argc, VALUE *argv, VALUE self) {
6134
6053
  Gosu::SampleInstance *arg1 = (Gosu::SampleInstance *) 0 ;
@@ -6280,6 +6199,7 @@ _wrap_Sample_play(int argc, VALUE *argv, VALUE self) {
6280
6199
  Gosu::Sample *arg1 = (Gosu::Sample *) 0 ;
6281
6200
  double arg2 = (double) 1 ;
6282
6201
  double arg3 = (double) 1 ;
6202
+ bool arg4 = (bool) false ;
6283
6203
  SwigValueWrapper<Gosu::SampleInstance > result;
6284
6204
  void *argp1 = 0 ;
6285
6205
  int res1 = 0 ;
@@ -6287,9 +6207,11 @@ _wrap_Sample_play(int argc, VALUE *argv, VALUE self) {
6287
6207
  int ecode2 = 0 ;
6288
6208
  double val3 ;
6289
6209
  int ecode3 = 0 ;
6210
+ bool val4 ;
6211
+ int ecode4 = 0 ;
6290
6212
  VALUE vresult = Qnil;
6291
6213
 
6292
- if ((argc < 0) || (argc > 2)) {
6214
+ if ((argc < 0) || (argc > 3)) {
6293
6215
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6294
6216
  }
6295
6217
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Sample, 0 | 0 );
@@ -6311,9 +6233,16 @@ _wrap_Sample_play(int argc, VALUE *argv, VALUE self) {
6311
6233
  }
6312
6234
  arg3 = static_cast< double >(val3);
6313
6235
  }
6236
+ if (argc > 2) {
6237
+ ecode4 = SWIG_AsVal_bool(argv[2], &val4);
6238
+ if (!SWIG_IsOK(ecode4)) {
6239
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "play" "', argument " "4"" of type '" "bool""'");
6240
+ }
6241
+ arg4 = static_cast< bool >(val4);
6242
+ }
6314
6243
  {
6315
6244
  try {
6316
- result = ((Gosu::Sample const *)arg1)->play(arg2,arg3);
6245
+ result = ((Gosu::Sample const *)arg1)->play(arg2,arg3,arg4);
6317
6246
  } catch(const std::runtime_error& e) {
6318
6247
  SWIG_exception(SWIG_RuntimeError, e.what());
6319
6248
  }
@@ -6331,6 +6260,7 @@ _wrap_Sample_play_pan(int argc, VALUE *argv, VALUE self) {
6331
6260
  double arg2 ;
6332
6261
  double arg3 = (double) 1 ;
6333
6262
  double arg4 = (double) 1 ;
6263
+ bool arg5 = (bool) false ;
6334
6264
  SwigValueWrapper<Gosu::SampleInstance > result;
6335
6265
  void *argp1 = 0 ;
6336
6266
  int res1 = 0 ;
@@ -6340,9 +6270,11 @@ _wrap_Sample_play_pan(int argc, VALUE *argv, VALUE self) {
6340
6270
  int ecode3 = 0 ;
6341
6271
  double val4 ;
6342
6272
  int ecode4 = 0 ;
6273
+ bool val5 ;
6274
+ int ecode5 = 0 ;
6343
6275
  VALUE vresult = Qnil;
6344
6276
 
6345
- if ((argc < 1) || (argc > 3)) {
6277
+ if ((argc < 1) || (argc > 4)) {
6346
6278
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
6347
6279
  }
6348
6280
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Sample, 0 | 0 );
@@ -6369,9 +6301,16 @@ _wrap_Sample_play_pan(int argc, VALUE *argv, VALUE self) {
6369
6301
  }
6370
6302
  arg4 = static_cast< double >(val4);
6371
6303
  }
6304
+ if (argc > 3) {
6305
+ ecode5 = SWIG_AsVal_bool(argv[3], &val5);
6306
+ if (!SWIG_IsOK(ecode5)) {
6307
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "playPan" "', argument " "5"" of type '" "bool""'");
6308
+ }
6309
+ arg5 = static_cast< bool >(val5);
6310
+ }
6372
6311
  {
6373
6312
  try {
6374
- result = ((Gosu::Sample const *)arg1)->playPan(arg2,arg3,arg4);
6313
+ result = ((Gosu::Sample const *)arg1)->playPan(arg2,arg3,arg4,arg5);
6375
6314
  } catch(const std::runtime_error& e) {
6376
6315
  SWIG_exception(SWIG_RuntimeError, e.what());
6377
6316
  }
@@ -6457,13 +6396,38 @@ free_Gosu_Song(Gosu::Song *arg1) {
6457
6396
  delete arg1;
6458
6397
  }
6459
6398
 
6399
+ SWIGINTERN VALUE
6400
+ _wrap_Song_current_song(int argc, VALUE *argv, VALUE self) {
6401
+ Gosu::Song *result = 0 ;
6402
+ VALUE vresult = Qnil;
6403
+
6404
+ if ((argc < 0) || (argc > 0)) {
6405
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6406
+ }
6407
+ {
6408
+ try {
6409
+ result = (Gosu::Song *)Gosu::Song::currentSong();
6410
+ } catch(const std::runtime_error& e) {
6411
+ SWIG_exception(SWIG_RuntimeError, e.what());
6412
+ }
6413
+ }
6414
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Gosu__Song, 0 | 0 );
6415
+ return vresult;
6416
+ fail:
6417
+ return Qnil;
6418
+ }
6419
+
6420
+
6460
6421
  SWIGINTERN VALUE
6461
6422
  _wrap_Song_play(int argc, VALUE *argv, VALUE self) {
6462
6423
  Gosu::Song *arg1 = (Gosu::Song *) 0 ;
6424
+ bool arg2 = (bool) false ;
6463
6425
  void *argp1 = 0 ;
6464
6426
  int res1 = 0 ;
6427
+ bool val2 ;
6428
+ int ecode2 = 0 ;
6465
6429
 
6466
- if ((argc < 0) || (argc > 0)) {
6430
+ if ((argc < 0) || (argc > 1)) {
6467
6431
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6468
6432
  }
6469
6433
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Song, 0 | 0 );
@@ -6471,9 +6435,43 @@ _wrap_Song_play(int argc, VALUE *argv, VALUE self) {
6471
6435
  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "play" "', argument " "1"" of type '" "Gosu::Song *""'");
6472
6436
  }
6473
6437
  arg1 = reinterpret_cast< Gosu::Song * >(argp1);
6438
+ if (argc > 0) {
6439
+ ecode2 = SWIG_AsVal_bool(argv[0], &val2);
6440
+ if (!SWIG_IsOK(ecode2)) {
6441
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "play" "', argument " "2"" of type '" "bool""'");
6442
+ }
6443
+ arg2 = static_cast< bool >(val2);
6444
+ }
6445
+ {
6446
+ try {
6447
+ (arg1)->play(arg2);
6448
+ } catch(const std::runtime_error& e) {
6449
+ SWIG_exception(SWIG_RuntimeError, e.what());
6450
+ }
6451
+ }
6452
+ return Qnil;
6453
+ fail:
6454
+ return Qnil;
6455
+ }
6456
+
6457
+
6458
+ SWIGINTERN VALUE
6459
+ _wrap_Song_pause(int argc, VALUE *argv, VALUE self) {
6460
+ Gosu::Song *arg1 = (Gosu::Song *) 0 ;
6461
+ void *argp1 = 0 ;
6462
+ int res1 = 0 ;
6463
+
6464
+ if ((argc < 0) || (argc > 0)) {
6465
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6466
+ }
6467
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Song, 0 | 0 );
6468
+ if (!SWIG_IsOK(res1)) {
6469
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pause" "', argument " "1"" of type '" "Gosu::Song *""'");
6470
+ }
6471
+ arg1 = reinterpret_cast< Gosu::Song * >(argp1);
6474
6472
  {
6475
6473
  try {
6476
- (arg1)->play();
6474
+ (arg1)->pause();
6477
6475
  } catch(const std::runtime_error& e) {
6478
6476
  SWIG_exception(SWIG_RuntimeError, e.what());
6479
6477
  }
@@ -6484,6 +6482,36 @@ fail:
6484
6482
  }
6485
6483
 
6486
6484
 
6485
+ SWIGINTERN VALUE
6486
+ _wrap_Song_pausedq___(int argc, VALUE *argv, VALUE self) {
6487
+ Gosu::Song *arg1 = (Gosu::Song *) 0 ;
6488
+ bool result;
6489
+ void *argp1 = 0 ;
6490
+ int res1 = 0 ;
6491
+ VALUE vresult = Qnil;
6492
+
6493
+ if ((argc < 0) || (argc > 0)) {
6494
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
6495
+ }
6496
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Song, 0 | 0 );
6497
+ if (!SWIG_IsOK(res1)) {
6498
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "paused" "', argument " "1"" of type '" "Gosu::Song const *""'");
6499
+ }
6500
+ arg1 = reinterpret_cast< Gosu::Song * >(argp1);
6501
+ {
6502
+ try {
6503
+ result = (bool)((Gosu::Song const *)arg1)->paused();
6504
+ } catch(const std::runtime_error& e) {
6505
+ SWIG_exception(SWIG_RuntimeError, e.what());
6506
+ }
6507
+ }
6508
+ vresult = SWIG_From_bool(static_cast< bool >(result));
6509
+ return vresult;
6510
+ fail:
6511
+ return Qnil;
6512
+ }
6513
+
6514
+
6487
6515
  SWIGINTERN VALUE
6488
6516
  _wrap_Song_stop(int argc, VALUE *argv, VALUE self) {
6489
6517
  Gosu::Song *arg1 = (Gosu::Song *) 0 ;
@@ -7873,6 +7901,119 @@ fail:
7873
7901
  }
7874
7902
 
7875
7903
 
7904
+ SWIGINTERN VALUE
7905
+ _wrap_Window_set_mouse_position(int argc, VALUE *argv, VALUE self) {
7906
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
7907
+ double arg2 ;
7908
+ double arg3 ;
7909
+ void *argp1 = 0 ;
7910
+ int res1 = 0 ;
7911
+ double val2 ;
7912
+ int ecode2 = 0 ;
7913
+ double val3 ;
7914
+ int ecode3 = 0 ;
7915
+
7916
+ if ((argc < 2) || (argc > 2)) {
7917
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
7918
+ }
7919
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
7920
+ if (!SWIG_IsOK(res1)) {
7921
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setMousePosition" "', argument " "1"" of type '" "Gosu::Window *""'");
7922
+ }
7923
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
7924
+ ecode2 = SWIG_AsVal_double(argv[0], &val2);
7925
+ if (!SWIG_IsOK(ecode2)) {
7926
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setMousePosition" "', argument " "2"" of type '" "double""'");
7927
+ }
7928
+ arg2 = static_cast< double >(val2);
7929
+ ecode3 = SWIG_AsVal_double(argv[1], &val3);
7930
+ if (!SWIG_IsOK(ecode3)) {
7931
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setMousePosition" "', argument " "3"" of type '" "double""'");
7932
+ }
7933
+ arg3 = static_cast< double >(val3);
7934
+ {
7935
+ try {
7936
+ Gosu_Window_setMousePosition(arg1,arg2,arg3);
7937
+ } catch(const std::runtime_error& e) {
7938
+ SWIG_exception(SWIG_RuntimeError, e.what());
7939
+ }
7940
+ }
7941
+ return Qnil;
7942
+ fail:
7943
+ return Qnil;
7944
+ }
7945
+
7946
+
7947
+ SWIGINTERN VALUE
7948
+ _wrap_Window_mouse_xe___(int argc, VALUE *argv, VALUE self) {
7949
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
7950
+ double arg2 ;
7951
+ void *argp1 = 0 ;
7952
+ int res1 = 0 ;
7953
+ double val2 ;
7954
+ int ecode2 = 0 ;
7955
+
7956
+ if ((argc < 1) || (argc > 1)) {
7957
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
7958
+ }
7959
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
7960
+ if (!SWIG_IsOK(res1)) {
7961
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setMouseX" "', argument " "1"" of type '" "Gosu::Window *""'");
7962
+ }
7963
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
7964
+ ecode2 = SWIG_AsVal_double(argv[0], &val2);
7965
+ if (!SWIG_IsOK(ecode2)) {
7966
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setMouseX" "', argument " "2"" of type '" "double""'");
7967
+ }
7968
+ arg2 = static_cast< double >(val2);
7969
+ {
7970
+ try {
7971
+ Gosu_Window_setMouseX(arg1,arg2);
7972
+ } catch(const std::runtime_error& e) {
7973
+ SWIG_exception(SWIG_RuntimeError, e.what());
7974
+ }
7975
+ }
7976
+ return Qnil;
7977
+ fail:
7978
+ return Qnil;
7979
+ }
7980
+
7981
+
7982
+ SWIGINTERN VALUE
7983
+ _wrap_Window_mouse_ye___(int argc, VALUE *argv, VALUE self) {
7984
+ Gosu::Window *arg1 = (Gosu::Window *) 0 ;
7985
+ double arg2 ;
7986
+ void *argp1 = 0 ;
7987
+ int res1 = 0 ;
7988
+ double val2 ;
7989
+ int ecode2 = 0 ;
7990
+
7991
+ if ((argc < 1) || (argc > 1)) {
7992
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
7993
+ }
7994
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Gosu__Window, 0 | 0 );
7995
+ if (!SWIG_IsOK(res1)) {
7996
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setMouseY" "', argument " "1"" of type '" "Gosu::Window *""'");
7997
+ }
7998
+ arg1 = reinterpret_cast< Gosu::Window * >(argp1);
7999
+ ecode2 = SWIG_AsVal_double(argv[0], &val2);
8000
+ if (!SWIG_IsOK(ecode2)) {
8001
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setMouseY" "', argument " "2"" of type '" "double""'");
8002
+ }
8003
+ arg2 = static_cast< double >(val2);
8004
+ {
8005
+ try {
8006
+ Gosu_Window_setMouseY(arg1,arg2);
8007
+ } catch(const std::runtime_error& e) {
8008
+ SWIG_exception(SWIG_RuntimeError, e.what());
8009
+ }
8010
+ }
8011
+ return Qnil;
8012
+ fail:
8013
+ return Qnil;
8014
+ }
8015
+
8016
+
7876
8017
  SWIGINTERN VALUE
7877
8018
  _wrap_Window_width(int argc, VALUE *argv, VALUE self) {
7878
8019
  Gosu::Window *arg1 = (Gosu::Window *) 0 ;
@@ -8359,28 +8500,14 @@ SWIGEXPORT void Init_gosu(void) {
8359
8500
 
8360
8501
  SWIG_RubyInitializeTrackings();
8361
8502
  rb_define_module_function(mGosu, "milliseconds", VALUEFUNC(_wrap_milliseconds), -1);
8362
- rb_define_module_function(mGosu, "trunc", VALUEFUNC(_wrap_trunc), -1);
8363
- rb_define_module_function(mGosu, "round", VALUEFUNC(_wrap_round), -1);
8364
8503
  rb_define_module_function(mGosu, "random", VALUEFUNC(_wrap_random), -1);
8365
- rb_define_module_function(mGosu, "gosu_to_radians", VALUEFUNC(_wrap_gosu_to_radians), -1);
8366
- rb_define_module_function(mGosu, "radians_to_gosu", VALUEFUNC(_wrap_radians_to_gosu), -1);
8367
8504
  rb_define_module_function(mGosu, "offset_x", VALUEFUNC(_wrap_offset_x), -1);
8368
8505
  rb_define_module_function(mGosu, "offset_y", VALUEFUNC(_wrap_offset_y), -1);
8369
8506
  rb_define_module_function(mGosu, "angle", VALUEFUNC(_wrap_angle), -1);
8370
8507
  rb_define_module_function(mGosu, "angle_diff", VALUEFUNC(_wrap_angle_diff), -1);
8371
8508
  rb_define_module_function(mGosu, "normalize_angle", VALUEFUNC(_wrap_normalize_angle), -1);
8372
- rb_define_module_function(mGosu, "distance_sqr", VALUEFUNC(_wrap_distance_sqr), -1);
8373
8509
  rb_define_module_function(mGosu, "distance", VALUEFUNC(_wrap_distance), -1);
8374
8510
  rb_define_module_function(mGosu, "default_font_name", VALUEFUNC(_wrap_default_font_name), -1);
8375
- rb_define_const(mGosu, "AmDefault", SWIG_From_int(static_cast< int >(Gosu::amDefault)));
8376
- rb_define_const(mGosu, "AmAdditive", SWIG_From_int(static_cast< int >(Gosu::amAdditive)));
8377
- rb_define_const(mGosu, "FfBold", SWIG_From_int(static_cast< int >(Gosu::ffBold)));
8378
- rb_define_const(mGosu, "FfItalic", SWIG_From_int(static_cast< int >(Gosu::ffItalic)));
8379
- rb_define_const(mGosu, "FfUnderline", SWIG_From_int(static_cast< int >(Gosu::ffUnderline)));
8380
- rb_define_const(mGosu, "TaLeft", SWIG_From_int(static_cast< int >(Gosu::taLeft)));
8381
- rb_define_const(mGosu, "TaRight", SWIG_From_int(static_cast< int >(Gosu::taRight)));
8382
- rb_define_const(mGosu, "TaCenter", SWIG_From_int(static_cast< int >(Gosu::taCenter)));
8383
- rb_define_const(mGosu, "TaJustify", SWIG_From_int(static_cast< int >(Gosu::taJustify)));
8384
8511
 
8385
8512
  cColor.klass = rb_define_class_under(mGosu, "Color", rb_cObject);
8386
8513
  SWIG_TypeClientData(SWIGTYPE_p_Gosu__Color, (void *) &cColor);
@@ -8476,6 +8603,9 @@ SWIGEXPORT void Init_gosu(void) {
8476
8603
  rb_define_alloc_func(cSampleInstance.klass, _wrap_SampleInstance_allocate);
8477
8604
  rb_define_method(cSampleInstance.klass, "initialize", VALUEFUNC(_wrap_new_SampleInstance), -1);
8478
8605
  rb_define_method(cSampleInstance.klass, "playing?", VALUEFUNC(_wrap_SampleInstance_playingq___), -1);
8606
+ rb_define_method(cSampleInstance.klass, "paused?", VALUEFUNC(_wrap_SampleInstance_pausedq___), -1);
8607
+ rb_define_method(cSampleInstance.klass, "pause", VALUEFUNC(_wrap_SampleInstance_pause), -1);
8608
+ rb_define_method(cSampleInstance.klass, "resume", VALUEFUNC(_wrap_SampleInstance_resume), -1);
8479
8609
  rb_define_method(cSampleInstance.klass, "stop", VALUEFUNC(_wrap_SampleInstance_stop), -1);
8480
8610
  rb_define_method(cSampleInstance.klass, "volume=", VALUEFUNC(_wrap_SampleInstance_volumee___), -1);
8481
8611
  rb_define_method(cSampleInstance.klass, "pan=", VALUEFUNC(_wrap_SampleInstance_pane___), -1);
@@ -8500,7 +8630,10 @@ SWIGEXPORT void Init_gosu(void) {
8500
8630
  rb_define_method(cSong.klass, "initialize", VALUEFUNC(_wrap_new_Song), -1);
8501
8631
  rb_define_const(cSong.klass, "StStream", SWIG_From_int(static_cast< int >(Gosu::Song::stStream)));
8502
8632
  rb_define_const(cSong.klass, "StModule", SWIG_From_int(static_cast< int >(Gosu::Song::stModule)));
8633
+ rb_define_singleton_method(cSong.klass, "current_song", VALUEFUNC(_wrap_Song_current_song), -1);
8503
8634
  rb_define_method(cSong.klass, "play", VALUEFUNC(_wrap_Song_play), -1);
8635
+ rb_define_method(cSong.klass, "pause", VALUEFUNC(_wrap_Song_pause), -1);
8636
+ rb_define_method(cSong.klass, "paused?", VALUEFUNC(_wrap_Song_pausedq___), -1);
8504
8637
  rb_define_method(cSong.klass, "stop", VALUEFUNC(_wrap_Song_stop), -1);
8505
8638
  rb_define_method(cSong.klass, "playing?", VALUEFUNC(_wrap_Song_playingq___), -1);
8506
8639
  rb_define_method(cSong.klass, "volume", VALUEFUNC(_wrap_Song_volume), -1);
@@ -8638,10 +8771,7 @@ SWIGEXPORT void Init_gosu(void) {
8638
8771
  rb_eval_string("class Gosu::Image; def self.from_text(*args); args.size == 4 ? from_text_4(*args) : from_text_7(*args); end; end");
8639
8772
 
8640
8773
  // Extend Numeric with simple angle conversion methods.
8641
- rb_eval_string("class Numeric;"
8642
- " def gosu_to_radians; (self - 90) * Math::PI / 180.0; end;"
8643
- " def radians_to_gosu; self * 180.0 / Math::PI + 90; end;"
8644
- "end");
8774
+ rb_eval_string("class ::Numeric;def gosu_to_radians;(self-90)*Math::PI/180.0;end;def radians_to_gosu;self*180.0/Math::PI+90;end;end");
8645
8775
 
8646
8776
  GosusDarkSide::oncePerTick = GosusDarkSide::yieldToOtherRubyThreads;
8647
8777
 
@@ -8681,6 +8811,9 @@ SWIGEXPORT void Init_gosu(void) {
8681
8811
  rb_define_method(cWindow.klass, "text_input=", VALUEFUNC(_wrap_Window_text_inpute___), -1);
8682
8812
  rb_define_method(cWindow.klass, "mouse_x", VALUEFUNC(_wrap_Window_mouse_x), -1);
8683
8813
  rb_define_method(cWindow.klass, "mouse_y", VALUEFUNC(_wrap_Window_mouse_y), -1);
8814
+ rb_define_method(cWindow.klass, "set_mouse_position", VALUEFUNC(_wrap_Window_set_mouse_position), -1);
8815
+ rb_define_method(cWindow.klass, "mouse_x=", VALUEFUNC(_wrap_Window_mouse_xe___), -1);
8816
+ rb_define_method(cWindow.klass, "mouse_y=", VALUEFUNC(_wrap_Window_mouse_ye___), -1);
8684
8817
  rb_define_method(cWindow.klass, "width", VALUEFUNC(_wrap_Window_width), -1);
8685
8818
  rb_define_method(cWindow.klass, "height", VALUEFUNC(_wrap_Window_height), -1);
8686
8819
  rb_define_method(cWindow.klass, "gl", VALUEFUNC(_wrap_Window_gl), -1);