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
@@ -23,7 +23,7 @@ namespace Gosu
23
23
  //! automatically applied to BMP type images. For more flexibility, use the
24
24
  //! corresponding constructor that uses a Bitmap object.
25
25
  Image(Graphics& graphics, const std::wstring& filename,
26
- bool hardBorders = false);
26
+ bool tileable = false);
27
27
  //! Loads a portion of the the image at the given filename that can be
28
28
  //! drawn onto graphics.
29
29
  //! This constructor can handle PNG and BMP images. A color key of #ff00ff is
@@ -31,17 +31,17 @@ namespace Gosu
31
31
  //! corresponding constructor that uses a Bitmap object.
32
32
  Image(Graphics& graphics, const std::wstring& filename, unsigned srcX,
33
33
  unsigned srcY, unsigned srcWidth, unsigned srcHeight,
34
- bool hardBorders = false);
34
+ bool tileable = false);
35
35
 
36
36
  //! Converts the given bitmap into an image that can be drawn onto
37
37
  //! graphics.
38
38
  Image(Graphics& graphics, const Bitmap& source,
39
- bool hardBorders = false);
39
+ bool tileable = false);
40
40
  //! Converts a portion of the given bitmap into an image that can be
41
41
  //! drawn onto graphics.
42
42
  Image(Graphics& graphics, const Bitmap& source, unsigned srcX,
43
43
  unsigned srcY, unsigned srcWidth, unsigned srcHeight,
44
- bool hardBorders = false);
44
+ bool tileable = false);
45
45
 
46
46
  ~Image();
47
47
 
@@ -92,32 +92,32 @@ namespace Gosu
92
92
  #endif
93
93
  };
94
94
 
95
- //! Convenience function that splits a BMP or PNG file into an area
95
+ //! Convenience function that splits a BMP or PNG file into an array
96
96
  //! of small rectangles and creates images from them.
97
97
  //! \param tileWidth If positive, specifies the width of one tile in
98
98
  //! pixels. If negative, the bitmap is divided into -tileWidth rows.
99
99
  //! \param tileHeight See tileWidth.
100
100
  //! \param appendTo STL container to which the images will be appended.
101
101
  //! Must provide a push_back member function; std::vector<boost::shared_ptr<Image>>
102
- //! is usually the most reasonable container.
102
+ //! or boost::ptr_vector<Image> are good choices.
103
103
  template<typename Container>
104
104
  void imagesFromTiledBitmap(Graphics& graphics, const std::wstring& filename,
105
- int tileWidth, int tileHeight, bool hardBorders, Container& appendTo)
105
+ int tileWidth, int tileHeight, bool tileable, Container& appendTo)
106
106
  {
107
- imagesFromTiledBitmap(graphics, quickLoadBitmap(filename), tileWidth, tileHeight, hardBorders, appendTo);
107
+ imagesFromTiledBitmap(graphics, quickLoadBitmap(filename), tileWidth, tileHeight, tileable, appendTo);
108
108
  }
109
109
 
110
- //! Convenience function that splits a bitmap into an area of small
110
+ //! Convenience function that splits a bitmap into an area of array
111
111
  //! rectangles and creates images from them.
112
112
  //! \param tileWidth If positive, specifies the width of one tile in
113
113
  //! pixels. If negative, the bitmap is divided into -tileWidth rows.
114
114
  //! \param tileHeight See tileWidth.
115
115
  //! \param appendTo STL container to which the images will be appended.
116
116
  //! Must provide a push_back member function; std::vector<boost::shared_ptr<Image>>
117
- //! is usually the most reasonable container.
117
+ //! or boost::ptr_vector<Image> are good choices.
118
118
  template<typename Container>
119
119
  void imagesFromTiledBitmap(Graphics& graphics, const Bitmap& bmp,
120
- int tileWidth, int tileHeight, bool hardBorders, Container& appendTo)
120
+ int tileWidth, int tileHeight, bool tileable, Container& appendTo)
121
121
  {
122
122
  int tilesX, tilesY;
123
123
 
@@ -141,7 +141,7 @@ namespace Gosu
141
141
  for (int x = 0; x < tilesX; ++x)
142
142
  appendTo.push_back(typename Container::value_type(new Image(graphics, bmp,
143
143
  x * tileWidth, y * tileHeight, tileWidth, tileHeight,
144
- hardBorders)));
144
+ tileable)));
145
145
  }
146
146
  }
147
147
 
@@ -11,6 +11,9 @@
11
11
 
12
12
  namespace Gosu
13
13
  {
14
+ //! Contains information about the underlying OpenGL texture and the
15
+ //! u/v space used for image data. Can be retrieved from some images
16
+ //! to use them in OpenGL operations.
14
17
  struct GLTexInfo
15
18
  {
16
19
  int texName;
@@ -50,8 +50,17 @@ namespace Gosu
50
50
  };
51
51
 
52
52
  // Available even on non-iPhone platforms to make it easier to compile the
53
- // same source for multiple platforms. To be moved to Input.hpp, though.
54
- struct Touch { void* id; double x, y; };
53
+ // same source for multiple platforms.
54
+
55
+ //! Struct that saves information about a touch on the surface of a multi-
56
+ //! touch device.
57
+ struct Touch
58
+ {
59
+ //! Allows for identification of a touch across calls.
60
+ void* id;
61
+ //! Position of a touch on the touch screen.
62
+ double x, y;
63
+ };
55
64
  typedef std::vector<Touch> Touches;
56
65
 
57
66
  //! Tests whether two Buttons identify the same physical button.
@@ -99,6 +108,7 @@ namespace Gosu
99
108
  static Button charToId(wchar_t ch);
100
109
 
101
110
  //! Returns true if a button is currently pressed.
111
+ //! Updated every tick.
102
112
  bool down(Button btn) const;
103
113
 
104
114
  //! Returns the horizontal position of the mouse relative to the top
@@ -123,7 +133,9 @@ namespace Gosu
123
133
  //! If you use the Window class, it will assign forward these to its own methods.
124
134
  boost::function<void (Button)> onButtonDown, onButtonUp;
125
135
 
136
+ //! Returns the currently active TextInput instance, or 0.
126
137
  TextInput* textInput() const;
138
+ //! Sets the currently active TextInput, or clears it (input = 0).
127
139
  void setTextInput(TextInput* input);
128
140
  };
129
141
  }
@@ -50,11 +50,12 @@ namespace Gosu
50
50
  //! specified by angle.
51
51
  //! \param angle Angle in degrees where 0.0 means upwards.
52
52
  double offsetY(double angle, double radius);
53
- //! Returns the angle between two points in degrees, where 0.0 means
53
+ //! Returns the angle from point 1 to point 2 in degrees, where 0.0 means
54
54
  //! upwards. Returns def if both points are equal.
55
55
  double angle(double fromX, double fromY, double toX, double toY,
56
56
  double def = 0);
57
- //! Returns the smallest positive angle between two angles.
57
+ //! Returns the smallest angle that can be added to angle1 to get to
58
+ //! angle2 (can be negative if counter-clockwise movement is shorter).
58
59
  double angleDiff(double angle1, double angle2);
59
60
  //! Normalizes an angle to fit into the range [0; 360[.
60
61
  double normalizeAngle(double angle);
@@ -1,116 +1,125 @@
1
- //! \file RotFlip.hpp
2
- //! Interface of the undocumented RotFlip class.
3
-
4
- #ifndef GOSU_ROTFLIP_HPP
5
- #define GOSU_ROTFLIP_HPP
6
-
7
- namespace Gosu
8
- {
9
- enum RotFlipName
10
- {
11
- rfDefault,
12
- rfRotate90,
13
- rfRotate180,
14
- rfRotate270,
15
-
16
- rfFlipX,
17
- rfRotate90FlipX,
18
- rfRotate180FlipX,
19
- rfRotate270FlipX,
20
-
21
- rfFlipY = rfRotate180FlipX,
22
- rfRotate90FlipY = rfRotate270FlipX,
23
- rfRotate180FlipY = rfFlipX,
24
- rfRotate270FlipY = rfRotate90FlipX,
25
-
26
- rfFlipXRotate90 = rfRotate270FlipX,
27
- rfFlipXRotate180 = rfRotate180FlipX,
28
- rfFlipXRotate270 = rfRotate90FlipX,
29
-
30
- rfFlipYRotate90 = rfRotate90FlipX,
31
- rfFlipYRotate180 = rfFlipX,
32
- rfFlipYRotate270 = rfRotate270FlipX
33
- };
34
-
35
- class RotFlip
36
- {
37
- RotFlipName name_;
38
-
39
- typedef RotFlipName TransTable[8];
40
- static const TransTable flipXTable, flipYTable, rotate90Table,
41
- rotate180Table, rotate270Table;
42
-
43
- typedef unsigned CornerTable[8][4];
44
- static const CornerTable mapCornerTable, realCornerTable;
45
-
46
- public:
47
- RotFlip(RotFlipName name = rfDefault)
48
- : name_(name)
49
- {
50
- }
51
-
52
- RotFlipName name() const
53
- {
54
- return name_;
55
- }
56
-
57
- void flipX()
58
- {
59
- name_ = flipXTable[name_];
60
- }
61
-
62
- void flipY()
63
- {
64
- name_ = flipYTable[name_];
65
- }
66
-
67
- void rotate90()
68
- {
69
- name_ = rotate90Table[name_];
70
- }
71
-
72
- void rotate180()
73
- {
74
- name_ = rotate180Table[name_];
75
- }
76
-
77
- void rotate270()
78
- {
79
- name_ = rotate270Table[name_];
80
- }
81
-
82
- bool flipped() const
83
- {
84
- return name_ >= rfFlipX;
85
- }
86
-
87
- bool rotated() const
88
- {
89
- return name_ % 2 == 1;
90
- }
91
-
92
- unsigned mapCorner(unsigned n) const
93
- {
94
- return mapCornerTable[name_][n];
95
- }
96
-
97
- unsigned realCorner(unsigned n) const
98
- {
99
- return realCornerTable[name_][n];
100
- }
101
- };
102
-
103
- inline bool operator==(RotFlip a, RotFlip b)
104
- {
105
- return a.name() == b.name();
106
- }
107
-
108
- inline bool operator!=(RotFlip a, RotFlip b)
109
- {
110
- return a.name() != b.name();
111
- }
112
-
113
- void applyToPoint(RotFlip rotFlip, int& x, int& y, int max);
114
- }
115
-
116
- #endif
1
+ //! \file RotFlip.hpp
2
+ //! Interface of the RotFlip class.
3
+
4
+ #ifndef GOSU_ROTFLIP_HPP
5
+ #define GOSU_ROTFLIP_HPP
6
+
7
+ namespace Gosu
8
+ {
9
+ //! Human-understandable descriptions of the variants of rotations and flips
10
+ //! that can be constructed.
11
+ enum RotFlipName
12
+ {
13
+ rfDefault,
14
+ rfRotate90,
15
+ rfRotate180,
16
+ rfRotate270,
17
+
18
+ rfFlipX,
19
+ rfRotate90FlipX,
20
+ rfRotate180FlipX,
21
+ rfRotate270FlipX,
22
+
23
+ rfFlipY = rfRotate180FlipX,
24
+ rfRotate90FlipY = rfRotate270FlipX,
25
+ rfRotate180FlipY = rfFlipX,
26
+ rfRotate270FlipY = rfRotate90FlipX,
27
+
28
+ rfFlipXRotate90 = rfRotate270FlipX,
29
+ rfFlipXRotate180 = rfRotate180FlipX,
30
+ rfFlipXRotate270 = rfRotate90FlipX,
31
+
32
+ rfFlipYRotate90 = rfRotate90FlipX,
33
+ rfFlipYRotate180 = rfFlipX,
34
+ rfFlipYRotate270 = rfRotate270FlipX
35
+ };
36
+
37
+ //! Light-weight class that encodes a rotation by 0, 90, 180, or 270
38
+ //! degrees as well as optional horizontal and/or vertical flips.
39
+ //! In short, this convieniently encodes the eight ways in which a
40
+ //! aligned rectangle can be linearly transformed to result in an aligned
41
+ //! rectangle again.
42
+ //! Especially useful for games with tile-based maps.
43
+ class RotFlip
44
+ {
45
+ RotFlipName name_;
46
+
47
+ typedef RotFlipName TransTable[8];
48
+ static const TransTable flipXTable, flipYTable, rotate90Table,
49
+ rotate180Table, rotate270Table;
50
+
51
+ typedef unsigned CornerTable[8][4];
52
+ static const CornerTable mapCornerTable, realCornerTable;
53
+
54
+ public:
55
+ RotFlip(RotFlipName name = rfDefault)
56
+ : name_(name)
57
+ {
58
+ }
59
+
60
+ RotFlipName name() const
61
+ {
62
+ return name_;
63
+ }
64
+
65
+ void flipX()
66
+ {
67
+ name_ = flipXTable[name_];
68
+ }
69
+
70
+ void flipY()
71
+ {
72
+ name_ = flipYTable[name_];
73
+ }
74
+
75
+ void rotate90()
76
+ {
77
+ name_ = rotate90Table[name_];
78
+ }
79
+
80
+ void rotate180()
81
+ {
82
+ name_ = rotate180Table[name_];
83
+ }
84
+
85
+ void rotate270()
86
+ {
87
+ name_ = rotate270Table[name_];
88
+ }
89
+
90
+ bool flipped() const
91
+ {
92
+ return name_ >= rfFlipX;
93
+ }
94
+
95
+ bool rotated() const
96
+ {
97
+ return name_ % 2 == 1;
98
+ }
99
+
100
+ unsigned mapCorner(unsigned n) const
101
+ {
102
+ return mapCornerTable[name_][n];
103
+ }
104
+
105
+ unsigned realCorner(unsigned n) const
106
+ {
107
+ return realCornerTable[name_][n];
108
+ }
109
+ };
110
+
111
+ inline bool operator==(RotFlip a, RotFlip b)
112
+ {
113
+ return a.name() == b.name();
114
+ }
115
+
116
+ inline bool operator!=(RotFlip a, RotFlip b)
117
+ {
118
+ return a.name() != b.name();
119
+ }
120
+
121
+ //! Applies a RotFlip to a point x/y in a square of side length max.
122
+ void applyToPoint(RotFlip rotFlip, int& x, int& y, int max);
123
+ }
124
+
125
+ #endif
@@ -1,129 +1,139 @@
1
- //! \file Sockets.hpp
2
- //! Interface of the three socket classes, MessageSocket, CommSocket and ListenerSocket.
3
-
4
- #ifndef GOSU_SOCKETS_HPP
5
- #define GOSU_SOCKETS_HPP
6
-
7
- #include <boost/cstdint.hpp>
8
- #include <boost/function.hpp>
9
- #include <boost/scoped_ptr.hpp>
10
- #include <cstddef>
11
- #include <string>
12
-
13
- namespace Gosu
14
- {
15
- // Both addresses and ports are returned from and given to Gosu
16
- // functions in host byte order.
17
- typedef boost::uint32_t SocketAddress;
18
- typedef boost::uint16_t SocketPort;
19
- const SocketPort anyPort = 0;
20
-
21
- //! Tries to convert a dotted IP4 string into an address suitable for
22
- //! socket functions. If the string supplied is not such a string, it
23
- //! tries to look up the host via DNS. If both methods fail, zero is
24
- //! returned.
25
- SocketAddress stringToAddress(const std::string& s);
26
- //! Converts an address into a dotted IP4 string.
27
- std::string addressToString(SocketAddress address);
28
-
29
- //! Wraps an UDP socket. Message sockets can send data to and receive
30
- //! data from arbitrary addresses. Also, message sockets send messages
31
- //! (packets) which are limited in size and can arrive in any order, or
32
- //! not at all.
33
- class MessageSocket
34
- {
35
- struct Impl;
36
- boost::scoped_ptr<Impl> pimpl;
37
-
38
- public:
39
- //! Opens a message socket for listening at the specified port.
40
- //! Gosu::anyPort may be passed to have the message socket use
41
- //! a random free port.
42
- explicit MessageSocket(SocketPort port);
43
- ~MessageSocket();
44
-
45
- //! Returns the local address of the socket.
46
- SocketAddress address() const;
47
- //! Returns the local port of the socket.
48
- SocketPort port() const;
49
- //! Returns the maximum size, in bytes, of a packet that can be sent
50
- //! from this socket.
51
- std::size_t maxMessageSize() const;
52
-
53
- //! Collects all the packets that were sent to this socket and
54
- //! calls onReceive for each of them.
55
- void update();
56
-
57
- //! Sends something to the given port of the computer identified
58
- //! by the address.
59
- void send(SocketAddress address, SocketPort port,
60
- const void* buffer, std::size_t size);
61
- /*void broadcast(SocketPort port, const void* buffer,
62
- std::size_t size);*/
63
-
64
- //! If assigned, will be called by update for every packet received.
65
- boost::function<void (SocketAddress, SocketPort, const void*,
66
- std::size_t)> onReceive;
67
- };
68
-
69
- enum CommMode
70
- {
71
- cmRaw,
72
- //cmLines,
73
- cmManaged
74
- };
75
-
76
- class Socket;
77
-
78
- class CommSocket
79
- {
80
- struct Impl;
81
- boost::scoped_ptr<Impl> pimpl;
82
-
83
- public:
84
- CommSocket(CommMode mode, SocketAddress targetAddress,
85
- SocketPort targetPort);
86
- CommSocket(CommMode mode, Socket& socket);
87
- ~CommSocket();
88
-
89
- SocketAddress address() const;
90
- SocketPort port() const;
91
- SocketAddress remoteAddress() const;
92
- SocketPort remotePort() const;
93
- CommMode mode() const;
94
-
95
- bool connected() const;
96
- void disconnect();
97
- bool keepAlive() const;
98
- void setKeepAlive(bool value);
99
-
100
- void update();
101
- void send(const void* buffer, std::size_t size);
102
- void sendPendingData();
103
- std::size_t pendingBytes() const;
104
-
105
- boost::function<void (const void*, std::size_t)> onReceive;
106
- boost::function<void ()> onDisconnection;
107
- };
108
-
109
- class ListenerSocket
110
- {
111
- struct Impl;
112
- boost::scoped_ptr<Impl> pimpl;
113
-
114
- public:
115
- ListenerSocket(SocketPort port);
116
- ~ListenerSocket();
117
-
118
- SocketAddress address() const;
119
- SocketPort port() const;
120
-
121
- void update();
122
-
123
- // This signal is fired by update() whenever someone connects
124
- // to the port which is currently listened on.
125
- boost::function<void (Socket&)> onConnection;
126
- };
127
- }
128
-
129
- #endif
1
+ //! \file Sockets.hpp
2
+ //! Interface of the three socket classes, MessageSocket, CommSocket and ListenerSocket.
3
+
4
+ #ifndef GOSU_SOCKETS_HPP
5
+ #define GOSU_SOCKETS_HPP
6
+
7
+ #include <boost/cstdint.hpp>
8
+ #include <boost/function.hpp>
9
+ #include <boost/scoped_ptr.hpp>
10
+ #include <cstddef>
11
+ #include <string>
12
+
13
+ namespace Gosu
14
+ {
15
+ //! Addresses are returned from and given to Gosu functions in host byte order.
16
+ typedef boost::uint32_t SocketAddress;
17
+
18
+ //! Ports are returned from and given to Gosu functions in host byte order.
19
+ typedef boost::uint16_t SocketPort;
20
+
21
+ //! Constant that can be used as a placeholder for an arbitrary port, e.g. when
22
+ //! starting to listen.
23
+ const SocketPort anyPort = 0;
24
+
25
+ //! Tries to convert a dotted IP4 string into an address suitable for
26
+ //! socket functions. If the string supplied is not such a string, it
27
+ //! tries to look up the host via DNS. If both methods fail, zero is
28
+ //! returned.
29
+ SocketAddress stringToAddress(const std::string& s);
30
+ //! Converts an address into a dotted IP4 string.
31
+ std::string addressToString(SocketAddress address);
32
+
33
+ //! Wraps an UDP socket. Message sockets can send data to and receive
34
+ //! data from arbitrary addresses. Also, message sockets send messages
35
+ //! (packets) which are limited in size and can arrive in any order, or
36
+ //! not at all.
37
+ class MessageSocket
38
+ {
39
+ struct Impl;
40
+ boost::scoped_ptr<Impl> pimpl;
41
+
42
+ public:
43
+ //! Opens a message socket for listening at the specified port.
44
+ //! Gosu::anyPort may be passed to have the message socket use
45
+ //! a random free port.
46
+ explicit MessageSocket(SocketPort port);
47
+ ~MessageSocket();
48
+
49
+ //! Returns the local address of the socket.
50
+ SocketAddress address() const;
51
+ //! Returns the local port of the socket.
52
+ SocketPort port() const;
53
+ //! Returns the maximum size, in bytes, of a packet that can be sent
54
+ //! from this socket.
55
+ std::size_t maxMessageSize() const;
56
+
57
+ //! Collects all the packets that were sent to this socket and
58
+ //! calls onReceive for each of them.
59
+ void update();
60
+
61
+ //! Sends something to the given port of the computer identified
62
+ //! by the address.
63
+ void send(SocketAddress address, SocketPort port,
64
+ const void* buffer, std::size_t size);
65
+ /*void broadcast(SocketPort port, const void* buffer,
66
+ std::size_t size);*/
67
+
68
+ //! If assigned, will be called by update for every packet received.
69
+ boost::function<void (SocketAddress, SocketPort, const void*,
70
+ std::size_t)> onReceive;
71
+ };
72
+
73
+ //! Defines the way in which data is collected until the onReceive event
74
+ //! is called for CommSockets.
75
+ enum CommMode
76
+ {
77
+ cmRaw,
78
+ //cmLines,
79
+ cmManaged
80
+ };
81
+
82
+ class Socket;
83
+
84
+ //! Wraps a TCP socket that is used for one part of bi-directional
85
+ //! communication.
86
+ class CommSocket
87
+ {
88
+ struct Impl;
89
+ boost::scoped_ptr<Impl> pimpl;
90
+
91
+ public:
92
+ CommSocket(CommMode mode, SocketAddress targetAddress,
93
+ SocketPort targetPort);
94
+ CommSocket(CommMode mode, Socket& socket);
95
+ ~CommSocket();
96
+
97
+ SocketAddress address() const;
98
+ SocketPort port() const;
99
+ SocketAddress remoteAddress() const;
100
+ SocketPort remotePort() const;
101
+ CommMode mode() const;
102
+
103
+ bool connected() const;
104
+ void disconnect();
105
+ bool keepAlive() const;
106
+ void setKeepAlive(bool value);
107
+
108
+ void update();
109
+ void send(const void* buffer, std::size_t size);
110
+ void sendPendingData();
111
+ std::size_t pendingBytes() const;
112
+
113
+ boost::function<void (const void*, std::size_t)> onReceive;
114
+ boost::function<void ()> onDisconnection;
115
+ };
116
+
117
+ //! Wraps a TCP socket that waits on a specific port and can create
118
+ //! CommSocket instances via its onConnection event.
119
+ class ListenerSocket
120
+ {
121
+ struct Impl;
122
+ boost::scoped_ptr<Impl> pimpl;
123
+
124
+ public:
125
+ ListenerSocket(SocketPort port);
126
+ ~ListenerSocket();
127
+
128
+ SocketAddress address() const;
129
+ SocketPort port() const;
130
+
131
+ void update();
132
+
133
+ //! This signal is fired by update() whenever someone connects
134
+ //! to the port which is currently listened on.
135
+ boost::function<void (Socket&)> onConnection;
136
+ };
137
+ }
138
+
139
+ #endif