gosu 0.8.0.pre3 → 0.8.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Buttons.hpp +13 -11
  3. data/{linux → ext/gosu}/extconf.rb +25 -47
  4. data/{GosuImpl/RubyGosu_wrap.cxx → ext/gosu/gosu_wrap.cxx} +3 -2
  5. data/{GosuImpl/RubyGosu_wrap.h → ext/gosu/gosu_wrap.h} +0 -0
  6. data/lib/gosu.rb +6 -7
  7. data/lib/gosu/zen.rb +12 -0
  8. data/{GosuImpl → src}/Audio/ALChannelManagement.hpp +0 -0
  9. data/{GosuImpl → src}/Audio/AudioFile.hpp +0 -0
  10. data/{GosuImpl → src}/Audio/AudioOpenAL.cpp +0 -0
  11. data/{GosuImpl → src}/Audio/AudioOpenAL.mm +0 -0
  12. data/{GosuImpl → src}/Audio/AudioToolboxFile.hpp +0 -0
  13. data/{GosuImpl → src}/Audio/OggFile.hpp +0 -0
  14. data/{GosuImpl → src}/Audio/SndFile.hpp +0 -0
  15. data/{GosuImpl/Graphics → src/Bitmap}/Bitmap.cpp +2 -0
  16. data/{GosuImpl/Graphics → src/Bitmap}/BitmapApple.mm +0 -0
  17. data/{GosuImpl/Graphics → src/Bitmap}/BitmapBMP.cpp +0 -0
  18. data/{GosuImpl/Graphics → src/Bitmap}/BitmapColorKey.cpp +0 -0
  19. data/{GosuImpl/Graphics → src/Bitmap}/BitmapFreeImage.cpp +0 -0
  20. data/{GosuImpl/Graphics → src/Bitmap}/BitmapGDIplus.cpp +0 -0
  21. data/{GosuImpl/Graphics → src/Bitmap}/BitmapUtils.cpp +0 -0
  22. data/{GosuImpl → src}/DirectoriesMac.mm +0 -0
  23. data/{GosuImpl → src}/DirectoriesTouch.mm +0 -0
  24. data/{GosuImpl → src}/DirectoriesUnix.cpp +0 -0
  25. data/{GosuImpl → src}/DirectoriesWin.cpp +0 -0
  26. data/{GosuImpl → src}/FileUnix.cpp +0 -0
  27. data/{GosuImpl → src}/FileWin.cpp +0 -0
  28. data/{GosuImpl/Graphics → src}/GosuView.hpp +0 -0
  29. data/{GosuImpl/Graphics → src}/GosuView.mm +0 -0
  30. data/{GosuImpl → src}/Graphics/BlockAllocator.cpp +0 -0
  31. data/{GosuImpl → src}/Graphics/BlockAllocator.hpp +0 -0
  32. data/{GosuImpl → src}/Graphics/ClipRectStack.hpp +0 -0
  33. data/{GosuImpl → src}/Graphics/Color.cpp +0 -0
  34. data/{GosuImpl → src}/Graphics/Common.hpp +0 -0
  35. data/{GosuImpl → src}/Graphics/DrawOp.hpp +0 -0
  36. data/{GosuImpl → src}/Graphics/DrawOpQueue.hpp +0 -0
  37. data/{GosuImpl → src}/Graphics/Graphics.cpp +0 -0
  38. data/{GosuImpl → src}/Graphics/Image.cpp +0 -0
  39. data/{GosuImpl → src}/Graphics/LargeImageData.cpp +0 -0
  40. data/{GosuImpl → src}/Graphics/LargeImageData.hpp +0 -0
  41. data/{GosuImpl → src}/Graphics/Macro.hpp +0 -0
  42. data/{GosuImpl → src}/Graphics/RenderState.hpp +0 -0
  43. data/{GosuImpl → src}/Graphics/TexChunk.cpp +0 -0
  44. data/{GosuImpl → src}/Graphics/TexChunk.hpp +0 -0
  45. data/{GosuImpl → src}/Graphics/Texture.cpp +0 -0
  46. data/{GosuImpl → src}/Graphics/Texture.hpp +0 -0
  47. data/{GosuImpl → src}/Graphics/Transform.cpp +0 -0
  48. data/{GosuImpl → src}/Graphics/TransformStack.hpp +0 -0
  49. data/{GosuImpl → src}/IO.cpp +0 -0
  50. data/{GosuImpl → src}/Iconv.hpp +0 -0
  51. data/{GosuImpl → src}/Input/AccelerometerReader.hpp +0 -0
  52. data/{GosuImpl → src}/Input/AccelerometerReader.mm +0 -0
  53. data/{GosuImpl → src/Input}/Input.cpp +0 -0
  54. data/{GosuImpl → src/Input}/InputTouch.mm +0 -0
  55. data/{GosuImpl → src/Input}/TextInput.cpp +0 -0
  56. data/{GosuImpl → src/Input}/TextInputMac.mm +0 -0
  57. data/{GosuImpl → src}/Inspection.cpp +0 -0
  58. data/{GosuImpl → src}/MacUtility.hpp +0 -0
  59. data/{GosuImpl → src}/Math.cpp +0 -0
  60. data/{GosuImpl → src}/Sockets/CommSocket.cpp +0 -0
  61. data/{GosuImpl → src}/Sockets/ListenerSocket.cpp +0 -0
  62. data/{GosuImpl → src}/Sockets/MessageSocket.cpp +0 -0
  63. data/{GosuImpl → src}/Sockets/Socket.cpp +0 -0
  64. data/{GosuImpl → src}/Sockets/Socket.hpp +0 -0
  65. data/{GosuImpl/Graphics → src/Text}/Font.cpp +1 -1
  66. data/{GosuImpl/Graphics → src/Text}/FormattedString.hpp +0 -0
  67. data/{GosuImpl/Graphics → src/Text}/Text.cpp +1 -1
  68. data/{GosuImpl/Graphics/TextTouch.mm → src/Text/TextApple.mm} +0 -0
  69. data/{GosuImpl/Graphics → src/Text}/TextMac.cpp +1 -1
  70. data/{GosuImpl/Graphics → src/Text}/TextTTFWin.cpp +0 -0
  71. data/{GosuImpl/Graphics → src/Text}/TextUnix.cpp +0 -0
  72. data/{GosuImpl/Graphics → src/Text}/TextWin.cpp +0 -0
  73. data/{GosuImpl → src}/TimingApple.cpp +0 -0
  74. data/{GosuImpl → src}/TimingUnix.cpp +0 -0
  75. data/{GosuImpl → src}/TimingWin.cpp +0 -0
  76. data/{GosuImpl → src}/Utility.cpp +0 -0
  77. data/{GosuImpl → src}/UtilityApple.mm +0 -0
  78. data/{GosuImpl → src}/UtilityWin.cpp +0 -0
  79. data/{GosuImpl → src}/WinMain.cpp +0 -0
  80. data/{GosuImpl → src}/WinUtility.cpp +0 -0
  81. data/{GosuImpl → src}/Window.cpp +0 -0
  82. data/{GosuImpl → src}/WindowTouch.mm +0 -0
  83. data/{GosuImpl → src}/X11vroot.h +0 -0
  84. metadata +97 -193
  85. data/.yardopts +0 -1
  86. data/COPYING +0 -29
  87. data/GosuImpl/InputMac.mm +0 -733
  88. data/GosuImpl/InputWin.cpp +0 -483
  89. data/GosuImpl/InputX.cpp +0 -243
  90. data/GosuImpl/RubyGosu.swg +0 -821
  91. data/GosuImpl/RubyGosu_SWIG_GC_PATCH.patch +0 -126
  92. data/GosuImpl/RubyGosu_SWIG_RENAME_PATCH.patch +0 -62
  93. data/GosuImpl/TextInputWin.cpp +0 -211
  94. data/GosuImpl/TextInputX.cpp +0 -217
  95. data/GosuImpl/WindowWin.cpp +0 -534
  96. data/GosuImpl/WindowX.cpp +0 -458
  97. data/README.txt +0 -25
  98. data/dependencies/libogg/AUTHORS +0 -4
  99. data/dependencies/libogg/CHANGES +0 -70
  100. data/dependencies/libogg/COPYING +0 -28
  101. data/dependencies/libogg/include/ogg/ogg.h +0 -209
  102. data/dependencies/libogg/include/ogg/os_types.h +0 -147
  103. data/dependencies/libogg/src/bitwise.c +0 -857
  104. data/dependencies/libogg/src/framing.c +0 -2089
  105. data/dependencies/libvorbis/AUTHORS +0 -3
  106. data/dependencies/libvorbis/CHANGES +0 -126
  107. data/dependencies/libvorbis/COPYING +0 -28
  108. data/dependencies/libvorbis/include/vorbis/codec.h +0 -243
  109. data/dependencies/libvorbis/include/vorbis/vorbisenc.h +0 -436
  110. data/dependencies/libvorbis/include/vorbis/vorbisfile.h +0 -206
  111. data/dependencies/libvorbis/lib/analysis.c +0 -120
  112. data/dependencies/libvorbis/lib/backends.h +0 -144
  113. data/dependencies/libvorbis/lib/barkmel.c +0 -64
  114. data/dependencies/libvorbis/lib/bitrate.c +0 -253
  115. data/dependencies/libvorbis/lib/bitrate.h +0 -59
  116. data/dependencies/libvorbis/lib/block.c +0 -1046
  117. data/dependencies/libvorbis/lib/books/coupled/res_books_51.h +0 -12257
  118. data/dependencies/libvorbis/lib/books/coupled/res_books_stereo.h +0 -15783
  119. data/dependencies/libvorbis/lib/books/floor/floor_books.h +0 -1547
  120. data/dependencies/libvorbis/lib/books/uncoupled/res_books_uncoupled.h +0 -7758
  121. data/dependencies/libvorbis/lib/codebook.c +0 -479
  122. data/dependencies/libvorbis/lib/codebook.h +0 -119
  123. data/dependencies/libvorbis/lib/codec_internal.h +0 -167
  124. data/dependencies/libvorbis/lib/envelope.c +0 -375
  125. data/dependencies/libvorbis/lib/envelope.h +0 -80
  126. data/dependencies/libvorbis/lib/floor0.c +0 -222
  127. data/dependencies/libvorbis/lib/floor1.c +0 -1099
  128. data/dependencies/libvorbis/lib/highlevel.h +0 -58
  129. data/dependencies/libvorbis/lib/info.c +0 -664
  130. data/dependencies/libvorbis/lib/lookup.c +0 -94
  131. data/dependencies/libvorbis/lib/lookup.h +0 -32
  132. data/dependencies/libvorbis/lib/lookup_data.h +0 -192
  133. data/dependencies/libvorbis/lib/lpc.c +0 -160
  134. data/dependencies/libvorbis/lib/lpc.h +0 -29
  135. data/dependencies/libvorbis/lib/lsp.c +0 -456
  136. data/dependencies/libvorbis/lib/lsp.h +0 -28
  137. data/dependencies/libvorbis/lib/mapping0.c +0 -816
  138. data/dependencies/libvorbis/lib/masking.h +0 -785
  139. data/dependencies/libvorbis/lib/mdct.c +0 -563
  140. data/dependencies/libvorbis/lib/mdct.h +0 -71
  141. data/dependencies/libvorbis/lib/misc.h +0 -57
  142. data/dependencies/libvorbis/lib/modes/floor_all.h +0 -260
  143. data/dependencies/libvorbis/lib/modes/psych_11.h +0 -51
  144. data/dependencies/libvorbis/lib/modes/psych_16.h +0 -133
  145. data/dependencies/libvorbis/lib/modes/psych_44.h +0 -642
  146. data/dependencies/libvorbis/lib/modes/psych_8.h +0 -101
  147. data/dependencies/libvorbis/lib/modes/residue_16.h +0 -163
  148. data/dependencies/libvorbis/lib/modes/residue_44.h +0 -292
  149. data/dependencies/libvorbis/lib/modes/residue_44p51.h +0 -451
  150. data/dependencies/libvorbis/lib/modes/residue_44u.h +0 -318
  151. data/dependencies/libvorbis/lib/modes/residue_8.h +0 -109
  152. data/dependencies/libvorbis/lib/modes/setup_11.h +0 -143
  153. data/dependencies/libvorbis/lib/modes/setup_16.h +0 -153
  154. data/dependencies/libvorbis/lib/modes/setup_22.h +0 -128
  155. data/dependencies/libvorbis/lib/modes/setup_32.h +0 -132
  156. data/dependencies/libvorbis/lib/modes/setup_44.h +0 -117
  157. data/dependencies/libvorbis/lib/modes/setup_44p51.h +0 -74
  158. data/dependencies/libvorbis/lib/modes/setup_44u.h +0 -74
  159. data/dependencies/libvorbis/lib/modes/setup_8.h +0 -149
  160. data/dependencies/libvorbis/lib/modes/setup_X.h +0 -225
  161. data/dependencies/libvorbis/lib/os.h +0 -186
  162. data/dependencies/libvorbis/lib/psy.c +0 -1203
  163. data/dependencies/libvorbis/lib/psy.h +0 -154
  164. data/dependencies/libvorbis/lib/psytune.c +0 -524
  165. data/dependencies/libvorbis/lib/registry.c +0 -45
  166. data/dependencies/libvorbis/lib/registry.h +0 -32
  167. data/dependencies/libvorbis/lib/res0.c +0 -889
  168. data/dependencies/libvorbis/lib/scales.h +0 -90
  169. data/dependencies/libvorbis/lib/sharedbook.c +0 -579
  170. data/dependencies/libvorbis/lib/smallft.c +0 -1255
  171. data/dependencies/libvorbis/lib/smallft.h +0 -34
  172. data/dependencies/libvorbis/lib/synthesis.c +0 -184
  173. data/dependencies/libvorbis/lib/tone.c +0 -54
  174. data/dependencies/libvorbis/lib/vorbisenc.c +0 -1215
  175. data/dependencies/libvorbis/lib/vorbisfile.c +0 -2337
  176. data/dependencies/libvorbis/lib/window.c +0 -2135
  177. data/dependencies/libvorbis/lib/window.h +0 -26
  178. data/dependencies/ogg_vorbis.license +0 -28
  179. data/reference/gosu.rb +0 -1284
@@ -1,26 +0,0 @@
1
- /********************************************************************
2
- * *
3
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
- * *
8
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9
- * by the Xiph.Org Foundation http://www.xiph.org/ *
10
- * *
11
- ********************************************************************
12
-
13
- function: window functions
14
- last mod: $Id: window.h 13293 2007-07-24 00:09:47Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #ifndef _V_WINDOW_
19
- #define _V_WINDOW_
20
-
21
- extern float *_vorbis_window_get(int n);
22
- extern void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
23
- int lW,int W,int nW);
24
-
25
-
26
- #endif
@@ -1,28 +0,0 @@
1
- May contain `ogg', `vorbis' libraries (c) 2002-2008 Xiph.org Foundation
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions
5
- are met:
6
-
7
- - Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
-
10
- - Redistributions in binary form must reproduce the above copyright
11
- notice, this list of conditions and the following disclaimer in the
12
- documentation and/or other materials provided with the distribution.
13
-
14
- - Neither the name of the Xiph.org Foundation nor the names of its
15
- contributors may be used to endorse or promote products derived from
16
- this software without specific prior written permission.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
22
- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,1284 +0,0 @@
1
- ##
2
- # The first component of the version.
3
- GOSU_MAJOR_VERSION = :a_fixnum
4
-
5
- ##
6
- # The second component of the version.
7
- GOSU_MINOR_VERSION = :a_fixnum
8
-
9
- ##
10
- # The third component of the version.
11
- GOSU_POINT_VERSION = :a_fixnum
12
-
13
- ##
14
- # A version string of the form "0.1.2" or "0.1.2.3".
15
- GOSU_VERSION = "#{GOSU_MAJOR_VERSION}.#{GOSU_MINOR_VERSION}.#{GOSU_POINT_VERSION}"
16
-
17
- ##
18
- # A long block of legal copy that your game is obliged to display somewhere.
19
- GOSU_COPYRIGHT_NOTICE = :a_string
20
-
21
- module Gosu
22
- Kb0 = :implementation_defined
23
- Kb1 = :implementation_defined
24
- Kb2 = :implementation_defined
25
- Kb3 = :implementation_defined
26
- Kb4 = :implementation_defined
27
- Kb5 = :implementation_defined
28
- Kb6 = :implementation_defined
29
- Kb7 = :implementation_defined
30
- Kb8 = :implementation_defined
31
- Kb9 = :implementation_defined
32
- KbA = :implementation_defined
33
- KbB = :implementation_defined
34
- KbC = :implementation_defined
35
- KbD = :implementation_defined
36
- KbE = :implementation_defined
37
- KbF = :implementation_defined
38
- KbG = :implementation_defined
39
- KbH = :implementation_defined
40
- KbI = :implementation_defined
41
- KbJ = :implementation_defined
42
- KbK = :implementation_defined
43
- KbL = :implementation_defined
44
- KbM = :implementation_defined
45
- KbN = :implementation_defined
46
- KbO = :implementation_defined
47
- KbP = :implementation_defined
48
- KbQ = :implementation_defined
49
- KbR = :implementation_defined
50
- KbS = :implementation_defined
51
- KbT = :implementation_defined
52
- KbU = :implementation_defined
53
- KbV = :implementation_defined
54
- KbW = :implementation_defined
55
- KbX = :implementation_defined
56
- KbY = :implementation_defined
57
- KbZ = :implementation_defined
58
- KbBackspace = :implementation_defined
59
- KbDelete = :implementation_defined
60
- KbDown = :implementation_defined
61
- KbEnd = :implementation_defined
62
-
63
- ##
64
- # This is the key on the numpad.
65
- KbEnter = :implementation_defined
66
-
67
- KbEscape = :implementation_defined
68
- KbF1 = :implementation_defined
69
- KbF10 = :implementation_defined
70
- KbF11 = :implementation_defined
71
- KbF12 = :implementation_defined
72
- KbF2 = :implementation_defined
73
- KbF3 = :implementation_defined
74
- KbF4 = :implementation_defined
75
- KbF5 = :implementation_defined
76
- KbF6 = :implementation_defined
77
- KbF7 = :implementation_defined
78
- KbF8 = :implementation_defined
79
- KbF9 = :implementation_defined
80
- KbHome = :implementation_defined
81
- KbInsert = :implementation_defined
82
- KbLeft = :implementation_defined
83
- KbLeftAlt = :implementation_defined
84
- KbLeftControl = :implementation_defined
85
- KbLeftShift = :implementation_defined
86
- KbNumpad0 = :implementation_defined
87
- KbNumpad1 = :implementation_defined
88
- KbNumpad2 = :implementation_defined
89
- KbNumpad3 = :implementation_defined
90
- KbNumpad4 = :implementation_defined
91
- KbNumpad5 = :implementation_defined
92
- KbNumpad6 = :implementation_defined
93
- KbNumpad7 = :implementation_defined
94
- KbNumpad8 = :implementation_defined
95
- KbNumpad9 = :implementation_defined
96
- KbNumpadAdd = :implementation_defined
97
- KbNumpadDivide = :implementation_defined
98
- KbNumpadMultiply = :implementation_defined
99
- KbNumpadSubtract = :implementation_defined
100
- KbPageDown = :implementation_defined
101
- KbPageUp = :implementation_defined
102
-
103
- ##
104
- # This is the key above the right shift key.
105
- KbReturn = :implementation_defined
106
-
107
- KbRight = :implementation_defined
108
- KbRightAlt = :implementation_defined
109
- KbRightControl = :implementation_defined
110
- KbRightShift = :implementation_defined
111
- KbSpace = :implementation_defined
112
- KbTab = :implementation_defined
113
- KbUp = :implementation_defined
114
- KbBacktick = :implementation_defined
115
- KbMinus = :implementation_defined
116
- KbEqual = :implementation_defined
117
- KbBracketLeft = :implementation_defined
118
- KbBracketRight = :implementation_defined
119
- KbBackslash = :implementation_defined
120
- KbSemicolon = :implementation_defined
121
- KbApostrophe = :implementation_defined
122
- KbComma = :implementation_defined
123
- KbPeriod = :implementation_defined
124
- KbSlash = :implementation_defined
125
-
126
- MsLeft = :implementation_defined
127
- MsMiddle = :implementation_defined
128
- MsRight = :implementation_defined
129
- MsWheelDown = :implementation_defined
130
- MsWheelUp = :implementation_defined
131
- MsOther0 = :implementation_defined
132
- MsOther1 = :implementation_defined
133
- MsOther2 = :implementation_defined
134
- MsOther3 = :implementation_defined
135
- MsOther4 = :implementation_defined
136
- MsOther5 = :implementation_defined
137
- MsOther6 = :implementation_defined
138
- MsOther7 = :implementation_defined
139
-
140
- GpButton0 = :implementation_defined
141
- GpButton1 = :implementation_defined
142
- GpButton10 = :implementation_defined
143
- GpButton11 = :implementation_defined
144
- GpButton12 = :implementation_defined
145
- GpButton13 = :implementation_defined
146
- GpButton14 = :implementation_defined
147
- GpButton15 = :implementation_defined
148
- GpButton2 = :implementation_defined
149
- GpButton3 = :implementation_defined
150
- GpButton4 = :implementation_defined
151
- GpButton5 = :implementation_defined
152
- GpButton6 = :implementation_defined
153
- GpButton7 = :implementation_defined
154
- GpButton8 = :implementation_defined
155
- GpButton9 = :implementation_defined
156
- GpDown = :implementation_defined
157
- GpLeft = :implementation_defined
158
- GpRight = :implementation_defined
159
- GpUp = :implementation_defined
160
- Gp0Button0 = :implementation_defined
161
- Gp0Button1 = :implementation_defined
162
- Gp0Button10 = :implementation_defined
163
- Gp0Button11 = :implementation_defined
164
- Gp0Button12 = :implementation_defined
165
- Gp0Button13 = :implementation_defined
166
- Gp0Button14 = :implementation_defined
167
- Gp0Button15 = :implementation_defined
168
- Gp0Button2 = :implementation_defined
169
- Gp0Button3 = :implementation_defined
170
- Gp0Button4 = :implementation_defined
171
- Gp0Button5 = :implementation_defined
172
- Gp0Button6 = :implementation_defined
173
- Gp0Button7 = :implementation_defined
174
- Gp0Button8 = :implementation_defined
175
- Gp0Button9 = :implementation_defined
176
- Gp0Down = :implementation_defined
177
- Gp0Left = :implementation_defined
178
- Gp0Right = :implementation_defined
179
- Gp0Up = :implementation_defined
180
- Gp1Button0 = :implementation_defined
181
- Gp1Button1 = :implementation_defined
182
- Gp1Button10 = :implementation_defined
183
- Gp1Button11 = :implementation_defined
184
- Gp1Button12 = :implementation_defined
185
- Gp1Button13 = :implementation_defined
186
- Gp1Button14 = :implementation_defined
187
- Gp1Button15 = :implementation_defined
188
- Gp1Button2 = :implementation_defined
189
- Gp1Button3 = :implementation_defined
190
- Gp1Button4 = :implementation_defined
191
- Gp1Button5 = :implementation_defined
192
- Gp1Button6 = :implementation_defined
193
- Gp1Button7 = :implementation_defined
194
- Gp1Button8 = :implementation_defined
195
- Gp1Button9 = :implementation_defined
196
- Gp1Down = :implementation_defined
197
- Gp1Left = :implementation_defined
198
- Gp1Right = :implementation_defined
199
- Gp1Up = :implementation_defined
200
- Gp2Button0 = :implementation_defined
201
- Gp2Button1 = :implementation_defined
202
- Gp2Button10 = :implementation_defined
203
- Gp2Button11 = :implementation_defined
204
- Gp2Button12 = :implementation_defined
205
- Gp2Button13 = :implementation_defined
206
- Gp2Button14 = :implementation_defined
207
- Gp2Button15 = :implementation_defined
208
- Gp2Button2 = :implementation_defined
209
- Gp2Button3 = :implementation_defined
210
- Gp2Button4 = :implementation_defined
211
- Gp2Button5 = :implementation_defined
212
- Gp2Button6 = :implementation_defined
213
- Gp2Button7 = :implementation_defined
214
- Gp2Button8 = :implementation_defined
215
- Gp2Button9 = :implementation_defined
216
- Gp2Down = :implementation_defined
217
- Gp2Left = :implementation_defined
218
- Gp2Right = :implementation_defined
219
- Gp2Up = :implementation_defined
220
- Gp3Button0 = :implementation_defined
221
- Gp3Button1 = :implementation_defined
222
- Gp3Button10 = :implementation_defined
223
- Gp3Button11 = :implementation_defined
224
- Gp3Button12 = :implementation_defined
225
- Gp3Button13 = :implementation_defined
226
- Gp3Button14 = :implementation_defined
227
- Gp3Button15 = :implementation_defined
228
- Gp3Button2 = :implementation_defined
229
- Gp3Button3 = :implementation_defined
230
- Gp3Button4 = :implementation_defined
231
- Gp3Button5 = :implementation_defined
232
- Gp3Button6 = :implementation_defined
233
- Gp3Button7 = :implementation_defined
234
- Gp3Button8 = :implementation_defined
235
- Gp3Button9 = :implementation_defined
236
- Gp3Down = :implementation_defined
237
- Gp3Left = :implementation_defined
238
- Gp3Right = :implementation_defined
239
- Gp3Up = :implementation_defined
240
-
241
- ##
242
- # Represents an ARGB color value with 8 bits for each channel. Colors can be used interchangeably with integer literals of the form 0xAARRGGBB in all Gosu APIs.
243
- class Color
244
- ##
245
- # @return [Fixnum] the color's alpha channel.
246
- attr_accessor :alpha
247
-
248
- ##
249
- # @return [Fixnum] the color's red channel.
250
- attr_accessor :red
251
-
252
- ##
253
- # @return [Fixnum] the color's green channel.
254
- attr_accessor :green
255
-
256
- ##
257
- # @return [Fixnum] the color's blue channel.
258
- attr_accessor :blue
259
-
260
- ##
261
- # @return [Fixnum] the color's hue in the range (0...360).
262
- attr_accessor :hue
263
-
264
- ##
265
- # @return [Float] the color's saturation in the range (0..1).
266
- attr_accessor :saturation
267
-
268
- ##
269
- # @return [Float] the color's value in the range (0..1).
270
- attr_accessor :value
271
-
272
- # @!group Creating colors.
273
-
274
- ##
275
- # @overload initialize(argb)
276
- # @param argb [Fixnum] an integer of the form 0xAARRGGBB.
277
- #
278
- # @overload initialize(a, r, g, b)
279
- # @param a [Fixnum] the color's alpha channel in the range (0..255).
280
- # @param r [Fixnum] the color's red channel in the range (0..255).
281
- # @param g [Fixnum] the color's green channel in the range (0..255).
282
- # @param b [Fixnum] the color's blue channel in the range (0..255).
283
- #
284
- # @see from_hsv
285
- # @see from_ahsv
286
- # @see rgba
287
- # @see argb
288
- def initialize(*args); end
289
-
290
- ##
291
- # @return (see #initialize)
292
- #
293
- # @overload rgba(rgba)
294
- # @param argb [Fixnum] an integer of the form 0xRRGGBBAA.
295
- #
296
- # @overload rgba(r, g, b, a)
297
- # @param r [Fixnum] the color's red channel in the range (0..255).
298
- # @param g [Fixnum] the color's green channel in the range (0..255).
299
- # @param b [Fixnum] the color's blue channel in the range (0..255).
300
- # @param a [Fixnum] the color's alpha channel in the range (0..255).
301
- #
302
- # @see #initialize
303
- # @see argb
304
- def self.rgba(*args); end
305
-
306
- # This method is equivalent to calling `Color.new`, but the name makes the parameter order explicit.
307
- #
308
- # @return (see #initialize)
309
- # @overload argb(argb)
310
- # @overload argb(a, r, g, b)
311
- #
312
- # @see #initialize
313
- # @see rgba
314
- def self.argb(*args); end
315
-
316
- # Converts an HSV triplet to an opaque color.
317
- #
318
- # @return [Color] a color corresponding to the HSV triplet.
319
- # @param h [Fixnum] the color's hue in the range (0..360).
320
- # @param s [Float] the color's saturation in the range (0..1).
321
- # @param v [Float] the color's value in the range (0..1).
322
- #
323
- # @see from_ahsv
324
- def self.from_hsv(h, s, v); end
325
-
326
- # Converts an HSV triplet to a color with the alpha channel set to a given value.
327
- #
328
- # @return (see from_hsv)
329
- # @param a [Fixnum] the color's opacity in the range (0..255).
330
- # @param (see from_hsv)
331
- #
332
- # @see from_hsv
333
- def self.from_ahsv(a, h, s, v); end
334
-
335
- # @!endgroup
336
-
337
- # Returns a 32-bit representation of the color suitable for use with OpenGL calls. This color is stored in a fixed order in memory and its integer value may vary depending on your system's byte order.
338
- #
339
- # @return [Fixnum] a 32-bit OpenGL color.
340
- def gl; end
341
-
342
- ##
343
- # @return [Color] a copy of the color.
344
- def dup; end
345
-
346
- NONE = Gosu::Color.argb(0x00000000)
347
- BLACK = Gosu::Color.argb(0xff000000)
348
- GRAY = Gosu::Color.argb(0xff808080)
349
- WHITE = Gosu::Color.argb(0xffffffff)
350
- AQUA = Gosu::Color.argb(0xff00ffff)
351
- RED = Gosu::Color.argb(0xffff0000)
352
- GREEN = Gosu::Color.argb(0xff00ff00)
353
- BLUE = Gosu::Color.argb(0xff0000ff)
354
- YELLOW = Gosu::Color.argb(0xffffff00)
355
- FUCHSIA = Gosu::Color.argb(0xffff00ff)
356
- CYAN = Gosu::Color.argb(0xff00ffff)
357
- end
358
-
359
- ##
360
- # A font can be used to draw text on a Window object very flexibly.
361
- # Fonts are ideal for small texts that change regularly. For large,
362
- # static texts you should use {Gosu::Image#from_text}.
363
- class Font
364
- ##
365
- # The font's name. This may be the name of a system font or a filename.
366
- #
367
- # @return [String] the font's name.
368
- attr_reader :name
369
-
370
- ##
371
- # @return [Fixnum] The font's height in pixels.
372
- attr_reader :height
373
-
374
- ##
375
- # Load a font from the system fonts or a file.
376
- #
377
- # @param window [Gosu::Window]
378
- # @param font_name [String] the name of a system font, or a path to a TrueType Font (TTF) file. A path must contain at least one '/' character to distinguish it from a system font.
379
- # @param height [Fixnum] the height of the font, in pixels.
380
- def initialize(window, font_name, height); end
381
-
382
- ##
383
- # Overrides the image for a character.
384
- #
385
- # @note For any given character, this method MUST NOT be called more than once, and MUST NOT be called if a string containing the character has already been drawn.
386
- #
387
- # @return [void]
388
- # @param character [String] the character to replace.
389
- # @param image [Image] the image to use for the character.
390
- def []=(character, image); end
391
-
392
- # @!group Drawing text
393
-
394
- ##
395
- # Draws a single line of text with its top left corner at (x, y).
396
- #
397
- # @return [void]
398
- # @param text [String]
399
- # @param x [Number] the X coordinate
400
- # @param y [Number] the Y coordinate
401
- # @param z [Number] the Z-order.
402
- # @param factor_x [Float] the horizontal scaling factor.
403
- # @param factor_y [Float] the vertical scaling factor.
404
- # @param color [Color, Fixnum]
405
- # @param mode [:default, :additive] the blending mode to use.
406
- #
407
- # @see #draw_rel
408
- # @see Gosu::Image.from_text
409
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
410
- # @see file:reference/Z-Ordering.md
411
- def draw(text, x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
412
-
413
- ##
414
- # Draws a single line of text relative to (x, y).
415
- #
416
- # The text is aligned to the drawing location according to the `rel_x` and `rel_y` parameters: a value of 0.0 corresponds to top and left, while 1.0 corresponds to bottom and right. A value of 0.5 naturally corresponds to the center of the text.
417
- #
418
- # All real numbers are valid alignment values and will be interpolated (or extrapolated) accordingly.
419
- #
420
- # @return [void]
421
- # @param rel_x [Float] the horizontal alignment.
422
- # @param rel_y [Float] the vertical alignment.
423
- # @param (see #draw)
424
- #
425
- # @see #draw
426
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
427
- # @see file:reference/Z-Ordering.md
428
- def draw_rel(text, x, y, z, rel_x, rel_y, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
429
-
430
- ##
431
- # @deprecated Use {#draw} in conjunction with {Window#rotate} instead.
432
- #
433
- # @see #draw
434
- # @see Gosu::Window#rotate
435
- def draw_rot(text, x, y, z, angle, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
436
-
437
- # @!endgroup
438
-
439
- ##
440
- # Returns the width of a single line of text, in pixels, if it were drawn.
441
- #
442
- # @return [Fixnum] the width of the text, in pixels.
443
- # @param text [String]
444
- def text_width(text, factor_x=1); end
445
- end
446
-
447
- ##
448
- # Provides functionality for drawing rectangular images.
449
- class Image
450
- ##
451
- # @return [Fixnum] the image's width, in pixels.
452
- attr_reader :width
453
-
454
- ##
455
- # @return [Fixnum] the image's height, in pixels.
456
- attr_reader :height
457
-
458
- # @!group Creating and loading images
459
-
460
- ##
461
- # Loads an image from a file or an RMagick image.
462
- #
463
- # @note For Windows Bitmap (BMP) images, magenta (FF00FF, often called "magic pink" in this context) is treated as a chroma key and all pixels of that color are automatically rendered fully transparent.
464
- #
465
- # @param window [Window]
466
- # @param source [String, Magick::Image] the filename or RMagick image to load from.
467
- # @param tileable [true, false]
468
- # @param left [Fixnum]
469
- # @param top [Fixnum]
470
- # @param width [Fixnum]
471
- # @param height [Fixnum]
472
- #
473
- # @overload initialize(window, source, tileable)
474
- # @overload initialize(window, source, tileable, left, top, width, height)
475
- # Loads a rectangular slice of the image.
476
- #
477
- # If you need to load multiple tiles from a texture atlas, {load_tiles} is almost always a better choice.
478
- #
479
- #
480
- # @see load_tiles
481
- # @see from_text
482
- # @see file:reference/Tileability.md
483
- def initialize(window, source, tileable, left, top, width, height); end
484
-
485
- ##
486
- # Creates a reusable image from one or more lines of text.
487
- #
488
- # The text is always rendered in white. To draw it in a different color, use the `color` parameter of {#draw}, et al.
489
- #
490
- # @overload from_text(window, text, font_name, font_height)
491
- # @overload from_text(window, text, font_name, font_height, line_spacing, width, align)
492
- #
493
- # @return [Gosu::Image]
494
- # @param window [Gosu::Window]
495
- # @param text [String]
496
- # @param font_name [String] the name of a system font, or a path to a TrueType Font (TTF) file. A path must contain at least one '/' character to distinguish it from a system font.
497
- # @param font_height [Fixnum] the height of the font, in pixels.
498
- # @param line_spacing [Fixnum] the vertical spacing beteen lines.
499
- # @param width [Fixnum] the width of the image, in pixels. Long lines will be automatically wrapped around to avoid overflow, but overlong words will be truncated.
500
- # @param align [:left, :right, :center, :justify] the text alignment.
501
- #
502
- # @see Gosu::Font
503
- def self.from_text(window, text, font_name, font_height, line_spacing, width, align); end
504
-
505
- ##
506
- # Loads an image from a file or an RMagick image, then divides the image into an array of equal-sized tiles.
507
- #
508
- # @note For Windows Bitmap (BMP) images, magenta (FF00FF, often called "magic pink" in this context) is treated as a chroma key and all pixels of that color are automatically rendered fully transparent.
509
- #
510
- # @return [Array<Gosu::Image>]
511
- # @param window [Window]
512
- # @param source [String, Magick::Image]
513
- # @param tile_width [Fixnum] If positive, this is the width of the individual tiles; if negative, the image is divided into -tile_width columns.
514
- # @param tile_height [Fixnum] If positive, this is the height of the individual tiles; if negative, the image is divided into -tile_height rows.
515
- # @param tileable [true, false]
516
- #
517
- # @see file:reference/Tileability.md
518
- def self.load_tiles(window, source, tile_width, tile_height, tileable); end
519
-
520
- # @!endgroup
521
-
522
- # @!group Drawing an image
523
-
524
- ##
525
- # Draws the image with its top left corner at (x, y).
526
- #
527
- # @return [void]
528
- # @param x [Float] the X coordinate.
529
- # @param y [Float] the X coordinate.
530
- # @param z [Float] the Z-order.
531
- # @param factor_x [Float] the horizontal scaling factor.
532
- # @param factor_y [Float] the vertical scaling factor.
533
- # @param color [Gosu::Color, Integer]
534
- # @param mode [:default, :additive] the blending mode to use.
535
- #
536
- # @see #draw_rot
537
- # @see #draw_as_quad
538
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
539
- # @see file:reference/Z-Ordering.md
540
- def draw(x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
541
-
542
- ##
543
- # Draws the image rotated, with its rotational center at (x, y).
544
- #
545
- # @return [void]
546
- # @param angle [Float]
547
- # @param center_x [Float] the relative horizontal rotation origin.
548
- # @param center_y [Float] the relative vertical rotation origin.
549
- # @param (see #draw)
550
- #
551
- # @see #draw
552
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
553
- # @see file:reference/Z-Ordering.md
554
- def draw_rot(x, y, z, angle, center_x=0.5, center_y=0.5, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
555
-
556
- ##
557
- # Draws the image as an arbitrary quad. This method can be used for advanced non-rectangular drawing techniques, e.g., faking perspective or isometric projection.
558
- #
559
- # @return [void]
560
- # @param (see Gosu::Window#draw_quad)
561
- #
562
- # @see #draw
563
- # @see Gosu::Window#draw_quad
564
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
565
- # @see file:reference/Order_of_Corners.md Order of Corners
566
- # @see file:reference/Z-Ordering.md
567
- def draw_as_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode=:default); end
568
-
569
- # @!endgroup
570
-
571
- ##
572
- # Returns an object that holds information about the underlying OpenGL texture and UV coordinates of the image.
573
- #
574
- # @note Some images may be too large to fit on a single texture; this method returns nil in those cases.
575
- #
576
- # @return [Gosu::GLTexInfo?] information about the underlying OpenGL texture.
577
- #
578
- # @see Gosu::GLTexInfo
579
- # @see file:examples/OpenGLIntegration.rb
580
- def gl_tex_info; end
581
-
582
- ##
583
- # Returns the associated texture contents as binary string of packed RGBA values, useful for use with RMagick (Magick::Image.from_blob).
584
- #
585
- # @return [String] a binary string of packed RGBA values.
586
- def to_blob; end
587
-
588
- ##
589
- # Overwrites part of the image with the contents of another. If the source image is partially out of bounds, it will be clipped to fit.
590
- #
591
- # This can be used to e.g. overwrite parts of a landscape.
592
- #
593
- # @return [void]
594
- # @param source [String, Magick::Image] the filename or RMagick image to load from.
595
- # @param x [Fixnum] the X coordinate of the top left corner.
596
- # @param y [Fixnum] the Y coordinate of the top left corner.
597
- def insert(source, x, y); end
598
-
599
- ##
600
- # Saves the image to a file. The file format is determined from the file extension.
601
- #
602
- # Useful for, e.g., pre-rendering text on a development machine where the necessary fonts are known to be available.
603
- #
604
- # @return [void]
605
- # @param filename [String] the path to save the file under.
606
- def save(filename); end
607
- end
608
-
609
- ##
610
- # A sample is a short sound that is completely loaded in memory, can be
611
- # played multiple times at once and offers very flexible playback
612
- # parameters. Use samples for everything that's not music.
613
- #
614
- # @see Gosu::Song
615
- class Sample
616
- ##
617
- # Loads a sample from a file.
618
- #
619
- # @param window [Gosu::Window]
620
- # @param filename [String] the path to load the sample from.
621
- def initialize(window, filename); end
622
-
623
- ##
624
- # Plays the sample without panning.
625
- #
626
- # Playback speed is limited only by the underlying audio library, and both very large and very small values should work just fine.
627
- #
628
- # @return [SampleInstance]
629
- # @param volume [Float] the playback volume, in the range (0..1), where 0 is completely silent and 1 is full volume.
630
- # @param speed [Float] the playback speed.
631
- # @param looping [true, false] whether the sample should play in a loop.
632
- #
633
- # @see #play_pan
634
- def play(volume=1, speed=1, looping=false); end
635
-
636
- ##
637
- # Plays the sample with panning.
638
- #
639
- # @note Samples played with this method will not be as loud as those played with {#play}, even if `pan` is 0. This is due to a limitation in the way panning works.
640
- #
641
- # @return [SampleInstance]
642
- # @param pan [Float] the amount of panning. 0 is centered.
643
- # @param (see #play)
644
- #
645
- # @see #play
646
- def play_pan(pan=0, volume=1, speed=1, looping=false); end
647
- end
648
-
649
- ##
650
- # An instance of a {Gosu::Sample} playing. Can be used to stop sounds dynamically, or to check if they are finished.
651
- #
652
- # It is recommended to throw away sample instances as soon as possible, as holding onto them for a long time can prevent unneeded samples being properly disposed.
653
- class SampleInstance
654
- attr_writer :volume
655
- attr_writer :speed
656
- attr_writer :pan
657
-
658
- ##
659
- # Stops playback of this sample instance. After calling this method, the sample instance is useless and can be discarded.
660
- #
661
- # Calling `stop` after the sample has finished is harmless and has no effect.
662
- #
663
- # @return [void]
664
- def stop; end
665
-
666
- ##
667
- # Pauses the sample, to be resumed afterwards.
668
- #
669
- # @note The sample will still occupy a playback channel while paused.
670
- #
671
- # @return [void]
672
- def pause; end
673
-
674
- ##
675
- # Resumes playback of the sample.
676
- #
677
- # @return [void]
678
- def resume; end
679
-
680
- ##
681
- # @return [true, false] whether the sample is paused.
682
- def paused?; end
683
-
684
- ##
685
- # @return [true, false] whether the sample is playing.
686
- def playing?; end
687
- end
688
-
689
- ##
690
- # Songs are less flexible than samples in that only one can be played at a time, with no panning or speed control.
691
- #
692
- # @see Gosu::Sample
693
- class Song
694
- class <<Song
695
- ##
696
- # Returns the song currently being played (even if it's paused), or nil if no song is playing.
697
- #
698
- # @return [Gosu::Song?] the currently playing song.
699
- attr_reader :current_song
700
- end
701
-
702
- ##
703
- # @return [Float] the song's playback volume.
704
- attr_accessor :volume
705
-
706
- ##
707
- # Loads a song from a file.
708
- #
709
- # @param window [Gosu::Window]
710
- # @param filename [String] the path to load the song from.
711
- def initialize(window, filename); end
712
-
713
- ##
714
- # Starts or resumes playback of the song.
715
- #
716
- # If another song is currently playing, it will be stopped and this song will be set as the current song.
717
- #
718
- # If `looping` is false, the current song will be set to `nil` when this song finishes.
719
- #
720
- # @return [void]
721
- # @param looping [true, false] whether the song should play in a loop.
722
- def play(looping=false); end
723
-
724
- ##
725
- # Pauses playback of the song. The current song is unchanged.
726
- #
727
- # @return [void]
728
- def pause; end
729
-
730
- # Returns true if this song is the current song and playback is paused.
731
- #
732
- # @return [true, false] whether the song is paused.
733
- def paused?; end
734
-
735
- ##
736
- # Stops playback if this song is the current song. The current song is set to `nil`.
737
- #
738
- # @return [void]
739
- def stop; end
740
-
741
- ##
742
- # @return [true, false] whether the song is playing.
743
- def playing?; end
744
- end
745
-
746
- ##
747
- # A TextInput is an invisible object that handles input using the operating system's input manager.
748
- #
749
- # At its most basic, you only need to set {Gosu::Window#text_input} to an instance of this class. The TextInput will then handle all keyboard input until {Gosu::Window#text_input} is set to `nil`. Any text the user has typed is available through {#text}.
750
- #
751
- # This class is purely back-end and does not come with a GUI; drawing the input field is up to you, the programmer. The best way to do that is left completely open. TextInput only aims to provide a foundation for you to build your own GUI.
752
- #
753
- # @see Gosu::Window#text_input
754
- # @see file:examples/TextInput.rb
755
- class TextInput
756
- ##
757
- # @return [String] the text that the user has typed.
758
- attr_accessor :text
759
-
760
- ##
761
- # @return [Fixnum] the position of the editing caret.
762
- attr_accessor :caret_pos
763
-
764
- ##
765
- # @return [Fixnum] the starting position of the currently selected text.
766
- attr_accessor :selection_start
767
-
768
- ##
769
- # This method is an overridable filter that is applied to all newly entered text. This allows for restricting input characters or format, automatic macro or abbreviation expansion and so on.
770
- #
771
- # The return value of this method will be inserted at the current caret position.
772
- #
773
- # The default implementation returns its argument unchanged.
774
- #
775
- # @return [String] the string to be inserted.
776
- # @param text_in [String] the text typed by the user.
777
- #
778
- # @example Forcing input to all uppercase, alphanumeric characters.
779
- # input = TextInput.new
780
- # def input.filter(text_in)
781
- # text_in.upcase.gsub(/[^A-Z0-9]/, '')
782
- # end
783
- def filter text_in
784
- text_in
785
- end
786
- end
787
-
788
- ##
789
- # Main class that serves as the foundation of a standard
790
- # Gosu application. Manages initialization of all of Gosu's core components
791
- # and provides timing functionality.
792
- #
793
- # Note that all coordinates, even the mouse position, are in client
794
- # coordinates relative to the window. This means that the mouse position
795
- # can be negative or larger than the window size.
796
- #
797
- # @note There should really only be one instance of this class at a time. This may or may not change later, but for right now, having two or more windows and loading samples or songs on both of them will result in an exception.
798
- class Window
799
- ##
800
- # @return [String] the window's caption, usually dispalyed in the title bar.
801
- attr_accessor :caption
802
-
803
- ##
804
- # @return [Fixnum] the mouse pointer's window-based X coordinate.
805
- attr_accessor :mouse_x
806
-
807
- ##
808
- # @return [Fixnum] the mouse pointer's window-based Y coordinate.
809
- attr_accessor :mouse_y
810
-
811
- ##
812
- # The currently active {TextInput}. If not nil, all keyboard input will be handled by this object.
813
- #
814
- # @return [TextInput?] the currently active text input.
815
- attr_accessor :text_input
816
-
817
- ##
818
- # The window's width, in pixels. This only counts the drawable area and does not include any borders or decorations added by the window manager.
819
- #
820
- # @return [Fixnum] the window's width, in pixels.
821
- attr_reader :width
822
-
823
- ##
824
- # The window's height, in pixels. This only counts the drawable area and does not include any borders or decorations added by the window manager.
825
- #
826
- # @return [Fixnum] the window's height, in pixels.
827
- attr_reader :height
828
-
829
- ##
830
- # @return [true, false] whether this is a full-screen window.
831
- attr_reader :fullscreen?
832
-
833
- ##
834
- # @return [Float] the interval between calls to {#update}, in milliseconds.
835
- attr_reader :update_interval
836
-
837
- ##
838
- # Creates a new window with the requested size.
839
- #
840
- # @note The actual window may be smaller if the requested size is too large for the current display resolution; in that case, Gosu will automatically scale all coordinates to transparently emulate a larger window. No need to thank us.
841
- #
842
- # @param width [Fixnum] the desired window width.
843
- # @param height [Fixnum] the desired window height.
844
- # @param fullscreen [true, false] whether to create a full-screen window.
845
- # @param update_interval [Float] the interval between calls to {#update}, in milliseconsd. For the default value of 16.666666, the game will attempt to run at approximately 60 FPS, which is ideal on standard 60 Hz TFT screens.
846
- def initialize(width, height, fullscreen, update_interval=16.666666); end
847
-
848
- ##
849
- # Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.
850
- #
851
- # @return [void]
852
- def show; end
853
-
854
- ##
855
- # Tells the window to end the current run loop as soon as possible. Calling this method will not prevent execution of lines after it.
856
- #
857
- # @return [void]
858
- def close; end
859
-
860
- # @!group Callbacks
861
-
862
- ##
863
- # This method is called once every {#update_interval} milliseconds while the window is being shown. Your application's main logic should go here.
864
- #
865
- # @return [void]
866
- def update; end
867
-
868
- ##
869
- # This method is called after every update and whenever the OS wants the window to repaint itself. Your application's rendering code should go here.
870
- #
871
- # @return [void]
872
- #
873
- # @see #needs_redraw?
874
- def draw; end
875
-
876
- ##
877
- # This method can be overriden to give the game a chance to opt out of a call to {#draw}; however, the operating system can still force a redraw for any reason.
878
- #
879
- # @return [true, false] whether the window needs to be redrawn.
880
- #
881
- # @see #draw
882
- def needs_redraw?; end
883
-
884
- ##
885
- # This method can be overriden to control the visibility of the system cursor over your window, e.g., for level editors or other situations where introducing a custom cursor or hiding the default one is not desired.
886
- #
887
- # @return [true, false] whether the system cursor should be shown.
888
- def needs_cursor?; end
889
-
890
- ##
891
- # This method is called before {#update} if a button was pressed while the window had focus.
892
- #
893
- # @return [void]
894
- # @param id [Fixnum] the button's platform-defined id.
895
- #
896
- # @see #button_up
897
- # @see #button_down?
898
- def button_down(id); end
899
-
900
- ##
901
- # This method is called before {#update} if a button was released while the window had focus.
902
- #
903
- # @return [void]
904
- # @param (see #button_down)
905
- #
906
- # @see #button_down
907
- # @see #button_down?
908
- def button_up(id); end
909
-
910
- # @!endgroup
911
-
912
- ##
913
- # Returns whether the button `id` is currently pressed. Button states are updated once per tick, so repeated calls during the same tick will always yeild the same result.
914
- #
915
- # @return [true, false] whether the button is currently pressed.
916
- # @param (see #button_down)
917
- #
918
- # @see #button_down
919
- # @see #button_up
920
- def button_down?(id); end
921
-
922
- # @!group Drawing primitives
923
-
924
- ##
925
- # Draws a line from one point to another---inconsistently.
926
- #
927
- # @note OpenGL lines are not reliable at all and may have a missing pixel at the start or end point. Relying on your machine's behavior can only end in tears. Recommended for debugging purposes only.
928
- #
929
- # @return [void]
930
- # @param x1 [Float] the X coordinate of the start point.
931
- # @param y1 [Float] the Y coordinate of the start point.
932
- # @param c1 [Gosu::Color] the color of the start point.
933
- # @param x2 [Float] the X coordinate of the end point.
934
- # @param y2 [Float] the Y coordinate of the end point.
935
- # @param c2 [Gosu::Color] the color of the end point.
936
- # @param z [Float] the Z-order.
937
- # @param mode [:default, :additive] the blending mode to use.
938
- #
939
- # @see #draw_triangle
940
- # @see #draw_quad
941
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
942
- # @see file:reference/Z-Ordering.md
943
- def draw_line(x1, y1, c1, x2, y2, c2, z=0, mode=:default); end
944
-
945
- ##
946
- # Draws a triangle.
947
- #
948
- # @return [void]
949
- # @param x1 [Float] the X coordinate of the first vertex.
950
- # @param y1 [Float] the Y coordinate of the first vertex.
951
- # @param c1 [Gosu::Color] the color of the first vertex.
952
- # @param x2 [Float] the X coordinate of the second vertex.
953
- # @param y2 [Float] the Y coordinate of the second vertex.
954
- # @param c2 [Gosu::Color] the color of the second vertex.
955
- # @param x3 [Float] the X coordinate of the third vertex.
956
- # @param y3 [Float] the Y coordinate of the third vertex.
957
- # @param c3 [Gosu::Color] the color of the third vertex.
958
- # @param z [Float] the Z-order.
959
- # @param mode [:default, :additive] the blending mode to use.
960
- #
961
- # @see #draw_line
962
- # @see #draw_quad
963
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
964
- # @see file:reference/Z-Ordering.md
965
- def draw_triangle(x1, y1, c1, x2, y2, c2, x3, y3, c3, z=0, mode=:default); end
966
-
967
- ##
968
- # Draws a quad (actually two triangles).
969
- #
970
- # @return [void]
971
- # @param x1 [Float] the X coordinate of the first vertex.
972
- # @param y1 [Float] the Y coordinate of the first vertex.
973
- # @param c1 [Gosu::Color] the color of the first vertex.
974
- # @param x2 [Float] the X coordinate of the second vertex.
975
- # @param y2 [Float] the Y coordinate of the second vertex.
976
- # @param c2 [Gosu::Color] the color of the second vertex.
977
- # @param x3 [Float] the X coordinate of the third vertex.
978
- # @param y3 [Float] the Y coordinate of the third vertex.
979
- # @param c3 [Gosu::Color] the color of the third vertex.
980
- # @param x4 [Float] the X coordinate of the fourth vertex.
981
- # @param y4 [Float] the Y coordinate of the fourth vertex.
982
- # @param c4 [Gosu::Color] the color of the fourth vertex.
983
- # @param z [Float] the Z-order.
984
- # @param mode [:default, :additive] the blending mode to use.
985
- #
986
- # @see #draw_line
987
- # @see #draw_triangle
988
- # @see file:reference/Drawing_with_Colors.md Drawing with Colors
989
- # @see file:reference/Order_of_Corners.md Order of Corners
990
- # @see file:reference/Z-Ordering.md
991
- def draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z=0, mode=:default); end
992
-
993
- # @!endgroup
994
- # @!group Manipulating the drawing context
995
-
996
- ##
997
- # Flushes all drawing operations to OpenGL so that Z-ordering can start anew. This is useful for drawing multiple layers that may not have knowledge of each other's Z-ordering, e.g., drawing a HUD on top of the game world or ensuring that a custom cursor is always drawn above everything else.
998
- #
999
- # @return [void]
1000
- def flush; end
1001
-
1002
- ##
1003
- # Runs the block in a clean OpenGL environment.
1004
- #
1005
- # If a Z-order is given, the block will be scheduled to run between Gosu drawing operations as normal; otherwise, all prior drawing operations will be flushed and the block will be executed immediately.
1006
- #
1007
- # @note Gosu does not provide access to the underlying OpenGL APIs. A gem like ruby-opengl is required to use custom OpenGL drawing code.
1008
- #
1009
- # @note Gosu rendering functions MUST NOT be used within the block, and {#gl} MUST be used only within the call tree of {#draw}.
1010
- #
1011
- # @return [void]
1012
- # @param z [Float] the Z-order.
1013
- # @yield OpenGL code.
1014
- #
1015
- # @see #draw
1016
- # @see file:reference/Z-Ordering
1017
- # @see file:examples/OpenGLIntegration.rb
1018
- def gl(z=nil); end
1019
-
1020
- ##
1021
- # Masks the drawing area inside the block.
1022
- #
1023
- # @return [void]
1024
- # @param x [Float] the X coordinate of the top left corner,.
1025
- # @param y [Float] the Y coordinate of the top left corner.
1026
- # @param w [Float] the width of the clipping area.
1027
- # @param h [Float] the height of the clipping area.
1028
- # @yield rendering code.
1029
- #
1030
- # @see #draw
1031
- def clip_to(x, y, w, h); end
1032
-
1033
- ##
1034
- # Records all drawing operatons inside the block as a reusable "image". This method can be used to speed rendering of multiple static images, e.g., a fixed tile map.
1035
- #
1036
- # @note Because the returned object is not a true image---it's implemented using vertex buffers and is not backed by a texture---there are restrictions on how it can be used.
1037
- #
1038
- # @note The width and height of the returned object will be the same values you passed to {#record}, regardless of the area you draw on. It is important to pass accurate values if you plan on using {Gosu::Image#draw_as_quad} or {Gosu::Image#draw_rot} with the result later.
1039
- #
1040
- # @return [Gosu::Image] the recorded drawing operations.
1041
- # @param width [Float] the width of the recorded image.
1042
- # @param height [Float] the height of the recorded image.
1043
- # @yield rendering code.
1044
- #
1045
- # @see #draw
1046
- # @see Gosu::Image
1047
- def record(width, height); end
1048
-
1049
- ##
1050
- # Rotates all drawing operatons inside the block.
1051
- #
1052
- # @return [void]
1053
- # @param angle [Float] the rotation angle.
1054
- # @param around_x [Float] the X coorinate of the rotation origin.
1055
- # @param around_y [Float] the Y coordinate of the rotation origin.
1056
- # @yield rendering code.
1057
- #
1058
- # @see #draw
1059
- # @see #scale
1060
- # @see #translate
1061
- # @see #transform
1062
- def rotate(angle, around_x=0, around_y=0); end
1063
-
1064
- ##
1065
- # Scales all drawing operations inside the block.
1066
- #
1067
- # @overload scale(factor_x, factor_y = factor_x) { ... }
1068
- # @overload scale(factor_x, factor_y, around_x, around_y) { ... }
1069
- #
1070
- # @return [void]
1071
- # @param factor_x [Float] the horizontal scaling factor.
1072
- # @param factor_y [Float] the vertical scaling factor.
1073
- # @param around_x [Float] the X coordinate of the scaling origin.
1074
- # @param around_y [Float] the Y coordinate of the scaling origin.
1075
- # @yield rendering code.
1076
- #
1077
- # @see #draw
1078
- # @see #rotate
1079
- # @see #translate
1080
- # @see #transform
1081
- def scale(factor_x, factor_y, around_x, around_y); end
1082
-
1083
- ##
1084
- # Offsets all drawing operations inside the block.
1085
- #
1086
- # @return [void]
1087
- # @param x [Float] the X offset.
1088
- # @param y [Float] the Y offset.
1089
- # @yield rendering code.
1090
- #
1091
- # @see #draw
1092
- # @see #rotate
1093
- # @see #scale
1094
- # @see #transform
1095
- def translate(x, y); end
1096
-
1097
- ##
1098
- # Applies a free-form matrix transformation to everything drawn in the block.
1099
- #
1100
- # @return [void]
1101
- # @param m0 [Float]
1102
- # @param m1 [Float]
1103
- # @param m2 [Float]
1104
- # @param m3 [Float]
1105
- # @param m4 [Float]
1106
- # @param m5 [Float]
1107
- # @param m6 [Float]
1108
- # @param m7 [Float]
1109
- # @param m8 [Float]
1110
- # @param m9 [Float]
1111
- # @param m10 [Float]
1112
- # @param m11 [Float]
1113
- # @param m12 [Float]
1114
- # @param m13 [Float]
1115
- # @param m14 [Float]
1116
- # @param m15 [Float]
1117
- # @yield rendering code.
1118
- #
1119
- # @see #draw
1120
- # @see #rotate
1121
- # @see #scale
1122
- # @see #translate
1123
- def transform(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15); end
1124
-
1125
- # @!endgroup
1126
-
1127
- ##
1128
- # Returns the character a button usually produces, if any.
1129
- #
1130
- # @note For real text input, look at {TextInput} instead.
1131
- #
1132
- # @return [String?] the character the button usually produces.
1133
- # @param id [Fixnum] the button's platform-defined id.
1134
- #
1135
- # @see char_to_button_id
1136
- # @see #text_input
1137
- # @see TextInput
1138
- def self.button_id_to_char(id); end
1139
-
1140
- ##
1141
- # Returns the button that usually produces a character, if any.
1142
- #
1143
- # @return [Fixnum?] the button that usually produces the character.
1144
- # @param char [String] the character to query.
1145
- #
1146
- # @see button_id_to_char
1147
- # @see #text_input
1148
- # @see TextInput
1149
- def self.char_to_button_id(char); end
1150
-
1151
- ##
1152
- # @deprecated Use {#mouse_x=} and {#mouse_y=} instead.
1153
- def set_mouse_position(x, y); end
1154
- end
1155
-
1156
- ##
1157
- # Holds information about the underlying OpenGL texture and UV coordinates of an image.
1158
- #
1159
- # Can be retrieved from some images to use them in OpenGL operations.
1160
- #
1161
- # @see Gosu::Image#gl_tex_info
1162
- # @see file:examples/OpenGLIntegration.rb
1163
- class GLTexInfo
1164
- ##
1165
- # @return [Fixnum] OpenGL texture id
1166
- attr_reader :tex_name
1167
-
1168
- ##
1169
- # @return [Float] the U coordinate of the left edge of the image.
1170
- attr_reader :left
1171
-
1172
- ##
1173
- # @return [Float] the U coordinate of the right edge of the image.
1174
- attr_reader :right
1175
-
1176
- ##
1177
- # @return [Float] the V coordinate of the top edge of the image.
1178
- attr_reader :top
1179
-
1180
- ##
1181
- # @return [Float] the V coordinate of the bottom edge of the image.
1182
- attr_reader :bottom
1183
- end
1184
-
1185
- class << self
1186
- ##
1187
- # @return [Float] a random number in the range (min...max).
1188
- # @param min [Float] the minimum value, inclusive.
1189
- # @param max [Float] the maximum value, exclusive.
1190
- def random(min, max); end
1191
-
1192
- ##
1193
- # @return [Float] the X component of a vector of angle theta and magnitude r, or the vertical distance covered by moving r pixels in the direction given by theta.
1194
- # @param theta [Float]
1195
- # @param r [Float]
1196
- def offset_x(theta, r); end
1197
-
1198
- ##
1199
- # @return [Float] the Y component of a vector of angle theta and magnitude r, or the vertical distance covered by moving r pixels in the direction given by theta.
1200
- # @param theta [Float]
1201
- # @param r [Float]
1202
- def offset_y(theta, r); end
1203
-
1204
- ##
1205
- # @return [Float] the angular distance from (x1, y1) to (x1, y2) in degrees, where 0.0 is up. Returns 0 if both points are equal.
1206
- # @param x1 [Float]
1207
- # @param y1 [Float]
1208
- # @param x2 [Float]
1209
- # @param y2 [Float]
1210
- def angle(x1, y1, x2, y2); end
1211
-
1212
- ##
1213
- # @return [Float] the shortest angular distance from angle1 to angle2. This can be negative if counter-clockwise rotation would yield a shorter distance.
1214
- # @param angle1 [Float]
1215
- # @param angle2 [Float]
1216
- def angle_diff(angle1, angle2); end
1217
-
1218
- ##
1219
- # @return [Float] the distance from (x1, y1) to (x2, y2).
1220
- # @param x1 [Float]
1221
- # @param y1 [Float]
1222
- # @param x2 [Float]
1223
- # @param y2 [Float]
1224
- def distance(x1, y1, x2, y2); end
1225
-
1226
- ##
1227
- # @note For long-running games, this counter will eventually wrap around to 0 again.
1228
- #
1229
- # @return [Fixnum] the number of milliseconds elapsed.
1230
- def milliseconds(); end
1231
-
1232
- ##
1233
- # @return [Fixnum] the current framerate, in frames per second.
1234
- def fps(); end
1235
-
1236
- # @return [String] the name of a neutral font that is available on the current platform.
1237
- #
1238
- # @see Gosu::Font
1239
- # @see Gosu::Image#from_text
1240
- def default_font_name(); end
1241
-
1242
- ##
1243
- # @return [Fixnum] the width, in pixels, of the user's primary screen.
1244
- def screen_width(); end
1245
-
1246
- # @return [Fixnum] the height, in pixels, of the user's primary screen.
1247
- def screen_height(); end
1248
-
1249
- ##
1250
- # Returns the language code for the user's preferred language. Expect return values such as 'en_US', 'de_DE.UTF-8', 'ja', 'zh-Hans', etc. You can rely only on the first two letters being a common language abbreviation.
1251
- #
1252
- # @return [String] the user's preferred language.
1253
- def language(); end
1254
- end
1255
- end
1256
-
1257
- ##
1258
- # Small additions to Numeric to make it easier to integrate Gosu with
1259
- # libraries that use radians, like Chipmunk.
1260
- class ::Numeric
1261
- ##
1262
- # Converts radians to a Gosu-compatible angle using the formula <tt>self * 180.0 / Math::PI + 90</tt>.
1263
- #
1264
- # @return [Float] degrees.
1265
- def radians_to_gosu(); end
1266
-
1267
- ##
1268
- # Converts a Gosu-compatible angle to radians using the formula <tt>(self - 90) * Math::PI / 180.0</tt>.
1269
- #
1270
- # @return [Float] radians.
1271
- def gosu_to_radians(); end
1272
-
1273
- ##
1274
- # Converts degrees to radians.
1275
- #
1276
- # @return [Float] radians.
1277
- def degrees_to_radians(); end
1278
-
1279
- ##
1280
- # Converts radians to degrees.
1281
- #
1282
- # @return [Float] degrees.
1283
- def radians_to_degrees(); end
1284
- end