gosu 0.7.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. data/COPYING.txt +29 -0
  2. data/Gosu/Async.hpp +48 -0
  3. data/Gosu/Audio.hpp +145 -0
  4. data/Gosu/AutoLink.hpp +16 -0
  5. data/Gosu/Bitmap.hpp +85 -0
  6. data/Gosu/ButtonsMac.hpp +114 -0
  7. data/Gosu/ButtonsWin.hpp +111 -0
  8. data/Gosu/ButtonsX.hpp +115 -0
  9. data/Gosu/Color.hpp +172 -0
  10. data/Gosu/Directories.hpp +36 -0
  11. data/Gosu/Font.hpp +59 -0
  12. data/Gosu/Fwd.hpp +31 -0
  13. data/Gosu/Gosu.hpp +26 -0
  14. data/Gosu/Graphics.hpp +86 -0
  15. data/Gosu/GraphicsBase.hpp +45 -0
  16. data/Gosu/IO.hpp +255 -0
  17. data/Gosu/Image.hpp +148 -0
  18. data/Gosu/ImageData.hpp +45 -0
  19. data/Gosu/Input.hpp +116 -0
  20. data/Gosu/Math.hpp +95 -0
  21. data/Gosu/Platform.hpp +61 -0
  22. data/Gosu/RotFlip.hpp +116 -0
  23. data/Gosu/Sockets.hpp +129 -0
  24. data/Gosu/Text.hpp +47 -0
  25. data/Gosu/TextInput.hpp +57 -0
  26. data/Gosu/Timing.hpp +16 -0
  27. data/Gosu/Utility.hpp +24 -0
  28. data/Gosu/WinUtility.hpp +76 -0
  29. data/Gosu/Window.hpp +84 -0
  30. data/GosuImpl/Async.cpp +37 -0
  31. data/GosuImpl/AudioFmod.cpp +417 -0
  32. data/GosuImpl/AudioSDL.cpp +255 -0
  33. data/GosuImpl/DirectoriesMac.mm +38 -0
  34. data/GosuImpl/DirectoriesUnix.cpp +48 -0
  35. data/GosuImpl/DirectoriesWin.cpp +42 -0
  36. data/GosuImpl/FileUnix.cpp +100 -0
  37. data/GosuImpl/FileWin.cpp +83 -0
  38. data/GosuImpl/Graphics/Bitmap.cpp +116 -0
  39. data/GosuImpl/Graphics/BitmapBMP.cpp +232 -0
  40. data/GosuImpl/Graphics/BitmapColorKey.cpp +39 -0
  41. data/GosuImpl/Graphics/BitmapPNG.cpp +276 -0
  42. data/GosuImpl/Graphics/BitmapUtils.cpp +67 -0
  43. data/GosuImpl/Graphics/BlockAllocator.cpp +127 -0
  44. data/GosuImpl/Graphics/BlockAllocator.hpp +34 -0
  45. data/GosuImpl/Graphics/Color.cpp +126 -0
  46. data/GosuImpl/Graphics/Common.hpp +21 -0
  47. data/GosuImpl/Graphics/DrawOp.hpp +154 -0
  48. data/GosuImpl/Graphics/Font.cpp +110 -0
  49. data/GosuImpl/Graphics/Graphics.cpp +295 -0
  50. data/GosuImpl/Graphics/Image.cpp +159 -0
  51. data/GosuImpl/Graphics/LargeImageData.cpp +115 -0
  52. data/GosuImpl/Graphics/LargeImageData.hpp +37 -0
  53. data/GosuImpl/Graphics/RotFlip.cpp +184 -0
  54. data/GosuImpl/Graphics/TexChunk.cpp +77 -0
  55. data/GosuImpl/Graphics/TexChunk.hpp +40 -0
  56. data/GosuImpl/Graphics/Text.cpp +223 -0
  57. data/GosuImpl/Graphics/TextMac.cpp +242 -0
  58. data/GosuImpl/Graphics/TextPangoFT.cpp +186 -0
  59. data/GosuImpl/Graphics/TextWin.cpp +172 -0
  60. data/GosuImpl/Graphics/Texture.cpp +104 -0
  61. data/GosuImpl/Graphics/Texture.hpp +34 -0
  62. data/GosuImpl/IO.cpp +48 -0
  63. data/GosuImpl/InputMac.mm +677 -0
  64. data/GosuImpl/InputWin.cpp +444 -0
  65. data/GosuImpl/InputX.cpp +158 -0
  66. data/GosuImpl/MacUtility.hpp +48 -0
  67. data/GosuImpl/Math.cpp +49 -0
  68. data/GosuImpl/RubyGosu.swg +474 -0
  69. data/GosuImpl/RubyGosuStub.mm +17 -0
  70. data/GosuImpl/RubyGosu_DllMain.cxx +30 -0
  71. data/GosuImpl/RubyGosu_wrap.cxx +8521 -0
  72. data/GosuImpl/RubyGosu_wrap.h +31 -0
  73. data/GosuImpl/Sockets/CommSocket.cpp +304 -0
  74. data/GosuImpl/Sockets/ListenerSocket.cpp +60 -0
  75. data/GosuImpl/Sockets/MessageSocket.cpp +136 -0
  76. data/GosuImpl/Sockets/Socket.cpp +145 -0
  77. data/GosuImpl/Sockets/Sockets.hpp +66 -0
  78. data/GosuImpl/TextInputMac.mm +207 -0
  79. data/GosuImpl/TextInputWin.cpp +197 -0
  80. data/GosuImpl/TextInputX.cpp +201 -0
  81. data/GosuImpl/TextTTFWin.cpp +247 -0
  82. data/GosuImpl/TimingUnix.cpp +17 -0
  83. data/GosuImpl/TimingWin.cpp +28 -0
  84. data/GosuImpl/Utility.cpp +140 -0
  85. data/GosuImpl/WinMain.cpp +69 -0
  86. data/GosuImpl/WinUtility.cpp +137 -0
  87. data/GosuImpl/WindowMac.mm +466 -0
  88. data/GosuImpl/WindowWin.cpp +447 -0
  89. data/GosuImpl/WindowX.cpp +392 -0
  90. data/GosuImpl/X11vroot.h +118 -0
  91. data/README.txt +13 -0
  92. data/Rakefile +178 -0
  93. data/examples/ChipmunkIntegration.rb +275 -0
  94. data/examples/CptnRuby.rb +231 -0
  95. data/examples/MoreChipmunkAndRMagick.rb +155 -0
  96. data/examples/OpenGLIntegration.rb +232 -0
  97. data/examples/RMagickIntegration.rb +449 -0
  98. data/examples/TextInput.cpp +170 -0
  99. data/examples/TextInput.rb +139 -0
  100. data/examples/Tutorial.cpp +215 -0
  101. data/examples/Tutorial.rb +137 -0
  102. data/examples/media/Beep.wav +0 -0
  103. data/examples/media/CptnRuby Gem.png +0 -0
  104. data/examples/media/CptnRuby Map.txt +25 -0
  105. data/examples/media/CptnRuby Tileset.png +0 -0
  106. data/examples/media/CptnRuby.png +0 -0
  107. data/examples/media/Cursor.png +0 -0
  108. data/examples/media/Earth.png +0 -0
  109. data/examples/media/Explosion.wav +0 -0
  110. data/examples/media/LargeStar.png +0 -0
  111. data/examples/media/Sky.jpg +0 -0
  112. data/examples/media/Smoke.png +0 -0
  113. data/examples/media/Soldier.png +0 -0
  114. data/examples/media/Space.png +0 -0
  115. data/examples/media/Star.png +0 -0
  116. data/examples/media/Starfighter.bmp +0 -0
  117. data/linux/Makefile.in +98 -0
  118. data/linux/configure +5658 -0
  119. data/linux/configure.ac +126 -0
  120. data/linux/extconf.rb +11 -0
  121. data/mac/English.lproj/InfoPlist.strings +0 -0
  122. data/mac/Gosu-Info.plist +26 -0
  123. data/mac/Gosu.xcodeproj/project.pbxproj +1194 -0
  124. data/mac/RubyGosu Template-Info.plist +26 -0
  125. data/mac/libboost_thread_1_34_1_universal.a +0 -0
  126. data/mac/libboost_thread_d_1_34_1_universal.a +0 -0
  127. data/mac/libfmod_universal.a +0 -0
  128. data/mac/libpng_universal.a +0 -0
  129. data/mac/libz_universal.a +0 -0
  130. data/reference/Async_8hpp-source.html +70 -0
  131. data/reference/Audio_8hpp-source.html +114 -0
  132. data/reference/Audio_8hpp.html +50 -0
  133. data/reference/AutoLink_8hpp-source.html +38 -0
  134. data/reference/AutoLink_8hpp.html +34 -0
  135. data/reference/Bitmap_8hpp-source.html +85 -0
  136. data/reference/Bitmap_8hpp.html +58 -0
  137. data/reference/ButtonsMac_8hpp-source.html +133 -0
  138. data/reference/ButtonsWin_8hpp-source.html +133 -0
  139. data/reference/ButtonsX_8hpp-source.html +134 -0
  140. data/reference/Color_8hpp-source.html +169 -0
  141. data/reference/Color_8hpp.html +85 -0
  142. data/reference/Directories_8hpp-source.html +42 -0
  143. data/reference/Directories_8hpp.html +46 -0
  144. data/reference/Font_8hpp-source.html +65 -0
  145. data/reference/Font_8hpp.html +41 -0
  146. data/reference/Fwd_8hpp-source.html +52 -0
  147. data/reference/Fwd_8hpp.html +37 -0
  148. data/reference/Gosu_8hpp-source.html +48 -0
  149. data/reference/Gosu_8hpp.html +34 -0
  150. data/reference/GraphicsBase_8hpp-source.html +57 -0
  151. data/reference/GraphicsBase_8hpp.html +56 -0
  152. data/reference/Graphics_8hpp-source.html +96 -0
  153. data/reference/Graphics_8hpp.html +53 -0
  154. data/reference/IO_8hpp-source.html +255 -0
  155. data/reference/IO_8hpp.html +74 -0
  156. data/reference/ImageData_8hpp-source.html +62 -0
  157. data/reference/ImageData_8hpp.html +43 -0
  158. data/reference/Image_8hpp-source.html +126 -0
  159. data/reference/Image_8hpp.html +48 -0
  160. data/reference/Input_8hpp-source.html +118 -0
  161. data/reference/Input_8hpp.html +50 -0
  162. data/reference/Math_8hpp-source.html +92 -0
  163. data/reference/Math_8hpp.html +74 -0
  164. data/reference/Platform_8hpp-source.html +83 -0
  165. data/reference/Platform_8hpp.html +73 -0
  166. data/reference/RotFlip_8hpp-source.html +138 -0
  167. data/reference/RotFlip_8hpp.html +77 -0
  168. data/reference/Sockets_8hpp-source.html +130 -0
  169. data/reference/Sockets_8hpp.html +66 -0
  170. data/reference/TextInput_8hpp-source.html +64 -0
  171. data/reference/TextInput_8hpp.html +41 -0
  172. data/reference/Text_8hpp-source.html +51 -0
  173. data/reference/Text_8hpp.html +46 -0
  174. data/reference/Timing_8hpp-source.html +36 -0
  175. data/reference/Timing_8hpp.html +42 -0
  176. data/reference/Utility_8hpp-source.html +44 -0
  177. data/reference/Utility_8hpp.html +48 -0
  178. data/reference/WinUtility_8hpp-source.html +79 -0
  179. data/reference/WinUtility_8hpp.html +64 -0
  180. data/reference/Window_8hpp-source.html +91 -0
  181. data/reference/Window_8hpp.html +41 -0
  182. data/reference/annotated.html +51 -0
  183. data/reference/classGosu_1_1Audio-members.html +34 -0
  184. data/reference/classGosu_1_1Audio.html +46 -0
  185. data/reference/classGosu_1_1Bitmap-members.html +44 -0
  186. data/reference/classGosu_1_1Bitmap.html +263 -0
  187. data/reference/classGosu_1_1Buffer-members.html +44 -0
  188. data/reference/classGosu_1_1Buffer.html +78 -0
  189. data/reference/classGosu_1_1Buffer.png +0 -0
  190. data/reference/classGosu_1_1Button-members.html +36 -0
  191. data/reference/classGosu_1_1Button.html +143 -0
  192. data/reference/classGosu_1_1Color-members.html +56 -0
  193. data/reference/classGosu_1_1Color.html +387 -0
  194. data/reference/classGosu_1_1File-members.html +41 -0
  195. data/reference/classGosu_1_1File.html +69 -0
  196. data/reference/classGosu_1_1File.png +0 -0
  197. data/reference/classGosu_1_1Font-members.html +39 -0
  198. data/reference/classGosu_1_1Font.html +309 -0
  199. data/reference/classGosu_1_1Graphics-members.html +50 -0
  200. data/reference/classGosu_1_1Graphics.html +234 -0
  201. data/reference/classGosu_1_1Image-members.html +45 -0
  202. data/reference/classGosu_1_1Image.html +518 -0
  203. data/reference/classGosu_1_1ImageData-members.html +37 -0
  204. data/reference/classGosu_1_1ImageData.html +60 -0
  205. data/reference/classGosu_1_1Input-members.html +44 -0
  206. data/reference/classGosu_1_1Input.html +223 -0
  207. data/reference/classGosu_1_1MessageSocket-members.html +40 -0
  208. data/reference/classGosu_1_1MessageSocket.html +233 -0
  209. data/reference/classGosu_1_1Resource-members.html +39 -0
  210. data/reference/classGosu_1_1Resource.html +116 -0
  211. data/reference/classGosu_1_1Resource.png +0 -0
  212. data/reference/classGosu_1_1Sample-members.html +37 -0
  213. data/reference/classGosu_1_1Sample.html +200 -0
  214. data/reference/classGosu_1_1SampleInstance-members.html +38 -0
  215. data/reference/classGosu_1_1SampleInstance.html +169 -0
  216. data/reference/classGosu_1_1Song-members.html +43 -0
  217. data/reference/classGosu_1_1Song.html +260 -0
  218. data/reference/classGosu_1_1TextInput-members.html +38 -0
  219. data/reference/classGosu_1_1TextInput.html +121 -0
  220. data/reference/classGosu_1_1Window-members.html +50 -0
  221. data/reference/classGosu_1_1Window.html +271 -0
  222. data/reference/doxyfile +233 -0
  223. data/reference/doxygen.css +433 -0
  224. data/reference/doxygen.png +0 -0
  225. data/reference/files.html +54 -0
  226. data/reference/functions.html +236 -0
  227. data/reference/functions_enum.html +45 -0
  228. data/reference/functions_func.html +227 -0
  229. data/reference/functions_vars.html +47 -0
  230. data/reference/hierarchy.html +53 -0
  231. data/reference/index.html +26 -0
  232. data/reference/namespaceGosu.html +2890 -0
  233. data/reference/namespaceGosu_1_1Colors.html +70 -0
  234. data/reference/namespaceGosu_1_1Win.html +275 -0
  235. data/reference/namespacemembers.html +216 -0
  236. data/reference/namespacemembers_enum.html +52 -0
  237. data/reference/namespacemembers_eval.html +54 -0
  238. data/reference/namespacemembers_func.html +185 -0
  239. data/reference/namespacemembers_type.html +46 -0
  240. data/reference/namespacemembers_vars.html +46 -0
  241. data/reference/namespaces.html +35 -0
  242. data/reference/tab_b.gif +0 -0
  243. data/reference/tab_l.gif +0 -0
  244. data/reference/tab_r.gif +0 -0
  245. data/reference/tabs.css +102 -0
  246. data/windows/Gosu.sln +29 -0
  247. data/windows/Gosu.vcproj +553 -0
  248. data/windows/RubyGosu.vcproj +138 -0
  249. metadata +305 -0
@@ -0,0 +1,29 @@
1
+ Copyright (C) 2004-2007 Julian Raschke, Jan Lücker and all contributors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a
4
+ copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19
+ DEALINGS IN THE SOFTWARE.
20
+
21
+ Julian Raschke julian@raschke.de
22
+ Jan Lücker jan.luecker@gmx.de
23
+ http://code.google.com/p/gosu/
24
+
25
+ ***
26
+
27
+ Does NOT apply to fmod.dll shipped with the Windows version of Gosu,
28
+ or the bytecode of FMOD contained in Gosu.framework and gosu.bundle on OS X.
29
+ FMOD is a property of Firelight Technologies Pty, Ltd., see www.fmod.org.
@@ -0,0 +1,48 @@
1
+ // Undocumented for the first few iterations. Interface may change rapidly.
2
+ // This is mainly a proof of concept. Stability will be the highest on OS X.
3
+
4
+ #ifndef GOSU_ASYNC_HPP
5
+ #define GOSU_ASYNC_HPP
6
+
7
+ #include <Gosu/Fwd.hpp>
8
+ #include <boost/shared_ptr.hpp>
9
+ #include <boost/thread.hpp>
10
+ #include <memory>
11
+ #include <string>
12
+
13
+ namespace Gosu
14
+ {
15
+ template<typename Result>
16
+ class AsyncResult
17
+ {
18
+ boost::shared_ptr<boost::try_mutex> mutex;
19
+ boost::shared_ptr<std::auto_ptr<Result> > result;
20
+
21
+ public:
22
+ AsyncResult(const boost::shared_ptr<boost::try_mutex>& mutex,
23
+ const boost::shared_ptr<std::auto_ptr<Result> >& result)
24
+ : mutex(mutex), result(result)
25
+ {
26
+ }
27
+
28
+ bool hasValue() const
29
+ {
30
+ boost::try_mutex::scoped_try_lock lock(*mutex);
31
+ return lock && result->get();
32
+ }
33
+
34
+ std::auto_ptr<Result> takeValue()
35
+ {
36
+ boost::try_mutex::scoped_lock lock(*mutex);
37
+ return *result;
38
+ }
39
+ };
40
+
41
+ // TODO: Will only work if the window doesn't die inbetween.
42
+ // TODO: More functions to come; or a general interface?
43
+
44
+ AsyncResult<Image>
45
+ asyncNewImage(Window& window, const std::wstring& filename);
46
+ }
47
+
48
+ #endif
@@ -0,0 +1,145 @@
1
+ //! \file Audio.hpp
2
+ //! Contains all the classes of Gosu's audio system.
3
+
4
+ // REDESIGN: Rename all changeXXX() member functions to setXXX().
5
+ // REDESIGN: Don't require window argument, is this possible?
6
+
7
+ #ifndef GOSU_AUDIO_HPP
8
+ #define GOSU_AUDIO_HPP
9
+
10
+ #ifdef WIN32
11
+ #include <windows.h>
12
+ #endif
13
+ #include <Gosu/Fwd.hpp>
14
+ #include <Gosu/Platform.hpp>
15
+ #include <boost/scoped_ptr.hpp>
16
+ #include <boost/utility.hpp>
17
+ #include <string>
18
+
19
+ namespace Gosu
20
+ {
21
+ //! Manages initialization and finalization of audio libraries. Must be
22
+ //! created before and destroyed after all samples and songs.
23
+ //! There can only be one instance of Gosu::Audio.
24
+ //! Usually created internally by Gosu::Window.
25
+ class Audio : boost::noncopyable
26
+ {
27
+ public:
28
+ #ifdef GOSU_IS_WIN
29
+ explicit Audio(HWND window);
30
+ #else
31
+ Audio();
32
+ #endif
33
+ ~Audio();
34
+ };
35
+
36
+ //! An instance of a Sample playing. Can be used to stop sounds dynamically,
37
+ //! or to check if they are finished.
38
+ //! It is recommended that you throw away sample instances if possible,
39
+ //! as they could accidentally refer to sounds played very long ago.
40
+ class SampleInstance
41
+ {
42
+ int handle, extra;
43
+
44
+ public:
45
+ //! Called by Sample, do not use.
46
+ SampleInstance(int handle, int extra);
47
+
48
+ bool playing() const;
49
+ void stop();
50
+
51
+ //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
52
+ //! volume).
53
+ void changeVolume(double volume);
54
+ //! \param pan Can be anything from -1.0 (left) to 1.0 (right).
55
+ void changePan(double pan);
56
+ //! \param speed Playback speed is only limited by FMOD's
57
+ //! capatibilities and can accept very high or low values. Use 1.0 for
58
+ //! normal playback speed.
59
+ void changeSpeed(double speed);
60
+ };
61
+
62
+ //! A sample is a short sound that is completely loaded in memory, can be
63
+ //! played multiple times at once and offers very flexible playback
64
+ //! parameters. In short, use samples for everything that's not music.
65
+ class Sample
66
+ {
67
+ struct SampleData;
68
+ boost::scoped_ptr<SampleData> data;
69
+
70
+ public:
71
+ //! Constructs a sample that can be played on the specified audio
72
+ //! system and loads the sample from a file.
73
+ Sample(Audio& audio, const std::wstring& filename);
74
+
75
+ //! Constructs a sample that can be played on the specified audio
76
+ //! system and loads the sample data from a stream.
77
+ Sample(Audio& audio, Reader reader);
78
+
79
+ ~Sample();
80
+
81
+ //! Plays the sample without panning.
82
+ //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
83
+ //! volume).
84
+ //! \param speed Playback speed is only limited by FMOD's
85
+ //! capatibilities and can accept very high or low values. Use 1.0 for
86
+ //! normal playback speed.
87
+ SampleInstance play(double volume = 1, double speed = 1) const;
88
+
89
+ //! Plays the sample with panning. Even if pan is 0.0, the sample will
90
+ //! not be as loud as if it were played by calling play() due to the
91
+ //! way FMOD's panning works.
92
+ //! \param pan Can be anything from -1.0 (left) to 1.0 (right).
93
+ //! \param volume Can be anything from 0.0 (silence) to 1.0 (full
94
+ //! volume).
95
+ //! \param speed Playback speed is only limited by FMOD's
96
+ //! capatibilities and can accept very high or low values. Use 1.0 for
97
+ //! normal playback speed.
98
+ SampleInstance playPan(double pan, double volume = 1, double speed = 1) const;
99
+ };
100
+
101
+ //! Songs are less flexible than samples in that they can only be played
102
+ //! one at a time and without panning or speed parameters.
103
+ class Song
104
+ {
105
+ class BaseData;
106
+ class ModuleData;
107
+ class StreamData;
108
+ boost::scoped_ptr<BaseData> data;
109
+
110
+ public:
111
+ //! There are two types of songs that can be loaded as a Song: Streamed
112
+ //! songs (like OGG) and modules (like MOD or XM).
113
+ enum Type
114
+ {
115
+ stStream,
116
+ stModule
117
+ };
118
+
119
+ //! Constructs a song that can be played on the provided audio system
120
+ //! and loads the song from a file. The type is determined from the
121
+ //! filename.
122
+ Song(Audio&, const std::wstring& filename);
123
+
124
+ //! Constructs a song of the specified type that can be played on the
125
+ //! provided audio system and loads the song data from a stream.
126
+ Song(Audio&, Type type, Reader reader);
127
+
128
+ ~Song();
129
+
130
+ //! Starts playback of the song. This will stop all other songs and
131
+ //! cause the currently played song to restart if called on the
132
+ //! current song.
133
+ void play();
134
+ //! Stops playback of this song if it is currently played.
135
+ void stop();
136
+ //! Returns if the song is currently playing.
137
+ bool playing() const;
138
+ //! Returns the current volume of the song.
139
+ double volume() const;
140
+ //! Changes the volume of the song.
141
+ void changeVolume(double volume);
142
+ };
143
+ }
144
+
145
+ #endif
@@ -0,0 +1,16 @@
1
+ //! \file AutoLink.hpp
2
+ //! Contains pragmas that make MSVC link against all the necessary libraries
3
+ //! automatically.
4
+
5
+ #ifdef _MSC_VER
6
+ #ifndef GOSU_AUTOLINK_HPP
7
+ #define GOSU_AUTOLINK_HPP
8
+
9
+ #ifdef NDEBUG
10
+ #pragma comment(lib, "Gosu.lib")
11
+ #else
12
+ #pragma comment(lib, "GosuDebug.lib")
13
+ #endif
14
+
15
+ #endif
16
+ #endif
@@ -0,0 +1,85 @@
1
+ //! \file Bitmap.hpp
2
+ //! Interface of the Bitmap class.
3
+
4
+ #ifndef GOSU_BITMAP_HPP
5
+ #define GOSU_BITMAP_HPP
6
+
7
+ #include <Gosu/Color.hpp>
8
+ #include <Gosu/Fwd.hpp>
9
+ #include <Gosu/GraphicsBase.hpp>
10
+ #include <boost/scoped_ptr.hpp>
11
+ #include <string>
12
+ #include <vector>
13
+
14
+ namespace Gosu
15
+ {
16
+ //! Rectangular area of pixels, each represented by a Color value. Provides
17
+ //! minimal drawing functionality and serves as a temporary holder for
18
+ //! graphical resources which are usually turned into Images later.
19
+ //! Has (expensive) value semantics.
20
+ class Bitmap
21
+ {
22
+ unsigned w, h;
23
+ std::vector<Color> pixels;
24
+
25
+ public:
26
+ Bitmap();
27
+
28
+ unsigned width() const { return w; }
29
+ unsigned height() const { return h; }
30
+
31
+ void swap(Bitmap& other);
32
+
33
+ void resize(unsigned width, unsigned height, Color c = Colors::none);
34
+
35
+ void fill(Color c);
36
+ void replace(Color oldColor, Color newColor);
37
+
38
+ //! Returns the color at the specified position. x and y must be on the
39
+ //! bitmap.
40
+ Color getPixel(unsigned x, unsigned y) const { return pixels[y * w + x]; }
41
+
42
+ //! Sets the pixel at the specified position to a color. x and y must
43
+ //! be on the bitmap.
44
+ void setPixel(unsigned x, unsigned y, Color c) { pixels[y * w + x] = c; }
45
+
46
+ //! Inserts a bitmap at the given position. Parts of the inserted
47
+ //! bitmap that would be outside of the target bitmap will be
48
+ //! clipped away.
49
+ void insert(const Bitmap& source, int x, int y);
50
+
51
+ //! Inserts a portion of a bitmap at the given position. Parts of the
52
+ //! inserted bitmap that would be outside of the target bitmap will be
53
+ //! clipped away.
54
+ void insert(const Bitmap& source, int x, int y, unsigned srcX,
55
+ unsigned srcY, unsigned srcWidth, unsigned srcHeight);
56
+
57
+ #ifndef __BIG_ENDIAN__
58
+ //! Undocumented optimization for Image creation; to be changed.
59
+ const unsigned* glCompatibleData() const { return reinterpret_cast<const unsigned*>(&pixels[0]); }
60
+ #endif
61
+ };
62
+
63
+ //! Loads a Windows or OS/2 BMP file into the given bitmap.
64
+ Reader loadFromBMP(Bitmap& bmp, Reader reader);
65
+ //! Saves the contents of the given bitmap into windows BMP file data.
66
+ Writer saveToBMP(const Bitmap& bmp, Writer writer);
67
+ //! Loads a PNG file into the given bitmap.
68
+ Reader loadFromPNG(Bitmap& bmp, Reader reader);
69
+ //! Saves the contents of the given bitmap into PNG file data, 24 bits.
70
+ Writer saveToPNG(const Bitmap& bmp, Writer writer);
71
+
72
+ //! Set the alpha value of all pixels which are equal to the color key
73
+ //! to zero. Color values are adjusted so that no borders show up when
74
+ //! the image is stretched or rotated.
75
+ void applyColorKey(Bitmap& bitmap, Color key);
76
+
77
+ void applyBorderFlags(Bitmap& dest, const Bitmap& source,
78
+ unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
79
+ unsigned borderFlags);
80
+
81
+ // Still to be moved around & undocumented, beware! (TODO)
82
+ Bitmap quickLoadBitmap(const std::wstring& filename);
83
+ }
84
+
85
+ #endif
@@ -0,0 +1,114 @@
1
+ #ifndef GOSU_BUTTONSMAC_HPP
2
+ #define GOSU_BUTTONSMAC_HPP
3
+
4
+ namespace Gosu
5
+ {
6
+ //! List of all the button ids that can be used with Gosu::Input.
7
+ //! This enumeration contains ids for non-character keyboard keys (kb*),
8
+ //! mouse buttons and mouse wheel (ms*) and gamepad buttons (gp*).
9
+ enum ButtonName
10
+ {
11
+ kbRangeBegin = 0x01,
12
+ kbEscape = 0x35,
13
+ kbF1 = 0x7a,
14
+ kbF2 = 0x78,
15
+ kbF3 = 0x63,
16
+ kbF4 = 0x76,
17
+ kbF5 = 0x60,
18
+ kbF6 = 0x61,
19
+ kbF7 = 0x62,
20
+ kbF8 = 0x64,
21
+ kbF9 = 0x65,
22
+ kbF10 = 0x6d,
23
+ kbF11 = 0x67,
24
+ kbF12 = 0x6f,
25
+ kb1 = 0x12,
26
+ kb2 = 0x13,
27
+ kb3 = 0x14,
28
+ kb4 = 0x15,
29
+ kb5 = 0x17,
30
+ kb6 = 0x16,
31
+ kb7 = 0x1a,
32
+ kb8 = 0x1c,
33
+ kb9 = 0x19,
34
+ kb0 = 0x1d,
35
+ kbTab = 0x30,
36
+ kbReturn = 0x24,
37
+ kbSpace = 0x31,
38
+ kbLeftShift = 0x38,
39
+ kbRightShift = 0x3c,
40
+ kbLeftControl = 0x3b,
41
+ kbRightControl = 0x3e,
42
+ kbLeftAlt = 0x3a,
43
+ kbRightAlt = 0x3d,
44
+ kbLeftMeta = 0x37,
45
+ kbRightMeta = 0x36,
46
+ kbBackspace = 0x33,
47
+ kbLeft = 0x7b,
48
+ kbRight = 0x7c,
49
+ kbUp = 0x7e,
50
+ kbDown = 0x7d,
51
+ kbHome = 0x73,
52
+ kbEnd = 0x77,
53
+ kbInsert = 0x72,
54
+ kbDelete = 0x75,
55
+ kbPageUp = 0x74,
56
+ kbPageDown = 0x79,
57
+ kbEnter = 0x4c,
58
+ kbNumpad1 = 0x53,
59
+ kbNumpad2 = 0x54,
60
+ kbNumpad3 = 0x55,
61
+ kbNumpad4 = 0x56,
62
+ kbNumpad5 = 0x57,
63
+ kbNumpad6 = 0x58,
64
+ kbNumpad7 = 0x59,
65
+ kbNumpad8 = 0x5b,
66
+ kbNumpad9 = 0x5c,
67
+ kbNumpad0 = 0x52,
68
+ kbNumpadAdd = 0x45,
69
+ kbNumpadSubtract = 0x4e,
70
+ kbNumpadMultiply = 0x43,
71
+ kbNumpadDivide = 0x4b,
72
+ kbRangeEnd = 0xffff,
73
+
74
+ msRangeBegin,
75
+ msLeft = msRangeBegin,
76
+ msRight,
77
+ msMiddle,
78
+ msWheelUp,
79
+ msWheelDown,
80
+ msRangeEnd,
81
+
82
+ gpRangeBegin,
83
+ gpLeft = gpRangeBegin,
84
+ gpRight,
85
+ gpUp,
86
+ gpDown,
87
+ gpButton0,
88
+ gpButton1,
89
+ gpButton2,
90
+ gpButton3,
91
+ gpButton4,
92
+ gpButton5,
93
+ gpButton6,
94
+ gpButton7,
95
+ gpButton8,
96
+ gpButton9,
97
+ gpButton10,
98
+ gpButton11,
99
+ gpButton12,
100
+ gpButton13,
101
+ gpButton14,
102
+ gpButton15,
103
+ gpRangeEnd = gpButton15,
104
+
105
+ kbNum = kbRangeEnd - kbRangeBegin + 1,
106
+ msNum = msRangeEnd - msRangeBegin + 1,
107
+ gpNum = gpRangeEnd - gpRangeBegin + 1,
108
+
109
+ numButtons = gpRangeEnd + 1,
110
+ noButton = 0xffffffff
111
+ };
112
+ }
113
+
114
+ #endif
@@ -0,0 +1,111 @@
1
+ #ifndef GOSU_BUTTONSWIN_HPP
2
+ #define GOSU_BUTTONSWIN_HPP
3
+
4
+ namespace Gosu
5
+ {
6
+ enum ButtonName
7
+ {
8
+ kbRangeBegin = 1,
9
+ kbEscape = 0x01,
10
+ kbF1 = 0x3b,
11
+ kbF2 = 0x3c,
12
+ kbF3 = 0x3d,
13
+ kbF4 = 0x3e,
14
+ kbF5 = 0x3f,
15
+ kbF6 = 0x40,
16
+ kbF7 = 0x41,
17
+ kbF8 = 0x42,
18
+ kbF9 = 0x43,
19
+ kbF10 = 0x44,
20
+ kbF11 = 0x57,
21
+ kbF12 = 0x58,
22
+ kb0 = 0x0b,
23
+ kb1 = 0x02,
24
+ kb2 = 0x03,
25
+ kb3 = 0x04,
26
+ kb4 = 0x05,
27
+ kb5 = 0x06,
28
+ kb6 = 0x07,
29
+ kb7 = 0x08,
30
+ kb8 = 0x09,
31
+ kb9 = 0x0a,
32
+ kbTab = 0x0f,
33
+ kbReturn = 0x1c,
34
+ kbSpace = 0x39,
35
+ kbLeftShift = 0x2a,
36
+ kbRightShift = 0x36,
37
+ kbLeftControl = 0x1d,
38
+ kbRightControl = 0x9d,
39
+ kbLeftAlt = 0x38,
40
+ kbRightAlt = 0xb8,
41
+ kbLeftMeta = 0xdb,
42
+ kbRightMeta = 0xdc,
43
+ kbBackspace = 0x0e,
44
+ kbLeft = 0xcb,
45
+ kbRight = 0xcd,
46
+ kbUp = 0xc8,
47
+ kbDown = 0xd0,
48
+ kbHome = 0xc7,
49
+ kbEnd = 0xcf,
50
+ kbInsert = 0xd2,
51
+ kbDelete = 0xd3,
52
+ kbPageUp = 0xc9,
53
+ kbPageDown = 0xd1,
54
+ kbEnter = 0x9c,
55
+ kbNumpad0 = 0x52,
56
+ kbNumpad1 = 0x4f,
57
+ kbNumpad2 = 0x50,
58
+ kbNumpad3 = 0x51,
59
+ kbNumpad4 = 0x4b,
60
+ kbNumpad5 = 0x4c,
61
+ kbNumpad6 = 0x4d,
62
+ kbNumpad7 = 0x47,
63
+ kbNumpad8 = 0x48,
64
+ kbNumpad9 = 0x49,
65
+ kbNumpadAdd = 0x4e,
66
+ kbNumpadSubtract = 0x4a,
67
+ kbNumpadMultiply = 0x37,
68
+ kbNumpadDivide = 0xb5,
69
+ kbRangeEnd = 0xff,
70
+
71
+ msRangeBegin,
72
+ msLeft = msRangeBegin,
73
+ msRight,
74
+ msMiddle,
75
+ msWheelUp,
76
+ msWheelDown,
77
+ msRangeEnd,
78
+
79
+ gpRangeBegin,
80
+ gpLeft = gpRangeBegin,
81
+ gpRight,
82
+ gpUp,
83
+ gpDown,
84
+ gpButton0,
85
+ gpButton1,
86
+ gpButton2,
87
+ gpButton3,
88
+ gpButton4,
89
+ gpButton5,
90
+ gpButton6,
91
+ gpButton7,
92
+ gpButton8,
93
+ gpButton9,
94
+ gpButton10,
95
+ gpButton11,
96
+ gpButton12,
97
+ gpButton13,
98
+ gpButton14,
99
+ gpButton15,
100
+ gpRangeEnd = gpButton15,
101
+
102
+ kbNum = kbRangeEnd - kbRangeBegin + 1,
103
+ msNum = msRangeEnd - msRangeBegin + 1,
104
+ gpNum = gpRangeEnd - gpRangeBegin + 1,
105
+
106
+ numButtons = gpRangeEnd,
107
+ noButton = 0xffffffff
108
+ };
109
+ }
110
+
111
+ #endif