gosu 0.8.6-x86-mingw32 → 0.8.7-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Audio.hpp +171 -171
  3. data/Gosu/Bitmap.hpp +96 -96
  4. data/Gosu/Color.hpp +204 -204
  5. data/Gosu/Directories.hpp +36 -36
  6. data/Gosu/Font.hpp +83 -83
  7. data/Gosu/Gosu.hpp +34 -34
  8. data/Gosu/Graphics.hpp +115 -115
  9. data/Gosu/GraphicsBase.hpp +110 -110
  10. data/Gosu/IO.hpp +269 -269
  11. data/Gosu/Image.hpp +122 -122
  12. data/Gosu/ImageData.hpp +61 -61
  13. data/Gosu/Input.hpp +149 -149
  14. data/Gosu/Inspection.hpp +14 -14
  15. data/Gosu/Math.hpp +135 -135
  16. data/Gosu/Platform.hpp +93 -93
  17. data/Gosu/Sockets.hpp +156 -156
  18. data/Gosu/TR1.hpp +56 -56
  19. data/Gosu/Text.hpp +71 -71
  20. data/Gosu/TextInput.hpp +70 -70
  21. data/Gosu/Utility.hpp +28 -28
  22. data/Gosu/Version.hpp +19 -19
  23. data/Gosu/Window.hpp +145 -145
  24. data/examples/ChipmunkIntegration.rb +275 -275
  25. data/examples/CptnRuby.rb +223 -223
  26. data/examples/GosuZen.rb +68 -68
  27. data/examples/MoreChipmunkAndRMagick.rb +155 -155
  28. data/examples/OpenGLIntegration.rb +225 -225
  29. data/examples/RMagickIntegration.rb +417 -417
  30. data/examples/TextInput.rb +154 -154
  31. data/examples/Tutorial.rb +130 -130
  32. data/examples/media/Beep.wav +0 -0
  33. data/examples/media/CptnRuby Map.txt b/data/examples/media/CptnRuby → Map.txt +0 -0
  34. data/examples/media/Explosion.wav +0 -0
  35. data/examples/media/Landscape.svg +9 -9
  36. data/examples/media/Space.png +0 -0
  37. data/examples/media/Star.png +0 -0
  38. data/examples/media/Starfighter.bmp +0 -0
  39. data/lib/1.8/gosu.so +0 -0
  40. data/lib/1.9/gosu.so +0 -0
  41. data/lib/2.0/gosu.so +0 -0
  42. data/lib/2.1/gosu.so +0 -0
  43. data/lib/FreeImage.dll +0 -0
  44. data/lib/OpenAL32.dll +0 -0
  45. data/lib/gosu.rb +19 -16
  46. data/lib/gosu/patches.rb +81 -81
  47. data/lib/gosu/preview.rb +143 -139
  48. data/lib/gosu/run.rb +11 -11
  49. data/lib/gosu/swig_patches.rb +60 -60
  50. data/lib/gosu/zen.rb +89 -89
  51. metadata +5 -5
@@ -1,70 +1,70 @@
1
- //! \file TextInput.hpp
2
- //! Interface of the TextInput class.
3
-
4
- #ifndef GOSU_TEXTINPUT_HPP
5
- #define GOSU_TEXTINPUT_HPP
6
-
7
- #include <Gosu/Fwd.hpp>
8
- #include <Gosu/Platform.hpp>
9
- #include <Gosu/TR1.hpp>
10
- #include <string>
11
-
12
- namespace Gosu
13
- {
14
- //! TextInput instances are invisible objects that build a text string from input,
15
- //! using the current operating system's keyboard layout.
16
- //! At its most basic form, you only need to create a new TextInput instance and
17
- //! pass it to your window via setTextInput. Until you call this function again,
18
- //! passing 0, the TextInput object will build a text that can be accessed via
19
- //! TextInput::text().
20
- //! A TextInput object is purely abstract, though; drawing the input field is left
21
- //! to the user. As with most of Gosu, how this is handled is completely left open.
22
- //! TextInput only aims to provide enough code for your own GUIs to build upon.
23
- class TextInput
24
- {
25
- struct Impl;
26
- const GOSU_UNIQUE_PTR<Impl> pimpl;
27
- #if defined(GOSU_CPP11_ENABLED)
28
- TextInput(TextInput&&) = delete;
29
- TextInput& operator=(TextInput&&) = delete;
30
- TextInput(const TextInput&) = delete;
31
- TextInput& operator=(const TextInput&) = delete;
32
- #endif
33
-
34
- public:
35
- TextInput();
36
- virtual ~TextInput();
37
-
38
- std::wstring text() const;
39
-
40
- //! Replaces the current text by the given string and positions the cursor
41
- //! at the end of the text, with an empty selection.
42
- void setText(const std::wstring& text);
43
-
44
- //! Position of the caret as the index of the character that it's left to.
45
- unsigned caretPos() const;
46
- //! Sets the caret position as returned by caretPos.
47
- //! You usually also want to use setSelectionStart.
48
- void setCaretPos(unsigned pos);
49
-
50
- //! If there is a selection, the selectionStart() member yields its beginning,
51
- //! using the same indexing scheme as caretPos. If there is no selection,
52
- //! selectionStart() is equal to caretPos().
53
- unsigned selectionStart() const;
54
- //! Sets the start of the selection as returned by selectionStart.
55
- void setSelectionStart(unsigned pos);
56
-
57
- // Platform-specific communication with Gosu::Input.
58
- bool feedSDLEvent(void* event);
59
-
60
- //! Overridable filter that is applied to all new text that is entered.
61
- //! Allows for context-sensitive filtering/extending/... of the text.
62
- //! The text will be inserted at caretPos afterwards.
63
- virtual std::wstring filter(const std::wstring& text) const
64
- {
65
- return text;
66
- }
67
- };
68
- }
69
-
70
- #endif
1
+ //! \file TextInput.hpp
2
+ //! Interface of the TextInput class.
3
+
4
+ #ifndef GOSU_TEXTINPUT_HPP
5
+ #define GOSU_TEXTINPUT_HPP
6
+
7
+ #include <Gosu/Fwd.hpp>
8
+ #include <Gosu/Platform.hpp>
9
+ #include <Gosu/TR1.hpp>
10
+ #include <string>
11
+
12
+ namespace Gosu
13
+ {
14
+ //! TextInput instances are invisible objects that build a text string from input,
15
+ //! using the current operating system's keyboard layout.
16
+ //! At its most basic form, you only need to create a new TextInput instance and
17
+ //! pass it to your window via setTextInput. Until you call this function again,
18
+ //! passing 0, the TextInput object will build a text that can be accessed via
19
+ //! TextInput::text().
20
+ //! A TextInput object is purely abstract, though; drawing the input field is left
21
+ //! to the user. As with most of Gosu, how this is handled is completely left open.
22
+ //! TextInput only aims to provide enough code for your own GUIs to build upon.
23
+ class TextInput
24
+ {
25
+ struct Impl;
26
+ const GOSU_UNIQUE_PTR<Impl> pimpl;
27
+ #if defined(GOSU_CPP11_ENABLED)
28
+ TextInput(TextInput&&) = delete;
29
+ TextInput& operator=(TextInput&&) = delete;
30
+ TextInput(const TextInput&) = delete;
31
+ TextInput& operator=(const TextInput&) = delete;
32
+ #endif
33
+
34
+ public:
35
+ TextInput();
36
+ virtual ~TextInput();
37
+
38
+ std::wstring text() const;
39
+
40
+ //! Replaces the current text by the given string and positions the cursor
41
+ //! at the end of the text, with an empty selection.
42
+ void setText(const std::wstring& text);
43
+
44
+ //! Position of the caret as the index of the character that it's left to.
45
+ unsigned caretPos() const;
46
+ //! Sets the caret position as returned by caretPos.
47
+ //! You usually also want to use setSelectionStart.
48
+ void setCaretPos(unsigned pos);
49
+
50
+ //! If there is a selection, the selectionStart() member yields its beginning,
51
+ //! using the same indexing scheme as caretPos. If there is no selection,
52
+ //! selectionStart() is equal to caretPos().
53
+ unsigned selectionStart() const;
54
+ //! Sets the start of the selection as returned by selectionStart.
55
+ void setSelectionStart(unsigned pos);
56
+
57
+ // Platform-specific communication with Gosu::Input.
58
+ bool feedSDLEvent(void* event);
59
+
60
+ //! Overridable filter that is applied to all new text that is entered.
61
+ //! Allows for context-sensitive filtering/extending/... of the text.
62
+ //! The text will be inserted at caretPos afterwards.
63
+ virtual std::wstring filter(const std::wstring& text) const
64
+ {
65
+ return text;
66
+ }
67
+ };
68
+ }
69
+
70
+ #endif
@@ -1,28 +1,28 @@
1
- //! \file Utility.hpp
2
- //! General purpose utility functions.
3
-
4
- #ifndef GOSU_UTILITY_HPP
5
- #define GOSU_UTILITY_HPP
6
-
7
- #include <string>
8
- #include <vector>
9
-
10
- namespace Gosu
11
- {
12
- //! Converts an std::string into an std::wstring.
13
- std::wstring utf8ToWstring(const std::string& utf8);
14
- //! Converts an std::wstring into an std::string.
15
- std::string wstringToUTF8(const std::wstring& ws);
16
-
17
- //! Converts an std::string into an std::wstring using local encoding.
18
- std::wstring widen(const std::string& s);
19
- //! Converts an std::wstring into an std::string using local encoding.
20
- std::string narrow(const std::wstring& ws);
21
-
22
- //! Returns the user's preferred language, at the moment of calling the function. Expect return
23
- //! values such as 'en_US', 'de_DE.UTF-8', 'ja', 'zh-Hans'. You can rely only on the first two letters
24
- //! being a common language abbreviation.
25
- std::string language();
26
- }
27
-
28
- #endif
1
+ //! \file Utility.hpp
2
+ //! General purpose utility functions.
3
+
4
+ #ifndef GOSU_UTILITY_HPP
5
+ #define GOSU_UTILITY_HPP
6
+
7
+ #include <string>
8
+ #include <vector>
9
+
10
+ namespace Gosu
11
+ {
12
+ //! Converts an std::string into an std::wstring.
13
+ std::wstring utf8ToWstring(const std::string& utf8);
14
+ //! Converts an std::wstring into an std::string.
15
+ std::string wstringToUTF8(const std::wstring& ws);
16
+
17
+ //! Converts an std::string into an std::wstring using local encoding.
18
+ std::wstring widen(const std::string& s);
19
+ //! Converts an std::wstring into an std::string using local encoding.
20
+ std::string narrow(const std::wstring& ws);
21
+
22
+ //! Returns the user's preferred language, at the moment of calling the function. Expect return
23
+ //! values such as 'en_US', 'de_DE.UTF-8', 'ja', 'zh-Hans'. You can rely only on the first two letters
24
+ //! being a common language abbreviation.
25
+ std::string language();
26
+ }
27
+
28
+ #endif
@@ -1,19 +1,19 @@
1
- #ifndef GOSU_VERSION_HPP
2
- #define GOSU_VERSION_HPP
3
-
4
- #define GOSU_MAJOR_VERSION 0
5
- #define GOSU_MINOR_VERSION 8
6
- #define GOSU_POINT_VERSION 6
7
- #define GOSU_VERSION "0.8.6"
8
-
9
- #define GOSU_COPYRIGHT_NOTICE \
10
- "This software uses the following third-party libraries:\n" \
11
- "\n" \
12
- "Gosu, http://www.libgosu.org, MIT License, http://opensource.org/licenses/MIT\n" \
13
- "SDL 2, http://www.libsdl.org, MIT License, http://opensource.org/licenses/MIT\n" \
14
- "FreeImage, http://freeimage.sourceforge.net, FreeImage Public License\n" \
15
- "libogg & libvorbis, http://www.xiph.org, BSD License, 3-Clause Version, http://www.xiph.org/licenses/bsd\n" \
16
- "libsndfile, http://www.mega-nerd.com/libsndfile, GNU LGPL 3, http://www.gnu.org/copyleft/lesser.html\n" \
17
- "OpenAL Soft, http://kcat.strangesoft.net/openal.html, GNU LGPL 2, http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html\n"
18
-
19
- #endif
1
+ #ifndef GOSU_VERSION_HPP
2
+ #define GOSU_VERSION_HPP
3
+
4
+ #define GOSU_MAJOR_VERSION 0
5
+ #define GOSU_MINOR_VERSION 8
6
+ #define GOSU_POINT_VERSION 7
7
+ #define GOSU_VERSION "0.8.7"
8
+
9
+ #define GOSU_COPYRIGHT_NOTICE \
10
+ "This software uses the following third-party libraries:\n" \
11
+ "\n" \
12
+ "Gosu, http://www.libgosu.org, MIT License, http://opensource.org/licenses/MIT\n" \
13
+ "SDL 2, http://www.libsdl.org, MIT License, http://opensource.org/licenses/MIT\n" \
14
+ "FreeImage, http://freeimage.sourceforge.net, FreeImage Public License\n" \
15
+ "libogg & libvorbis, http://www.xiph.org, BSD License, 3-Clause Version, http://www.xiph.org/licenses/bsd\n" \
16
+ "libsndfile, http://www.mega-nerd.com/libsndfile, GNU LGPL 3, http://www.gnu.org/copyleft/lesser.html\n" \
17
+ "OpenAL Soft, http://kcat.strangesoft.net/openal.html, GNU LGPL 2, http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html\n"
18
+
19
+ #endif
@@ -1,145 +1,145 @@
1
- //! \file Window.hpp
2
- //! Interface of the Window class.
3
-
4
- #ifndef GOSU_WINDOW_HPP
5
- #define GOSU_WINDOW_HPP
6
-
7
- #include <Gosu/Fwd.hpp>
8
- #include <Gosu/Platform.hpp>
9
- #include <Gosu/Input.hpp>
10
- #include <Gosu/TR1.hpp>
11
- #include <memory>
12
- #include <string>
13
-
14
- #ifdef GOSU_IS_WIN
15
- #ifndef NOMINMAX
16
- #define NOMINMAX
17
- #endif
18
- #include <windows.h>
19
- #endif
20
-
21
- namespace Gosu
22
- {
23
- //! Returns the width (in pixels) of the user's primary screen.
24
- unsigned screenWidth();
25
-
26
- //! Returns the height (in pixels) of the user's primary screen.
27
- unsigned screenHeight();
28
-
29
- //! Returns the maximum width (in 'points') that is available for a non-fullscreen Window.
30
- //! All windows larger than this size will automatically be shrunk to fit.
31
- unsigned availableWidth();
32
-
33
- //! Returns the maximum height (in 'points') that is available for a non-fullscreen Window.
34
- //! All windows larger than this size will automatically be shrunk to fit.
35
- unsigned availableHeight();
36
-
37
- //! Convenient all-in-one class that serves as the foundation of a standard
38
- //! Gosu application. Manages initialization of all of Gosu's core components
39
- //! and provides timing functionality.
40
- //! Note that you should really only use one instance of this class at the same time.
41
- //! This may or may not change later.
42
- class Window
43
- {
44
- struct Impl;
45
- const GOSU_UNIQUE_PTR<Impl> pimpl;
46
- #if defined(GOSU_CPP11_ENABLED)
47
- Window(Window&&) = delete;
48
- Window& operator=(Window&&) = delete;
49
- Window(const Window&) = delete;
50
- Window& operator=(const Window&) = delete;
51
- #endif
52
-
53
- public:
54
- //! Constructs a Window.
55
- //! \param width Width of the window in points; that is, pixels on a normal display, and 'virtual pixels' on a
56
- //! high-resolution display.
57
- //! \param height See width.
58
- //! \param updateInterval Interval in milliseconds between two calls
59
- //! to the update member function.
60
- Window(unsigned width, unsigned height, bool fullscreen,
61
- double updateInterval = 16.666666);
62
- virtual ~Window();
63
-
64
- std::wstring caption() const;
65
- void setCaption(const std::wstring& caption);
66
-
67
- double updateInterval() const;
68
-
69
- //! Enters a modal loop where the Window is visible on screen and
70
- //! receives calls to draw, update etc.
71
- void show();
72
- //! Closes the window if it is currently shown.
73
- void close();
74
-
75
- //! Called every updateInterval milliseconds while the window is being
76
- //! shown. Your application's main game logic goes here.
77
- virtual void update() {}
78
- //! Called after every update and when the OS wants the window to
79
- //! repaint itself. Your application's rendering code goes here.
80
- virtual void draw() {}
81
-
82
- //! Gives the game a chance to say no to being redrawn.
83
- //! This is not a definitive answer. The operating system can still force
84
- //! the window to redraw itself.
85
- //! By default, the window is redrawn all the time.
86
- virtual bool needsRedraw() const { return true; }
87
-
88
- //! If this function returns true, the system arrow cursor is drawn while
89
- //! over the window.
90
- virtual bool needsCursor() const { return false; }
91
-
92
- //! This function is called when the window loses focus on some platforms.
93
- //! Most importantly, it is called on the iPhone or iPad when the user
94
- //! locks the screen.
95
- virtual void loseFocus() {}
96
-
97
- //! This function is called when the operating system's memory is low.
98
- //! So far, it is only called in iOS applications.
99
- virtual void releaseMemory() {}
100
-
101
- //! Called before update when the user pressed a button while the
102
- //! window had the focus.
103
- virtual void buttonDown(Gosu::Button) {}
104
- //! Same as buttonDown. Called then the user released a button.
105
- virtual void buttonUp(Gosu::Button) {}
106
-
107
- // Ignore when SWIG is wrapping this class for Ruby/Gosu.
108
- #ifndef SWIG
109
-
110
- const Graphics& graphics() const;
111
- Graphics& graphics();
112
-
113
- const Input& input() const;
114
- Input& input();
115
-
116
- #ifdef GOSU_IS_UNIX
117
- // Context for creating shared contexts.
118
- // Only on Unices (so far).
119
- typedef std::tr1::shared_ptr<std::tr1::function<void()> > SharedContext;
120
- SharedContext createSharedContext();
121
- #endif
122
-
123
- #ifdef GOSU_IS_IPHONE
124
- void* rootViewController() const;
125
- // iPhone-only callbacks for touch events.
126
- // Note that it does not hurt to override them even if you compile
127
- // for another platform; if you don't specify "virtual" the code
128
- // should even be stripped away cleanly.
129
- virtual void touchBegan(Touch touch) {}
130
- virtual void touchMoved(Touch touch) {}
131
- virtual void touchEnded(Touch touch) {}
132
- #endif
133
-
134
- const Audio& audio() const;
135
- Audio& audio();
136
-
137
- #endif
138
- };
139
- }
140
-
141
- #ifdef GOSU_IS_IPHONE
142
- Gosu::Window& windowInstance();
143
- #endif
144
-
145
- #endif
1
+ //! \file Window.hpp
2
+ //! Interface of the Window class.
3
+
4
+ #ifndef GOSU_WINDOW_HPP
5
+ #define GOSU_WINDOW_HPP
6
+
7
+ #include <Gosu/Fwd.hpp>
8
+ #include <Gosu/Platform.hpp>
9
+ #include <Gosu/Input.hpp>
10
+ #include <Gosu/TR1.hpp>
11
+ #include <memory>
12
+ #include <string>
13
+
14
+ #ifdef GOSU_IS_WIN
15
+ #ifndef NOMINMAX
16
+ #define NOMINMAX
17
+ #endif
18
+ #include <windows.h>
19
+ #endif
20
+
21
+ namespace Gosu
22
+ {
23
+ //! Returns the width (in pixels) of the user's primary screen.
24
+ unsigned screenWidth();
25
+
26
+ //! Returns the height (in pixels) of the user's primary screen.
27
+ unsigned screenHeight();
28
+
29
+ //! Returns the maximum width (in 'points') that is available for a non-fullscreen Window.
30
+ //! All windows larger than this size will automatically be shrunk to fit.
31
+ unsigned availableWidth();
32
+
33
+ //! Returns the maximum height (in 'points') that is available for a non-fullscreen Window.
34
+ //! All windows larger than this size will automatically be shrunk to fit.
35
+ unsigned availableHeight();
36
+
37
+ //! Convenient all-in-one class that serves as the foundation of a standard
38
+ //! Gosu application. Manages initialization of all of Gosu's core components
39
+ //! and provides timing functionality.
40
+ //! Note that you should really only use one instance of this class at the same time.
41
+ //! This may or may not change later.
42
+ class Window
43
+ {
44
+ struct Impl;
45
+ const GOSU_UNIQUE_PTR<Impl> pimpl;
46
+ #if defined(GOSU_CPP11_ENABLED)
47
+ Window(Window&&) = delete;
48
+ Window& operator=(Window&&) = delete;
49
+ Window(const Window&) = delete;
50
+ Window& operator=(const Window&) = delete;
51
+ #endif
52
+
53
+ public:
54
+ //! Constructs a Window.
55
+ //! \param width Width of the window in points; that is, pixels on a normal display, and 'virtual pixels' on a
56
+ //! high-resolution display.
57
+ //! \param height See width.
58
+ //! \param updateInterval Interval in milliseconds between two calls
59
+ //! to the update member function.
60
+ Window(unsigned width, unsigned height, bool fullscreen,
61
+ double updateInterval = 16.666666);
62
+ virtual ~Window();
63
+
64
+ std::wstring caption() const;
65
+ void setCaption(const std::wstring& caption);
66
+
67
+ double updateInterval() const;
68
+
69
+ //! Enters a modal loop where the Window is visible on screen and
70
+ //! receives calls to draw, update etc.
71
+ void show();
72
+ //! Closes the window if it is currently shown.
73
+ void close();
74
+
75
+ //! Called every updateInterval milliseconds while the window is being
76
+ //! shown. Your application's main game logic goes here.
77
+ virtual void update() {}
78
+ //! Called after every update and when the OS wants the window to
79
+ //! repaint itself. Your application's rendering code goes here.
80
+ virtual void draw() {}
81
+
82
+ //! Gives the game a chance to say no to being redrawn.
83
+ //! This is not a definitive answer. The operating system can still force
84
+ //! the window to redraw itself.
85
+ //! By default, the window is redrawn all the time.
86
+ virtual bool needsRedraw() const { return true; }
87
+
88
+ //! If this function returns true, the system arrow cursor is drawn while
89
+ //! over the window.
90
+ virtual bool needsCursor() const { return false; }
91
+
92
+ //! This function is called when the window loses focus on some platforms.
93
+ //! Most importantly, it is called on the iPhone or iPad when the user
94
+ //! locks the screen.
95
+ virtual void loseFocus() {}
96
+
97
+ //! This function is called when the operating system's memory is low.
98
+ //! So far, it is only called in iOS applications.
99
+ virtual void releaseMemory() {}
100
+
101
+ //! Called before update when the user pressed a button while the
102
+ //! window had the focus.
103
+ virtual void buttonDown(Gosu::Button) {}
104
+ //! Same as buttonDown. Called then the user released a button.
105
+ virtual void buttonUp(Gosu::Button) {}
106
+
107
+ // Ignore when SWIG is wrapping this class for Ruby/Gosu.
108
+ #ifndef SWIG
109
+
110
+ const Graphics& graphics() const;
111
+ Graphics& graphics();
112
+
113
+ const Input& input() const;
114
+ Input& input();
115
+
116
+ #ifdef GOSU_IS_UNIX
117
+ // Context for creating shared contexts.
118
+ // Only on Unices (so far).
119
+ typedef std::tr1::shared_ptr<std::tr1::function<void()> > SharedContext;
120
+ SharedContext createSharedContext();
121
+ #endif
122
+
123
+ #ifdef GOSU_IS_IPHONE
124
+ void* rootViewController() const;
125
+ // iPhone-only callbacks for touch events.
126
+ // Note that it does not hurt to override them even if you compile
127
+ // for another platform; if you don't specify "virtual" the code
128
+ // should even be stripped away cleanly.
129
+ virtual void touchBegan(Touch touch) {}
130
+ virtual void touchMoved(Touch touch) {}
131
+ virtual void touchEnded(Touch touch) {}
132
+ #endif
133
+
134
+ GOSU_DEPRECATED const Audio& audio() const;
135
+ GOSU_DEPRECATED Audio& audio();
136
+
137
+ #endif
138
+ };
139
+ }
140
+
141
+ #ifdef GOSU_IS_IPHONE
142
+ Gosu::Window& windowInstance();
143
+ #endif
144
+
145
+ #endif