gosu 0.7.13 → 0.7.13.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (312) hide show
  1. data/COPYING.txt +4 -2
  2. data/Gosu/Audio.hpp +8 -5
  3. data/Gosu/Font.hpp +5 -3
  4. data/Gosu/Gosu.hpp +6 -0
  5. data/Gosu/Graphics.hpp +6 -13
  6. data/Gosu/GraphicsBase.hpp +14 -3
  7. data/Gosu/IO.hpp +259 -255
  8. data/Gosu/Image.hpp +12 -12
  9. data/Gosu/ImageData.hpp +3 -0
  10. data/Gosu/Input.hpp +14 -2
  11. data/Gosu/Math.hpp +3 -2
  12. data/Gosu/RotFlip.hpp +125 -116
  13. data/Gosu/Sockets.hpp +139 -129
  14. data/Gosu/Text.hpp +4 -4
  15. data/Gosu/WinUtility.hpp +1 -1
  16. data/Gosu/Window.hpp +9 -5
  17. data/GosuImpl/Graphics/BitmapUtils.cpp +8 -8
  18. data/GosuImpl/Graphics/DrawOp.hpp +13 -14
  19. data/GosuImpl/Graphics/Graphics.cpp +3 -2
  20. data/GosuImpl/Graphics/Image.cpp +8 -8
  21. data/GosuImpl/Graphics/LargeImageData.cpp +8 -8
  22. data/GosuImpl/Graphics/Text.cpp +15 -3
  23. data/GosuImpl/{TextTTFWin.cpp → Graphics/TextTTFWin.cpp} +0 -0
  24. data/GosuImpl/Graphics/TextWin.cpp +36 -25
  25. data/GosuImpl/Graphics/Texture.cpp +2 -0
  26. data/GosuImpl/Iconv.hpp +1 -3
  27. data/GosuImpl/RubyGosu.swg +19 -10
  28. data/GosuImpl/RubyGosuStub.mm +40 -8
  29. data/GosuImpl/RubyGosu_SWIG_GC_PATCH.patch +126 -0
  30. data/GosuImpl/RubyGosu_wrap.cxx +1601 -247
  31. data/GosuImpl/RubyGosu_wrap.h +1 -1
  32. data/GosuImpl/WindowWin.cpp +18 -6
  33. data/README.txt +5 -5
  34. data/Rakefile +27 -7
  35. data/linux/Makefile.in +1 -1
  36. data/mac/Gosu.xcodeproj/jlnr.pbxuser +939 -350
  37. data/mac/Gosu.xcodeproj/jlnr.perspectivev3 +66 -61
  38. data/mac/Gosu.xcodeproj/project.pbxproj +474 -92
  39. data/mac/RubyGosu Template-Info.plist b/data/mac/RubyGosu → App-Info.plist +0 -0
  40. data/reference/cpp/_audio_8hpp-source.html +171 -0
  41. data/reference/cpp/_audio_8hpp.html +96 -0
  42. data/reference/cpp/_auto_link_8hpp-source.html +84 -0
  43. data/reference/cpp/_auto_link_8hpp.html +83 -0
  44. data/reference/cpp/_bitmap_8hpp-source.html +130 -0
  45. data/reference/cpp/_bitmap_8hpp.html +107 -0
  46. data/reference/{ButtonsMac_8hpp-source.html → cpp/_buttons_mac_8hpp-source.html} +60 -14
  47. data/reference/cpp/_buttons_mac_8hpp.html +233 -0
  48. data/reference/cpp/_color_8hpp-source.html +215 -0
  49. data/reference/cpp/_color_8hpp.html +119 -0
  50. data/reference/cpp/_directories_8hpp-source.html +88 -0
  51. data/reference/cpp/_directories_8hpp.html +96 -0
  52. data/reference/cpp/_font_8hpp-source.html +111 -0
  53. data/reference/cpp/_font_8hpp.html +87 -0
  54. data/reference/{Fwd_8hpp-source.html → cpp/_fwd_8hpp-source.html} +59 -13
  55. data/reference/cpp/_fwd_8hpp.html +83 -0
  56. data/reference/cpp/_gosu_8hpp-source.html +96 -0
  57. data/reference/cpp/_gosu_8hpp.html +83 -0
  58. data/reference/cpp/_graphics_8hpp-source.html +134 -0
  59. data/reference/cpp/_graphics_8hpp.html +94 -0
  60. data/reference/cpp/_graphics_base_8hpp-source.html +115 -0
  61. data/reference/cpp/_graphics_base_8hpp.html +120 -0
  62. data/reference/cpp/_i_o_8hpp-source.html +301 -0
  63. data/reference/cpp/_i_o_8hpp.html +122 -0
  64. data/reference/cpp/_image_8hpp-source.html +172 -0
  65. data/reference/cpp/_image_8hpp.html +96 -0
  66. data/reference/cpp/_image_data_8hpp-source.html +108 -0
  67. data/reference/cpp/_image_data_8hpp.html +90 -0
  68. data/reference/cpp/_input_8hpp-source.html +182 -0
  69. data/reference/cpp/_input_8hpp.html +102 -0
  70. data/reference/cpp/_math_8hpp-source.html +147 -0
  71. data/reference/cpp/_math_8hpp.html +139 -0
  72. data/reference/{Platform_8hpp-source.html → cpp/_platform_8hpp-source.html} +61 -15
  73. data/reference/cpp/_platform_8hpp.html +136 -0
  74. data/reference/cpp/_rot_flip_8hpp-source.html +184 -0
  75. data/reference/cpp/_rot_flip_8hpp.html +123 -0
  76. data/reference/cpp/_sockets_8hpp-source.html +174 -0
  77. data/reference/cpp/_sockets_8hpp.html +117 -0
  78. data/reference/cpp/_text_8hpp-source.html +102 -0
  79. data/reference/cpp/_text_8hpp.html +99 -0
  80. data/reference/cpp/_text_input_8hpp-source.html +110 -0
  81. data/reference/cpp/_text_input_8hpp.html +87 -0
  82. data/reference/cpp/_timing_8hpp-source.html +82 -0
  83. data/reference/cpp/_timing_8hpp.html +90 -0
  84. data/reference/cpp/_utility_8hpp-source.html +89 -0
  85. data/reference/cpp/_utility_8hpp.html +96 -0
  86. data/reference/cpp/_win_utility_8hpp-source.html +125 -0
  87. data/reference/cpp/_win_utility_8hpp.html +116 -0
  88. data/reference/cpp/_window_8hpp-source.html +157 -0
  89. data/reference/cpp/_window_8hpp.html +87 -0
  90. data/reference/cpp/annotated.html +98 -0
  91. data/reference/cpp/class_gosu_1_1_audio-members.html +74 -0
  92. data/reference/cpp/class_gosu_1_1_audio.html +132 -0
  93. data/reference/cpp/class_gosu_1_1_bitmap-members.html +85 -0
  94. data/reference/cpp/class_gosu_1_1_bitmap.html +501 -0
  95. data/reference/cpp/class_gosu_1_1_buffer-members.html +84 -0
  96. data/reference/cpp/class_gosu_1_1_buffer.html +346 -0
  97. data/reference/{classGosu_1_1Buffer.png → cpp/class_gosu_1_1_buffer.png} +0 -0
  98. data/reference/cpp/class_gosu_1_1_button-members.html +76 -0
  99. data/reference/cpp/class_gosu_1_1_button.html +195 -0
  100. data/reference/cpp/class_gosu_1_1_color-members.html +96 -0
  101. data/reference/cpp/class_gosu_1_1_color.html +758 -0
  102. data/reference/cpp/class_gosu_1_1_comm_socket-members.html +90 -0
  103. data/reference/cpp/class_gosu_1_1_comm_socket.html +505 -0
  104. data/reference/cpp/class_gosu_1_1_file-members.html +81 -0
  105. data/reference/cpp/class_gosu_1_1_file.html +275 -0
  106. data/reference/{classGosu_1_1File.png → cpp/class_gosu_1_1_file.png} +0 -0
  107. data/reference/cpp/class_gosu_1_1_font-members.html +79 -0
  108. data/reference/{classGosu_1_1Font.html → cpp/class_gosu_1_1_font.html} +207 -66
  109. data/reference/cpp/class_gosu_1_1_graphics-members.html +90 -0
  110. data/reference/cpp/class_gosu_1_1_graphics.html +768 -0
  111. data/reference/cpp/class_gosu_1_1_image-members.html +85 -0
  112. data/reference/cpp/class_gosu_1_1_image.html +771 -0
  113. data/reference/cpp/class_gosu_1_1_image_data-members.html +77 -0
  114. data/reference/cpp/class_gosu_1_1_image_data.html +281 -0
  115. data/reference/cpp/class_gosu_1_1_input-members.html +85 -0
  116. data/reference/cpp/class_gosu_1_1_input.html +417 -0
  117. data/reference/cpp/class_gosu_1_1_listener_socket-members.html +78 -0
  118. data/reference/cpp/class_gosu_1_1_listener_socket.html +221 -0
  119. data/reference/cpp/class_gosu_1_1_message_socket-members.html +80 -0
  120. data/reference/{classGosu_1_1MessageSocket.html → cpp/class_gosu_1_1_message_socket.html} +115 -43
  121. data/reference/cpp/class_gosu_1_1_reader-members.html +80 -0
  122. data/reference/cpp/class_gosu_1_1_reader.html +322 -0
  123. data/reference/cpp/class_gosu_1_1_resource-members.html +79 -0
  124. data/reference/cpp/class_gosu_1_1_resource.html +305 -0
  125. data/reference/{classGosu_1_1Resource.png → cpp/class_gosu_1_1_resource.png} +0 -0
  126. data/reference/cpp/class_gosu_1_1_rot_flip-members.html +83 -0
  127. data/reference/cpp/class_gosu_1_1_rot_flip.html +347 -0
  128. data/reference/cpp/class_gosu_1_1_sample-members.html +77 -0
  129. data/reference/{classGosu_1_1Sample.html → cpp/class_gosu_1_1_sample.html} +99 -32
  130. data/reference/cpp/class_gosu_1_1_sample_instance-members.html +81 -0
  131. data/reference/cpp/class_gosu_1_1_sample_instance.html +317 -0
  132. data/reference/cpp/class_gosu_1_1_song-members.html +86 -0
  133. data/reference/{classGosu_1_1Song.html → cpp/class_gosu_1_1_song.html} +152 -68
  134. data/reference/cpp/class_gosu_1_1_text_input-members.html +78 -0
  135. data/reference/cpp/class_gosu_1_1_text_input.html +227 -0
  136. data/reference/cpp/class_gosu_1_1_window-members.html +90 -0
  137. data/reference/cpp/class_gosu_1_1_window.html +533 -0
  138. data/reference/cpp/class_gosu_1_1_writer-members.html +79 -0
  139. data/reference/cpp/class_gosu_1_1_writer.html +292 -0
  140. data/reference/cpp/classes.html +86 -0
  141. data/reference/cpp/closed.gif +0 -0
  142. data/reference/cpp/cpp.css +155 -0
  143. data/reference/{doxygen.png → cpp/doxygen.png} +0 -0
  144. data/reference/cpp/files.html +97 -0
  145. data/reference/cpp/functions.html +127 -0
  146. data/reference/cpp/functions_0x62.html +137 -0
  147. data/reference/cpp/functions_0x63.html +140 -0
  148. data/reference/cpp/functions_0x64.html +142 -0
  149. data/reference/cpp/functions_0x65.html +119 -0
  150. data/reference/cpp/functions_0x66.html +137 -0
  151. data/reference/cpp/functions_0x67.html +131 -0
  152. data/reference/cpp/functions_0x68.html +121 -0
  153. data/reference/cpp/functions_0x69.html +123 -0
  154. data/reference/cpp/functions_0x6b.html +115 -0
  155. data/reference/cpp/functions_0x6c.html +117 -0
  156. data/reference/cpp/functions_0x6d.html +125 -0
  157. data/reference/cpp/functions_0x6e.html +117 -0
  158. data/reference/cpp/functions_0x6f.html +126 -0
  159. data/reference/cpp/functions_0x70.html +136 -0
  160. data/reference/cpp/functions_0x72.html +154 -0
  161. data/reference/cpp/functions_0x73.html +179 -0
  162. data/reference/cpp/functions_0x74.html +127 -0
  163. data/reference/cpp/functions_0x75.html +121 -0
  164. data/reference/cpp/functions_0x76.html +117 -0
  165. data/reference/cpp/functions_0x77.html +129 -0
  166. data/reference/cpp/functions_0x78.html +115 -0
  167. data/reference/cpp/functions_0x79.html +115 -0
  168. data/reference/cpp/functions_0x7e.html +143 -0
  169. data/reference/cpp/functions_enum.html +87 -0
  170. data/reference/cpp/functions_eval.html +89 -0
  171. data/reference/cpp/functions_func.html +125 -0
  172. data/reference/cpp/functions_func_0x62.html +133 -0
  173. data/reference/cpp/functions_func_0x63.html +136 -0
  174. data/reference/cpp/functions_func_0x64.html +140 -0
  175. data/reference/cpp/functions_func_0x65.html +117 -0
  176. data/reference/cpp/functions_func_0x66.html +135 -0
  177. data/reference/cpp/functions_func_0x67.html +129 -0
  178. data/reference/cpp/functions_func_0x68.html +119 -0
  179. data/reference/cpp/functions_func_0x69.html +119 -0
  180. data/reference/cpp/functions_func_0x6b.html +113 -0
  181. data/reference/cpp/functions_func_0x6c.html +113 -0
  182. data/reference/cpp/functions_func_0x6d.html +123 -0
  183. data/reference/cpp/functions_func_0x6e.html +115 -0
  184. data/reference/cpp/functions_func_0x6f.html +113 -0
  185. data/reference/cpp/functions_func_0x70.html +134 -0
  186. data/reference/cpp/functions_func_0x72.html +150 -0
  187. data/reference/cpp/functions_func_0x73.html +173 -0
  188. data/reference/cpp/functions_func_0x74.html +119 -0
  189. data/reference/cpp/functions_func_0x75.html +119 -0
  190. data/reference/cpp/functions_func_0x76.html +115 -0
  191. data/reference/cpp/functions_func_0x77.html +127 -0
  192. data/reference/cpp/functions_func_0x7e.html +141 -0
  193. data/reference/cpp/functions_type.html +87 -0
  194. data/reference/cpp/functions_vars.html +112 -0
  195. data/reference/cpp/globals.html +84 -0
  196. data/reference/cpp/globals_defs.html +84 -0
  197. data/reference/cpp/hierarchy.html +100 -0
  198. data/reference/cpp/index.html +66 -0
  199. data/reference/cpp/open.gif +0 -0
  200. data/reference/cpp/struct_gosu_1_1_g_l_tex_info-members.html +77 -0
  201. data/reference/cpp/struct_gosu_1_1_g_l_tex_info.html +185 -0
  202. data/reference/cpp/struct_gosu_1_1_touch-members.html +75 -0
  203. data/reference/cpp/struct_gosu_1_1_touch.html +153 -0
  204. data/reference/{tab_b.gif → cpp/tab_b.gif} +0 -0
  205. data/reference/{tab_l.gif → cpp/tab_l.gif} +0 -0
  206. data/reference/{tab_r.gif → cpp/tab_r.gif} +0 -0
  207. data/reference/{tabs.css → cpp/tabs.css} +5 -2
  208. data/windows/Gosu.sln +5 -0
  209. data/windows/Gosu.vcproj +3 -3
  210. data/windows/RubyGosu.vcproj +103 -1
  211. metadata +178 -176
  212. data/reference/Async_8hpp-source.html +0 -70
  213. data/reference/Audio_8hpp-source.html +0 -125
  214. data/reference/Audio_8hpp.html +0 -50
  215. data/reference/AutoLink_8hpp-source.html +0 -38
  216. data/reference/AutoLink_8hpp.html +0 -34
  217. data/reference/Bitmap_8hpp-source.html +0 -84
  218. data/reference/Bitmap_8hpp.html +0 -58
  219. data/reference/ButtonsWin_8hpp-source.html +0 -159
  220. data/reference/ButtonsX_8hpp-source.html +0 -160
  221. data/reference/Color_8hpp-source.html +0 -169
  222. data/reference/Color_8hpp.html +0 -85
  223. data/reference/Directories_8hpp-source.html +0 -42
  224. data/reference/Directories_8hpp.html +0 -46
  225. data/reference/Font_8hpp-source.html +0 -65
  226. data/reference/Font_8hpp.html +0 -41
  227. data/reference/Fwd_8hpp.html +0 -37
  228. data/reference/Gosu_8hpp-source.html +0 -49
  229. data/reference/Gosu_8hpp.html +0 -34
  230. data/reference/GraphicsBase_8hpp-source.html +0 -59
  231. data/reference/GraphicsBase_8hpp.html +0 -59
  232. data/reference/Graphics_8hpp-source.html +0 -99
  233. data/reference/Graphics_8hpp.html +0 -60
  234. data/reference/IO_8hpp-source.html +0 -255
  235. data/reference/IO_8hpp.html +0 -74
  236. data/reference/ImageData_8hpp-source.html +0 -62
  237. data/reference/ImageData_8hpp.html +0 -43
  238. data/reference/Image_8hpp-source.html +0 -126
  239. data/reference/Image_8hpp.html +0 -48
  240. data/reference/Input_8hpp-source.html +0 -131
  241. data/reference/Input_8hpp.html +0 -56
  242. data/reference/Math_8hpp-source.html +0 -101
  243. data/reference/Math_8hpp.html +0 -78
  244. data/reference/Platform_8hpp.html +0 -73
  245. data/reference/RotFlip_8hpp-source.html +0 -138
  246. data/reference/RotFlip_8hpp.html +0 -77
  247. data/reference/Sockets_8hpp-source.html +0 -130
  248. data/reference/Sockets_8hpp.html +0 -66
  249. data/reference/TextInput_8hpp-source.html +0 -64
  250. data/reference/TextInput_8hpp.html +0 -41
  251. data/reference/Text_8hpp-source.html +0 -56
  252. data/reference/Text_8hpp.html +0 -48
  253. data/reference/Timing_8hpp-source.html +0 -36
  254. data/reference/Timing_8hpp.html +0 -42
  255. data/reference/Utility_8hpp-source.html +0 -43
  256. data/reference/Utility_8hpp.html +0 -46
  257. data/reference/WinUtility_8hpp-source.html +0 -79
  258. data/reference/WinUtility_8hpp.html +0 -64
  259. data/reference/Window_8hpp-source.html +0 -110
  260. data/reference/Window_8hpp.html +0 -41
  261. data/reference/annotated.html +0 -51
  262. data/reference/classGosu_1_1Audio-members.html +0 -34
  263. data/reference/classGosu_1_1Audio.html +0 -46
  264. data/reference/classGosu_1_1Bitmap-members.html +0 -45
  265. data/reference/classGosu_1_1Bitmap.html +0 -266
  266. data/reference/classGosu_1_1Buffer-members.html +0 -44
  267. data/reference/classGosu_1_1Buffer.html +0 -78
  268. data/reference/classGosu_1_1Button-members.html +0 -36
  269. data/reference/classGosu_1_1Button.html +0 -143
  270. data/reference/classGosu_1_1Color-members.html +0 -56
  271. data/reference/classGosu_1_1Color.html +0 -387
  272. data/reference/classGosu_1_1File-members.html +0 -41
  273. data/reference/classGosu_1_1File.html +0 -69
  274. data/reference/classGosu_1_1Font-members.html +0 -39
  275. data/reference/classGosu_1_1Graphics-members.html +0 -50
  276. data/reference/classGosu_1_1Graphics.html +0 -234
  277. data/reference/classGosu_1_1Image-members.html +0 -45
  278. data/reference/classGosu_1_1Image.html +0 -518
  279. data/reference/classGosu_1_1ImageData-members.html +0 -37
  280. data/reference/classGosu_1_1ImageData.html +0 -60
  281. data/reference/classGosu_1_1Input-members.html +0 -45
  282. data/reference/classGosu_1_1Input.html +0 -256
  283. data/reference/classGosu_1_1MessageSocket-members.html +0 -40
  284. data/reference/classGosu_1_1Resource-members.html +0 -39
  285. data/reference/classGosu_1_1Resource.html +0 -116
  286. data/reference/classGosu_1_1Sample-members.html +0 -37
  287. data/reference/classGosu_1_1SampleInstance-members.html +0 -41
  288. data/reference/classGosu_1_1SampleInstance.html +0 -178
  289. data/reference/classGosu_1_1Song-members.html +0 -46
  290. data/reference/classGosu_1_1TextInput-members.html +0 -38
  291. data/reference/classGosu_1_1TextInput.html +0 -121
  292. data/reference/classGosu_1_1Window-members.html +0 -50
  293. data/reference/classGosu_1_1Window.html +0 -289
  294. data/reference/doxyfile +0 -233
  295. data/reference/doxygen.css +0 -433
  296. data/reference/files.html +0 -54
  297. data/reference/functions.html +0 -249
  298. data/reference/functions_enum.html +0 -45
  299. data/reference/functions_func.html +0 -240
  300. data/reference/functions_vars.html +0 -47
  301. data/reference/hierarchy.html +0 -53
  302. data/reference/index.html +0 -26
  303. data/reference/namespaceGosu.html +0 -3363
  304. data/reference/namespaceGosu_1_1Colors.html +0 -70
  305. data/reference/namespaceGosu_1_1Win.html +0 -275
  306. data/reference/namespacemembers.html +0 -229
  307. data/reference/namespacemembers_enum.html +0 -52
  308. data/reference/namespacemembers_eval.html +0 -54
  309. data/reference/namespacemembers_func.html +0 -196
  310. data/reference/namespacemembers_type.html +0 -46
  311. data/reference/namespacemembers_vars.html +0 -48
  312. data/reference/namespaces.html +0 -35
@@ -19,11 +19,13 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19
19
  DEALINGS IN THE SOFTWARE.
20
20
 
21
21
  Julian Raschke julian@raschke.de
22
+
22
23
  Jan Lücker jan.luecker@gmx.de
23
- http://code.google.com/p/gosu/
24
+
25
+ http://www.libgosu.org/
24
26
 
25
27
  ***
26
28
 
27
- Does NOT apply to fmod.dll shipped with the Windows version of Gosu,
29
+ This does NOT apply to fmod.dll shipped with the Windows version of Gosu,
28
30
  or the bytecode of FMOD contained in Gosu.framework and gosu.bundle on OS X.
29
31
  FMOD is a property of Firelight Technologies Pty, Ltd., see www.fmod.org.
@@ -49,8 +49,11 @@ namespace Gosu
49
49
 
50
50
  bool playing() const;
51
51
  bool paused() const;
52
+ //! Pauses this instance to be resumed afterwards. It will still keep a channel filled while paused.
52
53
  void pause();
53
54
  void resume();
55
+ //! Stops this instance of a sound being played.
56
+ //! Calling this twice, or too late, does not do any harm.
54
57
  void stop();
55
58
 
56
59
  //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
@@ -86,8 +89,8 @@ namespace Gosu
86
89
  //! Plays the sample without panning.
87
90
  //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
88
91
  //! volume).
89
- //! \param speed Playback speed is only limited by FMOD's
90
- //! capabilities and can accept very high or low values. Use 1.0 for
92
+ //! \param speed Playback speed is only limited by the underlying audio library,
93
+ //! and can accept very high or low values. Use 1.0 for
91
94
  //! normal playback speed.
92
95
  SampleInstance play(double volume = 1, double speed = 1,
93
96
  bool looping = false) const;
@@ -98,8 +101,8 @@ namespace Gosu
98
101
  //! \param pan Can be anything from -1.0 (left) to 1.0 (right).
99
102
  //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
100
103
  //! volume).
101
- //! \param speed Playback speed is only limited by FMOD's (or
102
- //! SDL_mixer's, respectively) capabilities and can accept very high
104
+ //! \param speed Playback speed is only limited by by the underlying audio library,
105
+ //! and can accept very high
103
106
  //! or low values. Use 1.0 for normal playback speed.
104
107
  SampleInstance playPan(double pan, double volume = 1, double speed = 1,
105
108
  bool looping = false) const;
@@ -151,7 +154,7 @@ namespace Gosu
151
154
  //! Stops playback of this song if it is currently played or paused.
152
155
  //! Afterwards, currentSong will return 0.
153
156
  void stop();
154
- //! Returns if the song is currently playing.
157
+ //! Returns true if the song is currently playing.
155
158
  bool playing() const;
156
159
  //! Returns the current volume of the song.
157
160
  double volume() const;
@@ -23,7 +23,8 @@ namespace Gosu
23
23
 
24
24
  public:
25
25
  //! Constructs a font that can be drawn onto the graphics object.
26
- //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
26
+ //! \param fontName Name of a system font, or a filename to a TTF
27
+ //! file (must contain '/', does not work on Linux).
27
28
  //! \param height Height of the font, in pixels.
28
29
  Font(Graphics& graphics, const std::wstring& fontName,
29
30
  unsigned height);
@@ -32,7 +33,7 @@ namespace Gosu
32
33
  //! Returns the height of the font, in pixels.
33
34
  unsigned height() const;
34
35
 
35
- //! Returns the width the given text would occupy if drawn.
36
+ //! Returns the width, in pixels, the given text would occupy if drawn.
36
37
  double textWidth(const std::wstring& text, double factorX = 1) const;
37
38
 
38
39
  //! Draws text so the top left corner of the text is at (x; y).
@@ -49,7 +50,8 @@ namespace Gosu
49
50
  void drawRel(const std::wstring& text, double x, double y, ZPos z,
50
51
  double relX, double relY, double factorX = 1, double factorY = 1,
51
52
  Color c = Colors::white, AlphaMode mode = amDefault) const;
52
-
53
+
54
+ //! Analogous to draw, but rotates the text by a given angle.
53
55
  void drawRot(const std::wstring& text, double x, double y, ZPos z, double angle,
54
56
  double factorX = 1, double factorY = 1,
55
57
  Color c = Colors::white, AlphaMode mode = amDefault) const;
@@ -1,6 +1,12 @@
1
1
  //! \file Gosu.hpp
2
2
  //! Umbrella header for lazy people with fast compilers, or pre-compiled headers.
3
3
 
4
+ //! \mainpage Gosu C++ Documentation
5
+ //!
6
+ //! These pages serve as a reference on the C++ interface of Gosu. For a higher-level
7
+ //! discussion of concepts and ideas behind the library, see the Wiki entries linked
8
+ //! from the official website, http://www.libgosu.org/.
9
+
4
10
  #ifndef GOSU_GOSU_HPP
5
11
  #define GOSU_GOSU_HPP
6
12
 
@@ -12,19 +12,11 @@
12
12
 
13
13
  namespace Gosu
14
14
  {
15
+ //! Returns the width, in pixels, of the user's primary screen.
15
16
  unsigned screenWidth();
17
+
18
+ //! Returns the height, in pixels, of the user's primary screen.
16
19
  unsigned screenHeight();
17
-
18
- //! Flags that affect the softness of a border.
19
- enum BorderFlags
20
- {
21
- bfSoft = 0,
22
- bfHardLeft = 1,
23
- bfHardTop = 2,
24
- bfHardRight = 4,
25
- bfHardBottom = 8,
26
- bfHard = bfHardLeft | bfHardTop | bfHardRight | bfHardBottom
27
- };
28
20
 
29
21
  //! Serves as the target of all drawing and provides basic drawing
30
22
  //! functionality.
@@ -58,11 +50,12 @@ namespace Gosu
58
50
  void beginGL();
59
51
  //! Resets Gosu into its default rendering state.
60
52
  void endGL();
61
- // Enables clipping to a specified rectangle.
53
+ //! Enables clipping to a specified rectangle.
62
54
  void beginClipping(int x, int y, unsigned width, unsigned height);
63
- // Disables clipping.
55
+ //! Disables clipping.
64
56
  void endClipping();
65
57
 
58
+ //! Draws a line from one point to another (last pixel exclusive).
66
59
  void drawLine(double x1, double y1, Color c1,
67
60
  double x2, double y2, Color c2,
68
61
  ZPos z, AlphaMode mode = amDefault);
@@ -17,7 +17,7 @@ namespace Gosu
17
17
  //! your drawing operation does not need Z ordering and can be performed
18
18
  //! immediately.
19
19
  const double zImmediate = -std::numeric_limits<double>::infinity();
20
-
20
+
21
21
  //! Determines the way colors are combined when one is drawn onto
22
22
  //! another.
23
23
  enum AlphaMode
@@ -30,14 +30,14 @@ namespace Gosu
30
30
  //! to the old color's channels.
31
31
  amAdditive
32
32
  };
33
-
33
+
34
34
  enum FontFlags
35
35
  {
36
36
  ffBold = 1,
37
37
  ffItalic = 2,
38
38
  ffUnderline = 4
39
39
  };
40
-
40
+
41
41
  enum TextAlign
42
42
  {
43
43
  taLeft,
@@ -45,6 +45,17 @@ namespace Gosu
45
45
  taCenter,
46
46
  taJustify
47
47
  };
48
+
49
+ //! Flags that affect the tileability of an image.
50
+ enum BorderFlags
51
+ {
52
+ bfSoft = 0,
53
+ bfTileableLeft = 1,
54
+ bfTileableTop = 2,
55
+ bfTileableRight = 4,
56
+ bfTileableBottom = 8,
57
+ bfTileable = bfTileableLeft | bfTileableTop | bfTileableRight | bfTileableBottom
58
+ };
48
59
  }
49
60
 
50
61
  #endif
@@ -1,255 +1,259 @@
1
- //! \file IO.hpp
2
- //! Contains everything related to input and output.
3
-
4
- #ifndef GOSU_IO_HPP
5
- #define GOSU_IO_HPP
6
-
7
- #include <boost/utility.hpp>
8
- #include <boost/scoped_ptr.hpp>
9
- #include <cstddef>
10
- #include <algorithm>
11
- #include <string>
12
- #include <vector>
13
-
14
- namespace Gosu
15
- {
16
- class Resource;
17
-
18
- enum ByteOrder { boLittle, boBig, boDontCare };
19
- #ifdef __BIG_ENDIAN__
20
- const ByteOrder nativeByteOrder = boBig, otherByteOrder = boLittle;
21
- #else
22
- const ByteOrder nativeByteOrder = boLittle, otherByteOrder = boBig;
23
- #endif
24
-
25
- class Reader
26
- {
27
- const Resource* res;
28
- std::size_t pos;
29
-
30
- public:
31
- Reader(const Resource& resource, std::size_t position)
32
- : res(&resource), pos(position)
33
- {
34
- }
35
-
36
- const Resource& resource() const
37
- {
38
- return *res;
39
- }
40
-
41
- std::size_t position() const
42
- {
43
- return pos;
44
- }
45
-
46
- void setPosition(std::size_t value)
47
- {
48
- // TODO: Check?
49
- pos = value;
50
- }
51
-
52
- void seek(std::ptrdiff_t offset)
53
- {
54
- // TODO: Check?
55
- pos += offset;
56
- }
57
-
58
- void read(void* destBuffer, std::size_t length);
59
-
60
- //! Convenience function; equivalent to read(&t, sizeof t).
61
- template<typename T>
62
- void readPod(T& t, ByteOrder bo = boDontCare)
63
- {
64
- read(&t, sizeof t);
65
- if (bo == otherByteOrder)
66
- {
67
- char* begin = reinterpret_cast<char*>(&t);
68
- std::reverse(begin, begin + sizeof t);
69
- }
70
- }
71
-
72
- //! Similar to readPod(T&), but returns the read value instead.
73
- template<typename T>
74
- T getPod(ByteOrder bo = boDontCare)
75
- {
76
- T t;
77
- readPod<T>(t, bo);
78
- return t;
79
- }
80
- };
81
-
82
- class Writer
83
- {
84
- Resource* res;
85
- std::size_t pos;
86
-
87
- public:
88
- Writer(Resource& resource, std::size_t position)
89
- : res(&resource), pos(position)
90
- {
91
- }
92
-
93
- Resource& resource() const
94
- {
95
- return *res;
96
- }
97
-
98
- std::size_t position() const
99
- {
100
- return pos;
101
- }
102
-
103
- void setPosition(std::size_t value)
104
- {
105
- // TODO: Check?
106
- pos = value;
107
- }
108
-
109
- void seek(std::ptrdiff_t offset)
110
- {
111
- // TODO: Check?
112
- pos += offset;
113
- }
114
-
115
- void write(const void* sourceBuffer, std::size_t length);
116
-
117
- //! Convenience function; equivalent to write(&t, sizeof t).
118
- template<typename T>
119
- void writePod(const T& t, ByteOrder bo = boDontCare)
120
- {
121
- if (bo == otherByteOrder)
122
- {
123
- char buf[sizeof t];
124
- const char* begin = reinterpret_cast<const char*>(&t);
125
- std::reverse_copy(begin, begin + sizeof t, buf);
126
- write(buf, sizeof buf);
127
- }
128
- else
129
- write(&t, sizeof t);
130
- }
131
- };
132
-
133
- //! Base class for resources. A resource in Gosu is nothing more but a
134
- //! piece of binary data that can be read or written, for example files
135
- //! or simply areas of allocated memory.
136
- //! A resource always knows its size and can resize itself, thereby either
137
- //! truncating its content or allocating room for more data.
138
- class Resource : boost::noncopyable
139
- {
140
- public:
141
- virtual ~Resource()
142
- {
143
- }
144
-
145
- //! Convenience: Creates a new Reader that reads from the start of
146
- //! the resource.
147
- Reader frontReader() const
148
- {
149
- return Reader(*this, 0);
150
- }
151
-
152
- //! Convenience: Creates a new Writer that appends data at the
153
- //! end of the resource.
154
- Writer backWriter()
155
- {
156
- return Writer(*this, size());
157
- }
158
-
159
- virtual std::size_t size() const = 0;
160
-
161
- virtual void resize(std::size_t newSize) = 0;
162
-
163
- virtual void read(std::size_t offset, std::size_t length,
164
- void* destBuffer) const = 0;
165
-
166
- virtual void write(std::size_t offset, std::size_t length,
167
- const void* sourceBuffer) = 0;
168
- };
169
-
170
- //! Piece of memory with the Resource interface.
171
- class Buffer : public Resource
172
- {
173
- std::vector<char> buf;
174
-
175
- public:
176
- Buffer()
177
- {
178
- }
179
-
180
- Buffer(const Buffer& other)
181
- : buf(other.buf)
182
- {
183
- }
184
-
185
- Buffer& operator=(const Buffer& other)
186
- {
187
- buf = other.buf;
188
- return *this;
189
- }
190
-
191
- std::size_t size() const
192
- {
193
- return buf.size();
194
- }
195
-
196
- void resize(std::size_t newSize)
197
- {
198
- buf.resize(newSize);
199
- }
200
-
201
- void read(std::size_t offset, std::size_t length,
202
- void* destBuffer) const;
203
-
204
- void write(std::size_t offset, std::size_t length,
205
- const void* sourceBuffer);
206
-
207
- const void* data() const
208
- {
209
- return &buf[0];
210
- }
211
-
212
- void* data()
213
- {
214
- return &buf[0];
215
- }
216
- };
217
-
218
- enum FileMode
219
- {
220
- //! Opens an existing file for reading; throws an exception if the file
221
- //! cannot be found.
222
- fmRead,
223
- //! Writes data to a file. If the file already exists, is emptied on
224
- //! opening. If the file does not exist, it is created.
225
- fmReplace,
226
- //! Opens or creates a file with writing access, but does not clear
227
- //! existing contents.
228
- fmAlter
229
- };
230
-
231
- //! File with the Resource interface.
232
- class File : public Resource
233
- {
234
- struct Impl;
235
- boost::scoped_ptr<Impl> pimpl;
236
-
237
- public:
238
- explicit File(const std::wstring& filename, FileMode mode = fmRead);
239
- ~File();
240
-
241
- std::size_t size() const;
242
- void resize(std::size_t newSize);
243
- void read(std::size_t offset, std::size_t length,
244
- void* destBuffer) const;
245
- void write(std::size_t offset, std::size_t length,
246
- const void* sourceBuffer);
247
- };
248
-
249
- //! Loads a whole file into a buffer.
250
- void loadFile(Buffer& buffer, const std::wstring& filename);
251
- //! Creates or overwrites a file with the contents of a buffer.
252
- void saveFile(const Buffer& buffer, const std::wstring& filename);
253
- }
254
-
255
- #endif
1
+ //! \file IO.hpp
2
+ //! Contains everything related to input and output.
3
+
4
+ #ifndef GOSU_IO_HPP
5
+ #define GOSU_IO_HPP
6
+
7
+ #include <boost/utility.hpp>
8
+ #include <boost/scoped_ptr.hpp>
9
+ #include <cstddef>
10
+ #include <algorithm>
11
+ #include <string>
12
+ #include <vector>
13
+
14
+ namespace Gosu
15
+ {
16
+ class Resource;
17
+
18
+ enum ByteOrder { boLittle, boBig, boDontCare };
19
+ #ifdef __BIG_ENDIAN__
20
+ const ByteOrder nativeByteOrder = boBig, otherByteOrder = boLittle;
21
+ #else
22
+ const ByteOrder nativeByteOrder = boLittle, otherByteOrder = boBig;
23
+ #endif
24
+
25
+ //! Utility class that points to a specific position in a resource
26
+ //! and offers an interface for sequential reading.
27
+ class Reader
28
+ {
29
+ const Resource* res;
30
+ std::size_t pos;
31
+
32
+ public:
33
+ Reader(const Resource& resource, std::size_t position)
34
+ : res(&resource), pos(position)
35
+ {
36
+ }
37
+
38
+ const Resource& resource() const
39
+ {
40
+ return *res;
41
+ }
42
+
43
+ std::size_t position() const
44
+ {
45
+ return pos;
46
+ }
47
+
48
+ void setPosition(std::size_t value)
49
+ {
50
+ // TODO: Check?
51
+ pos = value;
52
+ }
53
+
54
+ void seek(std::ptrdiff_t offset)
55
+ {
56
+ // TODO: Check?
57
+ pos += offset;
58
+ }
59
+
60
+ void read(void* destBuffer, std::size_t length);
61
+
62
+ //! Convenience function; equivalent to read(&t, sizeof t).
63
+ template<typename T>
64
+ void readPod(T& t, ByteOrder bo = boDontCare)
65
+ {
66
+ read(&t, sizeof t);
67
+ if (bo == otherByteOrder)
68
+ {
69
+ char* begin = reinterpret_cast<char*>(&t);
70
+ std::reverse(begin, begin + sizeof t);
71
+ }
72
+ }
73
+
74
+ //! Similar to readPod(T&), but returns the read value instead.
75
+ template<typename T>
76
+ T getPod(ByteOrder bo = boDontCare)
77
+ {
78
+ T t;
79
+ readPod<T>(t, bo);
80
+ return t;
81
+ }
82
+ };
83
+
84
+ //! Utility class that points to a specific position in a resource
85
+ //! and offers an interface for sequential writing.
86
+ class Writer
87
+ {
88
+ Resource* res;
89
+ std::size_t pos;
90
+
91
+ public:
92
+ Writer(Resource& resource, std::size_t position)
93
+ : res(&resource), pos(position)
94
+ {
95
+ }
96
+
97
+ Resource& resource() const
98
+ {
99
+ return *res;
100
+ }
101
+
102
+ std::size_t position() const
103
+ {
104
+ return pos;
105
+ }
106
+
107
+ void setPosition(std::size_t value)
108
+ {
109
+ // TODO: Check?
110
+ pos = value;
111
+ }
112
+
113
+ void seek(std::ptrdiff_t offset)
114
+ {
115
+ // TODO: Check?
116
+ pos += offset;
117
+ }
118
+
119
+ void write(const void* sourceBuffer, std::size_t length);
120
+
121
+ //! Convenience function; equivalent to write(&t, sizeof t).
122
+ template<typename T>
123
+ void writePod(const T& t, ByteOrder bo = boDontCare)
124
+ {
125
+ if (bo == otherByteOrder)
126
+ {
127
+ char buf[sizeof t];
128
+ const char* begin = reinterpret_cast<const char*>(&t);
129
+ std::reverse_copy(begin, begin + sizeof t, buf);
130
+ write(buf, sizeof buf);
131
+ }
132
+ else
133
+ write(&t, sizeof t);
134
+ }
135
+ };
136
+
137
+ //! Base class for resources. A resource in Gosu is nothing more but a
138
+ //! piece of binary data that can be read or written, for example files
139
+ //! or simply areas of allocated memory.
140
+ //! A resource always knows its size and can resize itself, thereby either
141
+ //! truncating its content or allocating room for more data.
142
+ class Resource : boost::noncopyable
143
+ {
144
+ public:
145
+ virtual ~Resource()
146
+ {
147
+ }
148
+
149
+ //! Convenience: Creates a new Reader that reads from the start of
150
+ //! the resource.
151
+ Reader frontReader() const
152
+ {
153
+ return Reader(*this, 0);
154
+ }
155
+
156
+ //! Convenience: Creates a new Writer that appends data at the
157
+ //! end of the resource.
158
+ Writer backWriter()
159
+ {
160
+ return Writer(*this, size());
161
+ }
162
+
163
+ virtual std::size_t size() const = 0;
164
+
165
+ virtual void resize(std::size_t newSize) = 0;
166
+
167
+ virtual void read(std::size_t offset, std::size_t length,
168
+ void* destBuffer) const = 0;
169
+
170
+ virtual void write(std::size_t offset, std::size_t length,
171
+ const void* sourceBuffer) = 0;
172
+ };
173
+
174
+ //! Piece of memory with the Resource interface.
175
+ class Buffer : public Resource
176
+ {
177
+ std::vector<char> buf;
178
+
179
+ public:
180
+ Buffer()
181
+ {
182
+ }
183
+
184
+ Buffer(const Buffer& other)
185
+ : buf(other.buf)
186
+ {
187
+ }
188
+
189
+ Buffer& operator=(const Buffer& other)
190
+ {
191
+ buf = other.buf;
192
+ return *this;
193
+ }
194
+
195
+ std::size_t size() const
196
+ {
197
+ return buf.size();
198
+ }
199
+
200
+ void resize(std::size_t newSize)
201
+ {
202
+ buf.resize(newSize);
203
+ }
204
+
205
+ void read(std::size_t offset, std::size_t length,
206
+ void* destBuffer) const;
207
+
208
+ void write(std::size_t offset, std::size_t length,
209
+ const void* sourceBuffer);
210
+
211
+ const void* data() const
212
+ {
213
+ return &buf[0];
214
+ }
215
+
216
+ void* data()
217
+ {
218
+ return &buf[0];
219
+ }
220
+ };
221
+
222
+ enum FileMode
223
+ {
224
+ //! Opens an existing file for reading; throws an exception if the file
225
+ //! cannot be found.
226
+ fmRead,
227
+ //! Writes data to a file. If the file already exists, is emptied on
228
+ //! opening. If the file does not exist, it is created.
229
+ fmReplace,
230
+ //! Opens or creates a file with writing access, but does not clear
231
+ //! existing contents.
232
+ fmAlter
233
+ };
234
+
235
+ //! File with the Resource interface.
236
+ class File : public Resource
237
+ {
238
+ struct Impl;
239
+ boost::scoped_ptr<Impl> pimpl;
240
+
241
+ public:
242
+ explicit File(const std::wstring& filename, FileMode mode = fmRead);
243
+ ~File();
244
+
245
+ std::size_t size() const;
246
+ void resize(std::size_t newSize);
247
+ void read(std::size_t offset, std::size_t length,
248
+ void* destBuffer) const;
249
+ void write(std::size_t offset, std::size_t length,
250
+ const void* sourceBuffer);
251
+ };
252
+
253
+ //! Loads a whole file into a buffer.
254
+ void loadFile(Buffer& buffer, const std::wstring& filename);
255
+ //! Creates or overwrites a file with the contents of a buffer.
256
+ void saveFile(const Buffer& buffer, const std::wstring& filename);
257
+ }
258
+
259
+ #endif