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
@@ -17,13 +17,13 @@ namespace Gosu
17
17
 
18
18
  //! Returns the width a text would span on a bitmap if it were drawn
19
19
  //! using drawText with the same arguments.
20
- //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
20
+ //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/', does not work on Linux).
21
21
  unsigned textWidth(const std::wstring& text,
22
22
  const std::wstring& fontName, unsigned fontHeight,
23
23
  unsigned fontFlags = 0);
24
24
 
25
25
  //! Draws a line of text on a bitmap.
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 file (must contain '/', does not work on Linux).
27
27
  //! \param fontHeight Height, in pixels, of the text.
28
28
  //! \param fontFlags Binary combination of members of the FontFlags
29
29
  //! enum.
@@ -33,7 +33,7 @@ namespace Gosu
33
33
 
34
34
  //! Creates a bitmap that is filled with a line of text given to the function.
35
35
  //! The line cannot contain line breaks.
36
- //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
36
+ //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/', does not work on Linux).
37
37
  //! \param fontHeight Height of the font in pixels.
38
38
  //! \param fontFlags Binary combination of members of the FontFlags
39
39
  //! enum.
@@ -43,7 +43,7 @@ namespace Gosu
43
43
 
44
44
  //! Creates a bitmap that is filled with the text given to the function.
45
45
  //! The text may contain line breaks.
46
- //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
46
+ //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/', does not work on Linux).
47
47
  //! \param fontHeight Height of the font in pixels.
48
48
  //! \param lineSpacing Spacing between two lines of text in pixels.
49
49
  //! \param maxWidth Width of the bitmap that will be returned. Text
@@ -34,7 +34,7 @@ namespace Gosu
34
34
  void registerMessageHook(const boost::function<bool (MSG&)>& hook);
35
35
 
36
36
  //! Throws an exception according to the error which GetLastError()
37
- //! returns, optionally prefixed with "While <action>, the following
37
+ //! returns, optionally prefixed with "While (action), the following
38
38
  //! error occured: ".
39
39
  GOSU_NORETURN void throwLastError(const std::string& action = "");
40
40
 
@@ -21,6 +21,8 @@ namespace Gosu
21
21
  //! Convenient all-in-one class that serves as the foundation of a standard
22
22
  //! Gosu application. Manages initialization of all of Gosu's core components
23
23
  //! and provides timing functionality.
24
+ //! Note that you should really only use on instance of this class at the same time.
25
+ //! This may or may not change later.
24
26
  class Window
25
27
  {
26
28
  struct Impl;
@@ -39,7 +41,7 @@ namespace Gosu
39
41
 
40
42
  double updateInterval() const;
41
43
 
42
- //! Starts the main event loop.
44
+ //! Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.
43
45
  void show();
44
46
  //! Closes the window if it is currently shown.
45
47
  void close();
@@ -54,6 +56,7 @@ namespace Gosu
54
56
  //! Gives the game a chance to say no to being redrawn.
55
57
  //! This is not a definitive answer. The operating system can still cause
56
58
  //! redraws for one reason or another.
59
+ //! By default, the window is redrawn all the time.
57
60
  virtual bool needsRedraw() const { return true; }
58
61
 
59
62
  //! Called before update when the user pressed a button while the
@@ -64,15 +67,16 @@ namespace Gosu
64
67
 
65
68
  // Ignore when SWIG is wrapping this class for Ruby/Gosu.
66
69
  #ifndef SWIG
70
+
67
71
  const Graphics& graphics() const;
68
72
  Graphics& graphics();
69
-
73
+
70
74
  const Audio& audio() const;
71
75
  Audio& audio();
72
-
76
+
73
77
  const Input& input() const;
74
78
  Input& input();
75
-
79
+
76
80
  #ifdef GOSU_IS_WIN
77
81
  // Only on Windows, used for integrating with GUI toolkits.
78
82
  HWND handle() const;
@@ -98,7 +102,7 @@ namespace Gosu
98
102
  // Currently known touches.
99
103
  const Touches& currentTouches() const;
100
104
  #endif
101
-
105
+
102
106
  #endif
103
107
  };
104
108
  }
@@ -32,34 +32,34 @@ void Gosu::applyBorderFlags(Bitmap& dest, const Bitmap& source,
32
32
  // borders.
33
33
 
34
34
  // Top.
35
- if (borderFlags & bfHardTop)
35
+ if (borderFlags & bfTileableTop)
36
36
  dest.insert(source, 1, 0, srcX, srcY, srcWidth, 1);
37
37
  // Bottom.
38
- if (borderFlags & bfHardBottom)
38
+ if (borderFlags & bfTileableBottom)
39
39
  dest.insert(source, 1, dest.height() - 1,
40
40
  srcX, srcY + srcHeight - 1, srcWidth, 1);
41
41
  // Left.
42
- if (borderFlags & bfHardLeft)
42
+ if (borderFlags & bfTileableLeft)
43
43
  dest.insert(source, 0, 1, srcX, srcY, 1, srcHeight);
44
44
  // Right.
45
- if (borderFlags & bfHardRight)
45
+ if (borderFlags & bfTileableRight)
46
46
  dest.insert(source, dest.width() - 1, 1,
47
47
  srcX + srcWidth - 1, srcY, 1, srcHeight);
48
48
 
49
49
  // Top left.
50
- if ((borderFlags & bfHardTop) && (borderFlags & bfHardLeft))
50
+ if ((borderFlags & bfTileableTop) && (borderFlags & bfTileableLeft))
51
51
  dest.setPixel(0, 0,
52
52
  source.getPixel(srcX, srcY));
53
53
  // Top right.
54
- if ((borderFlags & bfHardTop) && (borderFlags & bfHardRight))
54
+ if ((borderFlags & bfTileableTop) && (borderFlags & bfTileableRight))
55
55
  dest.setPixel(dest.width() - 1, 0,
56
56
  source.getPixel(srcX + srcWidth - 1, srcY));
57
57
  // Bottom left.
58
- if ((borderFlags & bfHardBottom) && (borderFlags & bfHardLeft))
58
+ if ((borderFlags & bfTileableBottom) && (borderFlags & bfTileableLeft))
59
59
  dest.setPixel(0, dest.height() - 1,
60
60
  source.getPixel(srcX, srcY + srcHeight - 1));
61
61
  // Bottom right.
62
- if ((borderFlags & bfHardBottom) && (borderFlags & bfHardRight))
62
+ if ((borderFlags & bfTileableBottom) && (borderFlags & bfTileableRight))
63
63
  dest.setPixel(dest.width() - 1, dest.height() - 1,
64
64
  source.getPixel(srcX + srcWidth - 1, srcY + srcHeight - 1));
65
65
 
@@ -34,7 +34,7 @@ namespace Gosu
34
34
  DrawOp() { clipWidth = 0xffffffff; usedVertices = 0; chunk = 0; }
35
35
 
36
36
  #ifndef GOSU_IS_IPHONE
37
- void perform(GLuint& unusedForNow) const
37
+ void perform(GLuint& currentTexName) const
38
38
  {
39
39
  if (clipWidth != 0xffffffff)
40
40
  {
@@ -49,8 +49,16 @@ namespace Gosu
49
49
 
50
50
  if (chunk)
51
51
  {
52
- glEnable(GL_TEXTURE_2D);
53
- glBindTexture(GL_TEXTURE_2D, chunk->texName());
52
+ if (currentTexName == NO_TEXTURE)
53
+ glEnable(GL_TEXTURE_2D);
54
+ if (chunk->texName() != currentTexName)
55
+ glBindTexture(GL_TEXTURE_2D, chunk->texName());
56
+ currentTexName = chunk->texName();
57
+ }
58
+ else if (currentTexName != NO_TEXTURE)
59
+ {
60
+ glDisable(GL_TEXTURE_2D);
61
+ currentTexName = NO_TEXTURE;
54
62
  }
55
63
 
56
64
  if (usedVertices == 2)
@@ -89,9 +97,6 @@ namespace Gosu
89
97
 
90
98
  glEnd();
91
99
 
92
- if (chunk)
93
- glDisable(GL_TEXTURE_2D);
94
-
95
100
  if (clipWidth != 0xffffffff)
96
101
  glDisable(GL_SCISSOR_TEST);
97
102
  }
@@ -150,7 +155,7 @@ namespace Gosu
150
155
  else if (currentTexName != NO_TEXTURE)
151
156
  {
152
157
  glDisable(GL_TEXTURE_2D);
153
- currentTexName = -1;
158
+ currentTexName = NO_TEXTURE;
154
159
  }
155
160
 
156
161
  for (int i = 0; i < usedVertices; ++i)
@@ -208,15 +213,10 @@ namespace Gosu
208
213
 
209
214
  if (z == zImmediate)
210
215
  {
211
- #ifdef GOSU_IS_IPHONE
212
216
  GLuint currentTexName = NO_TEXTURE;
213
217
  op.perform(currentTexName);
214
218
  if (currentTexName != NO_TEXTURE)
215
219
  glDisable(GL_TEXTURE_2D);
216
- #else
217
- GLuint dummy;
218
- op.perform(dummy);
219
- #endif
220
220
  }
221
221
 
222
222
  op.z = z;
@@ -247,10 +247,9 @@ namespace Gosu
247
247
  ++cur;
248
248
  }
249
249
  set.clear();
250
- #ifdef GOSU_IS_IPHONE
250
+
251
251
  if (currentTexName != NO_TEXTURE)
252
252
  glDisable(GL_TEXTURE_2D);
253
- #endif
254
253
  }
255
254
  };
256
255
  }
@@ -279,9 +279,10 @@ std::auto_ptr<Gosu::ImageData> Gosu::Graphics::createImage(
279
279
  // Special case: If the texture is supposed to have hard borders,
280
280
  // is quadratic, has a size that is at least 64 pixels but less than 256
281
281
  // pixels and a power of two, create a single texture just for this image.
282
- if ((borderFlags & bfHard) == bfHard &&
282
+ if ((borderFlags & bfTileable) == bfTileable &&
283
283
  srcWidth == srcHeight &&
284
- (srcWidth & (srcWidth - 1)) == 0)
284
+ (srcWidth & (srcWidth - 1)) == 0 &&
285
+ srcWidth >= 64)
285
286
  {
286
287
  boost::shared_ptr<Texture> texture(new Texture(srcWidth));
287
288
  std::auto_ptr<ImageData> data;
@@ -5,31 +5,31 @@
5
5
  #include <Gosu/Math.hpp>
6
6
  #include <Gosu/IO.hpp>
7
7
 
8
- Gosu::Image::Image(Graphics& graphics, const std::wstring& filename, bool hardBorders)
8
+ Gosu::Image::Image(Graphics& graphics, const std::wstring& filename, bool tileable)
9
9
  {
10
10
  // Forward.
11
- Image(graphics, quickLoadBitmap(filename), hardBorders).data.swap(data);
11
+ Image(graphics, quickLoadBitmap(filename), tileable).data.swap(data);
12
12
  }
13
13
 
14
14
  Gosu::Image::Image(Graphics& graphics, const std::wstring& filename,
15
15
  unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
16
- bool hardBorders)
16
+ bool tileable)
17
17
  {
18
18
  // Forward.
19
- Image(graphics, quickLoadBitmap(filename), srcX, srcY, srcWidth, srcHeight, hardBorders).data.swap(data);
19
+ Image(graphics, quickLoadBitmap(filename), srcX, srcY, srcWidth, srcHeight, tileable).data.swap(data);
20
20
  }
21
21
 
22
- Gosu::Image::Image(Graphics& graphics, const Bitmap& source, bool hardBorders)
22
+ Gosu::Image::Image(Graphics& graphics, const Bitmap& source, bool tileable)
23
23
  {
24
24
  // Forward.
25
- Image(graphics, source, 0, 0, source.width(), source.height(), hardBorders).data.swap(data);
25
+ Image(graphics, source, 0, 0, source.width(), source.height(), tileable).data.swap(data);
26
26
  }
27
27
 
28
28
  Gosu::Image::Image(Graphics& graphics, const Bitmap& source,
29
29
  unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
30
- bool hardBorders)
30
+ bool tileable)
31
31
  : data(graphics.createImage(source, srcX, srcY, srcWidth, srcHeight,
32
- hardBorders ? Gosu::bfHard : Gosu::bfSoft))
32
+ tileable ? Gosu::bfTileable : Gosu::bfSoft))
33
33
  {
34
34
  }
35
35
 
@@ -32,16 +32,16 @@ Gosu::LargeImageData::LargeImageData(Graphics& graphics,
32
32
  if (y == partsY - 1 && source.height() % partHeight != 0)
33
33
  srcHeight = source.height() % partHeight;
34
34
 
35
- unsigned localBorderFlags = bfHard;
35
+ unsigned localBorderFlags = bfTileable;
36
36
  if (x == 0)
37
- localBorderFlags &= ~(borderFlags & bfHardLeft);
38
- else if (x == partsX - 1)
39
- localBorderFlags &= ~(borderFlags & bfHardRight);
37
+ localBorderFlags = (localBorderFlags & ~bfTileableLeft) | (borderFlags & bfTileableLeft);
38
+ if (x == partsX - 1)
39
+ localBorderFlags = (localBorderFlags & ~bfTileableRight) | (borderFlags & bfTileableRight);
40
40
  if (y == 0)
41
- localBorderFlags &= ~(borderFlags & bfHardTop);
42
- else if (y == partsY - 1)
43
- localBorderFlags &= ~(borderFlags & bfHardBottom);
44
-
41
+ localBorderFlags = (localBorderFlags & ~bfTileableTop) | (borderFlags & bfTileableTop);
42
+ if (y == partsY - 1)
43
+ localBorderFlags = (localBorderFlags & ~bfTileableBottom) | (borderFlags & bfTileableBottom);
44
+
45
45
  parts[y * partsX + x].reset(graphics.createImage(source,
46
46
  x * partWidth, y * partHeight, srcWidth, srcHeight,
47
47
  localBorderFlags).release());
@@ -304,9 +304,21 @@ Gosu::Bitmap Gosu::createText(const std::wstring& text,
304
304
  emptyBitmap.resize(1, fontHeight);
305
305
  return emptyBitmap;
306
306
  }
307
-
308
- Gosu::Bitmap bmp;
309
- bmp.resize(Gosu::textWidth(text, fontName, fontHeight, fontFlags), fontHeight);
307
+
308
+ vector<wstring> lines;
309
+ wstring processedText = boost::replace_all_copy(text, L"\r\n", L"\n");
310
+ boost::split(lines, processedText, boost::is_any_of(L"\r\n"));
311
+
312
+ Bitmap bmp;
313
+ bmp.resize(textWidth(lines.front(), fontName, fontHeight, fontFlags), fontHeight);
310
314
  drawText(bmp, text, 0, 0, 0xffffffff, fontName, fontHeight, fontFlags);
315
+
316
+ for (int i = 1; i < lines.size(); ++i)
317
+ {
318
+ bmp.resize(max(bmp.width(), textWidth(lines[i], fontName, fontHeight, fontFlags)),
319
+ bmp.height() + fontHeight);
320
+ drawText(bmp, lines[i], 0, fontHeight * i, 0xffffffff, fontName, fontHeight, fontFlags);
321
+ }
322
+
311
323
  return bmp;
312
324
  }
@@ -66,7 +66,7 @@ namespace Gosu
66
66
  ~WinBitmap()
67
67
  {
68
68
  ::DeleteObject(bitmap);
69
- ::DeleteObject(::SelectObject(dc, ::GetStockObject(SYSTEM_FONT)));
69
+ ::SelectObject(dc, ::GetStockObject(SYSTEM_FONT));
70
70
  ::DeleteDC(dc);
71
71
  }
72
72
 
@@ -88,8 +88,16 @@ namespace Gosu
88
88
  void selectFont(std::wstring fontName, unsigned fontHeight,
89
89
  unsigned fontFlags) const
90
90
  {
91
- static std::map<std::wstring, std::wstring> customFonts;
91
+ // TODO for ASYNC support:
92
+ // Use a lock on both maps.
93
+
94
+ // Note:
95
+ // The caching of opened fonts didn't really show improved text rendering
96
+ // performance on my test system.
97
+ // In case of trouble, it can be taken out without worrying too much.
92
98
 
99
+ static std::map<std::wstring, std::wstring> customFonts;
100
+
93
101
  if (fontName.find(L"/") != std::wstring::npos)
94
102
  {
95
103
  if (customFonts.count(fontName) == 0)
@@ -100,29 +108,32 @@ namespace Gosu
100
108
  else
101
109
  fontName = customFonts[fontName];
102
110
  }
111
+
112
+ static std::map<std::pair<std::wstring, unsigned>, HFONT> loadedFonts;
113
+
114
+ HFONT font;
115
+ std::pair<std::wstring, unsigned> key = std::make_pair(fontName, fontHeight);
116
+ if (loadedFonts.count(key) == 0)
117
+ {
118
+ LOGFONT logfont = { fontHeight, 0, 0, 0,
119
+ fontFlags & ffBold ? FW_BOLD : FW_NORMAL,
120
+ fontFlags & ffItalic ? TRUE : FALSE,
121
+ fontFlags & ffUnderline ? TRUE : FALSE,
122
+ FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
123
+ CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
124
+ DEFAULT_PITCH | FF_DONTCARE };
125
+
126
+ // Note: This will truncate the font value, but that's the way stuff works.
127
+ /*std::*/wcsncpy(logfont.lfFaceName, fontName.c_str(), LF_FACESIZE);
128
+ logfont.lfFaceName[LF_FACESIZE - 1] = 0;
129
+
130
+ font = loadedFonts[key] = Win::check(::CreateFontIndirect(&logfont),
131
+ "creating font object for " + narrow(fontName));
132
+ }
133
+ else
134
+ font = loadedFonts[key];
103
135
 
104
- // IMPR: Maybe remember the last font we had and don't
105
- // recreate it every time?
106
-
107
- LOGFONT logfont = { fontHeight, 0, 0, 0,
108
- fontFlags & ffBold ? FW_BOLD : FW_NORMAL,
109
- fontFlags & ffItalic ? TRUE : FALSE,
110
- fontFlags & ffUnderline ? TRUE : FALSE,
111
- FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
112
- CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
113
- DEFAULT_PITCH | FF_DONTCARE };
114
-
115
- // IMPR: This truncates. Is this reasonable? Should we rather
116
- // throw something?
117
- /*std::*/wcsncpy(logfont.lfFaceName, fontName.c_str(), LF_FACESIZE);
118
- logfont.lfFaceName[LF_FACESIZE - 1] = 0;
119
-
120
- HFONT newFont = Win::check(::CreateFontIndirect(&logfont),
121
- "creating font object for " + narrow(fontName));
122
-
123
- HFONT oldFont = reinterpret_cast<HFONT>(::SelectObject(dc, newFont));
124
- Win::check(oldFont, "selecting the font object for " + narrow(fontName));
125
- ::DeleteObject(oldFont);
136
+ ::SelectObject(dc, font);
126
137
  }
127
138
  };
128
139
  }
@@ -157,7 +168,7 @@ void Gosu::drawText(Bitmap& bitmap, const std::wstring& text, int x, int y,
157
168
  "setting a bitmap's background mode to TRANSPARENT");
158
169
 
159
170
  ::ExtTextOut(helper.context(), 0, 0, 0, 0, text.c_str(), text.length(), 0);
160
-
171
+
161
172
  for (unsigned relY = 0; relY < fontHeight; ++relY)
162
173
  for (unsigned relX = 0; relX < width; ++relX)
163
174
  {
@@ -52,6 +52,8 @@ Gosu::Texture::Texture(unsigned size)
52
52
  GL_RGBA, GL_UNSIGNED_BYTE, 0);
53
53
  #endif
54
54
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
55
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
56
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
55
57
  }
56
58
 
57
59
  Gosu::Texture::~Texture()
@@ -3,9 +3,7 @@
3
3
 
4
4
  #include <Gosu/Platform.hpp>
5
5
 
6
- #ifdef GOSU_RUBY_19_MACPORTS
7
- #include <iconv.h> // from MacPorts
8
- #elsif defined(__APPLE__)
6
+ #ifdef __APPLE__
9
7
  #include </usr/include/iconv.h> // We want Apple's iconv
10
8
  #else
11
9
  #include <iconv.h>
@@ -113,6 +113,14 @@
113
113
  #undef read
114
114
  #undef sleep
115
115
  #undef Sleep
116
+ #undef int8_t
117
+ #undef uint8_t
118
+ #undef int16_t
119
+ #undef uint16_t
120
+ #undef int32_t
121
+ #undef uint32_t
122
+ #undef int64_t
123
+ #undef uint64_t
116
124
 
117
125
  //#ifndef WIN32
118
126
  //#include <Gosu/Async.hpp>
@@ -234,6 +242,7 @@ namespace Gosu
234
242
  %ignore Gosu::AlphaMode;
235
243
  %ignore Gosu::FontFlags;
236
244
  %ignore Gosu::TextAlign;
245
+ %ignore Gosu::BorderFlags;
237
246
  %include "../Gosu/GraphicsBase.hpp"
238
247
 
239
248
  // For screenWidth/screenHeight
@@ -305,19 +314,19 @@ namespace Gosu
305
314
  }
306
315
  }
307
316
 
308
- %ignore Gosu::Image::Image(Graphics& graphics, const std::wstring& filename, bool hardBorders = false);
309
- %ignore Gosu::Image::Image(Graphics& graphics, const std::wstring& filename, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool hardBorders = false);
310
- %ignore Gosu::Image::Image(Graphics& graphics, const Bitmap& source, bool hardBorders = false);
311
- %ignore Gosu::Image::Image(Graphics& graphics, const Bitmap& source, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool hardBorders = false);
317
+ %ignore Gosu::Image::Image(Graphics& graphics, const std::wstring& filename, bool tileable = false);
318
+ %ignore Gosu::Image::Image(Graphics& graphics, const std::wstring& filename, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool tileable = false);
319
+ %ignore Gosu::Image::Image(Graphics& graphics, const Bitmap& source, bool tileable = false);
320
+ %ignore Gosu::Image::Image(Graphics& graphics, const Bitmap& source, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, bool tileable = false);
312
321
  %include "../Gosu/Image.hpp"
313
322
  %extend Gosu::Image {
314
- Image(Gosu::Window& window, VALUE source, bool hardBorders = false) {
315
- return new Gosu::Image(window.graphics(), Gosu::loadBitmap(source), hardBorders);
323
+ Image(Gosu::Window& window, VALUE source, bool tileable = false) {
324
+ return new Gosu::Image(window.graphics(), Gosu::loadBitmap(source), tileable);
316
325
  }
317
- Image(Gosu::Window& window, VALUE source, bool hardBorders,
326
+ Image(Gosu::Window& window, VALUE source, bool tileable,
318
327
  unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight) {
319
328
  return new Gosu::Image(window.graphics(), Gosu::loadBitmap(source),
320
- srcX, srcY, srcWidth, srcHeight, hardBorders);
329
+ srcX, srcY, srcWidth, srcHeight, tileable);
321
330
  }
322
331
  #ifndef WIN32
323
332
  // %newobject asyncNew;
@@ -354,11 +363,11 @@ namespace Gosu
354
363
  return new Gosu::Image(window.graphics(), bmp);
355
364
  }
356
365
  static std::vector<Gosu::Image*> loadTiles(Gosu::Window& window, VALUE source,
357
- int tileWidth, int tileHeight, bool hardBorders) {
366
+ int tileWidth, int tileHeight, bool tileable) {
358
367
  std::vector<Gosu::Image*> vec;
359
368
  // TODO: const correctness (<- did I mean exception safety?)
360
369
  Gosu::imagesFromTiledBitmap(window.graphics(), Gosu::loadBitmap(source),
361
- tileWidth, tileHeight, hardBorders, vec);
370
+ tileWidth, tileHeight, tileable, vec);
362
371
  return vec;
363
372
  }
364
373
  }