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