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/Gosu/Image.hpp
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
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
|
-
//!
|
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
|
105
|
+
int tileWidth, int tileHeight, bool tileable, Container& appendTo)
|
106
106
|
{
|
107
|
-
imagesFromTiledBitmap(graphics, quickLoadBitmap(filename), tileWidth, tileHeight,
|
107
|
+
imagesFromTiledBitmap(graphics, quickLoadBitmap(filename), tileWidth, tileHeight, tileable, appendTo);
|
108
108
|
}
|
109
109
|
|
110
|
-
//! Convenience function that splits a bitmap into an area of
|
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
|
-
//!
|
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
|
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
|
-
|
144
|
+
tileable)));
|
145
145
|
}
|
146
146
|
}
|
147
147
|
|
data/Gosu/ImageData.hpp
CHANGED
data/Gosu/Input.hpp
CHANGED
@@ -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.
|
54
|
-
|
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
|
}
|
data/Gosu/Math.hpp
CHANGED
@@ -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
|
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
|
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);
|
data/Gosu/RotFlip.hpp
CHANGED
@@ -1,116 +1,125 @@
|
|
1
|
-
//! \file RotFlip.hpp
|
2
|
-
//! Interface of the
|
3
|
-
|
4
|
-
#ifndef GOSU_ROTFLIP_HPP
|
5
|
-
#define GOSU_ROTFLIP_HPP
|
6
|
-
|
7
|
-
namespace Gosu
|
8
|
-
{
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
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
|
data/Gosu/Sockets.hpp
CHANGED
@@ -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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
//!
|
22
|
-
//!
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
//!
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
//!
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
//!
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
//! Returns the
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
//!
|
54
|
-
//!
|
55
|
-
|
56
|
-
|
57
|
-
//!
|
58
|
-
//!
|
59
|
-
void
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
std::size_t)
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|