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