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,83 +1,83 @@
1
- //! \file Font.hpp
2
- //! Interface of the Font class.
3
-
4
- #ifndef GOSU_FONT_HPP
5
- #define GOSU_FONT_HPP
6
-
7
- #include <Gosu/Fwd.hpp>
8
- #include <Gosu/Color.hpp>
9
- #include <Gosu/GraphicsBase.hpp>
10
- #include <Gosu/Platform.hpp>
11
- #include <Gosu/TR1.hpp>
12
- #include <string>
13
-
14
- namespace Gosu
15
- {
16
- //! A font can be used to draw text on a Graphics object very flexibly.
17
- //! Fonts are ideal for small texts that change regularly. For large,
18
- //! static texts you should use createBitmap and turn the result into
19
- //! an image.
20
- class Font
21
- {
22
- struct Impl;
23
- std::tr1::shared_ptr<Impl> pimpl;
24
-
25
- public:
26
- //! Constructs a font that can be drawn onto the graphics object.
27
- //! \param fontName Name of a system font, or a filename to a TTF
28
- //! file (must contain '/', does not work on Linux).
29
- //! \param fontHeight Height of the font, in pixels.
30
- //! \param fontFlags Flags used to render individual characters of
31
- //! the font.
32
- Font(Graphics& graphics, const std::wstring& fontName,
33
- unsigned fontHeight, unsigned fontFlags = ffBold);
34
-
35
- //! Returns the name of the font that was used to create it.
36
- std::wstring name() const;
37
-
38
- //! Returns the height of the font, in pixels.
39
- unsigned height() const;
40
-
41
- //! Returns the flags used to create the font characters.
42
- unsigned flags() const;
43
-
44
- //! Returns the width, in pixels, the given text would occupy if drawn.
45
- double textWidth(const std::wstring& text, double factorX = 1) const;
46
-
47
- //! Draws text so the top left corner of the text is at (x; y).
48
- //! \param text Formatted text without line-breaks.
49
- void draw(const std::wstring& text, double x, double y, ZPos z,
50
- double factorX = 1, double factorY = 1,
51
- Color c = Color::WHITE, AlphaMode mode = amDefault) const;
52
-
53
- //! Draws text at a position relative to (x; y).
54
- //! \param relX Determines where the text is drawn horizontally. If
55
- //! relX is 0.0, the text will be to the right of x, if it is 1.0,
56
- //! the text will be to the left of x, if it is 0.5, it will be
57
- //! centered on x. Of course, all real numbers are possible values.
58
- //! \param relY See relX.
59
- void drawRel(const std::wstring& text, double x, double y, ZPos z,
60
- double relX, double relY, double factorX = 1, double factorY = 1,
61
- Color c = Color::WHITE, AlphaMode mode = amDefault) const;
62
-
63
- //! Maps a letter to a specific image instead of generating one using
64
- //! Gosu's built-in text rendering. This can only be called once per
65
- //! character, and the character must not have been drawn before.
66
- //! This ensures that Fonts are still sort of immutable.
67
- void setImage(wchar_t wc, unsigned fontFlags, const Gosu::Image& image);
68
- //! A shortcut for mapping a character to an image regardless of fontFlags.
69
- //! Later versions might apply faux italics or faux bold to it (to be decided!).
70
- void setImage(wchar_t wc, const Gosu::Image& image);
71
-
72
- #ifndef SWIG
73
- GOSU_DEPRECATED
74
- #endif
75
- //! DEPRECATED: Analogous to draw, but rotates the text by a given angle. Use
76
- //! a simple pushTransform to achieve the same effect.
77
- void drawRot(const std::wstring& text, double x, double y, ZPos z, double angle,
78
- double factorX = 1, double factorY = 1,
79
- Color c = Color::WHITE, AlphaMode mode = amDefault) const;
80
- };
81
- }
82
-
83
- #endif
1
+ //! \file Font.hpp
2
+ //! Interface of the Font class.
3
+
4
+ #ifndef GOSU_FONT_HPP
5
+ #define GOSU_FONT_HPP
6
+
7
+ #include <Gosu/Fwd.hpp>
8
+ #include <Gosu/Color.hpp>
9
+ #include <Gosu/GraphicsBase.hpp>
10
+ #include <Gosu/Platform.hpp>
11
+ #include <Gosu/TR1.hpp>
12
+ #include <string>
13
+
14
+ namespace Gosu
15
+ {
16
+ //! A font can be used to draw text on a Graphics object very flexibly.
17
+ //! Fonts are ideal for small texts that change regularly. For large,
18
+ //! static texts you should use createBitmap and turn the result into
19
+ //! an image.
20
+ class Font
21
+ {
22
+ struct Impl;
23
+ std::tr1::shared_ptr<Impl> pimpl;
24
+
25
+ public:
26
+ //! Constructs a font that can be drawn onto the graphics object.
27
+ //! \param fontName Name of a system font, or a filename to a TTF
28
+ //! file (must contain '/', does not work on Linux).
29
+ //! \param fontHeight Height of the font, in pixels.
30
+ //! \param fontFlags Flags used to render individual characters of
31
+ //! the font.
32
+ Font(Graphics& graphics, const std::wstring& fontName,
33
+ unsigned fontHeight, unsigned fontFlags = ffBold);
34
+
35
+ //! Returns the name of the font that was used to create it.
36
+ std::wstring name() const;
37
+
38
+ //! Returns the height of the font, in pixels.
39
+ unsigned height() const;
40
+
41
+ //! Returns the flags used to create the font characters.
42
+ unsigned flags() const;
43
+
44
+ //! Returns the width, in pixels, the given text would occupy if drawn.
45
+ double textWidth(const std::wstring& text, double factorX = 1) const;
46
+
47
+ //! Draws text so the top left corner of the text is at (x; y).
48
+ //! \param text Formatted text without line-breaks.
49
+ void draw(const std::wstring& text, double x, double y, ZPos z,
50
+ double factorX = 1, double factorY = 1,
51
+ Color c = Color::WHITE, AlphaMode mode = amDefault) const;
52
+
53
+ //! Draws text at a position relative to (x; y).
54
+ //! \param relX Determines where the text is drawn horizontally. If
55
+ //! relX is 0.0, the text will be to the right of x, if it is 1.0,
56
+ //! the text will be to the left of x, if it is 0.5, it will be
57
+ //! centered on x. Of course, all real numbers are possible values.
58
+ //! \param relY See relX.
59
+ void drawRel(const std::wstring& text, double x, double y, ZPos z,
60
+ double relX, double relY, double factorX = 1, double factorY = 1,
61
+ Color c = Color::WHITE, AlphaMode mode = amDefault) const;
62
+
63
+ //! Maps a letter to a specific image instead of generating one using
64
+ //! Gosu's built-in text rendering. This can only be called once per
65
+ //! character, and the character must not have been drawn before.
66
+ //! This ensures that Fonts are still sort of immutable.
67
+ void setImage(wchar_t wc, unsigned fontFlags, const Gosu::Image& image);
68
+ //! A shortcut for mapping a character to an image regardless of fontFlags.
69
+ //! Later versions might apply faux italics or faux bold to it (to be decided!).
70
+ void setImage(wchar_t wc, const Gosu::Image& image);
71
+
72
+ #ifndef SWIG
73
+ GOSU_DEPRECATED
74
+ #endif
75
+ //! DEPRECATED: Analogous to draw, but rotates the text by a given angle. Use
76
+ //! a simple pushTransform to achieve the same effect.
77
+ void drawRot(const std::wstring& text, double x, double y, ZPos z, double angle,
78
+ double factorX = 1, double factorY = 1,
79
+ Color c = Color::WHITE, AlphaMode mode = amDefault) const;
80
+ };
81
+ }
82
+
83
+ #endif
@@ -1,34 +1,34 @@
1
- //! \file Gosu.hpp
2
- //! Umbrella header for lazy people with fast compilers, or pre-compiled headers.
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
-
10
- #ifndef GOSU_GOSU_HPP
11
- #define GOSU_GOSU_HPP
12
-
13
- #include <Gosu/Audio.hpp>
14
- #include <Gosu/Bitmap.hpp>
15
- #include <Gosu/Color.hpp>
16
- #include <Gosu/Directories.hpp>
17
- #include <Gosu/Font.hpp>
18
- #include <Gosu/Graphics.hpp>
19
- #include <Gosu/Image.hpp>
20
- #include <Gosu/ImageData.hpp>
21
- #include <Gosu/Input.hpp>
22
- #include <Gosu/Inspection.hpp>
23
- #include <Gosu/IO.hpp>
24
- #include <Gosu/Math.hpp>
25
- #include <Gosu/Platform.hpp>
26
- #include <Gosu/Sockets.hpp>
27
- #include <Gosu/Text.hpp>
28
- #include <Gosu/TextInput.hpp>
29
- #include <Gosu/Timing.hpp>
30
- #include <Gosu/Utility.hpp>
31
- #include <Gosu/Version.hpp>
32
- #include <Gosu/Window.hpp>
33
-
34
- #endif
1
+ //! \file Gosu.hpp
2
+ //! Umbrella header for lazy people with fast compilers, or pre-compiled headers.
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
+
10
+ #ifndef GOSU_GOSU_HPP
11
+ #define GOSU_GOSU_HPP
12
+
13
+ #include <Gosu/Audio.hpp>
14
+ #include <Gosu/Bitmap.hpp>
15
+ #include <Gosu/Color.hpp>
16
+ #include <Gosu/Directories.hpp>
17
+ #include <Gosu/Font.hpp>
18
+ #include <Gosu/Graphics.hpp>
19
+ #include <Gosu/Image.hpp>
20
+ #include <Gosu/ImageData.hpp>
21
+ #include <Gosu/Input.hpp>
22
+ #include <Gosu/Inspection.hpp>
23
+ #include <Gosu/IO.hpp>
24
+ #include <Gosu/Math.hpp>
25
+ #include <Gosu/Platform.hpp>
26
+ #include <Gosu/Sockets.hpp>
27
+ #include <Gosu/Text.hpp>
28
+ #include <Gosu/TextInput.hpp>
29
+ #include <Gosu/Timing.hpp>
30
+ #include <Gosu/Utility.hpp>
31
+ #include <Gosu/Version.hpp>
32
+ #include <Gosu/Window.hpp>
33
+
34
+ #endif
@@ -1,115 +1,115 @@
1
- //! \file Graphics.hpp
2
- //! Interface of the Graphics class.
3
-
4
- #ifndef GOSU_GRAPHICS_HPP
5
- #define GOSU_GRAPHICS_HPP
6
-
7
- #include <Gosu/Fwd.hpp>
8
- #include <Gosu/Color.hpp>
9
- #include <Gosu/GraphicsBase.hpp>
10
- #include <Gosu/TR1.hpp>
11
- #include <memory>
12
-
13
- namespace Gosu
14
- {
15
- //! Returns the maximum size of an texture that will be allocated
16
- //! internally by Gosu.
17
- //! Useful when extending Gosu using OpenGL.
18
- unsigned const MAX_TEXTURE_SIZE = 1024;
19
-
20
- //! Serves as the target of all drawing and provides primitive drawing
21
- //! functionality.
22
- //! Usually created internally by Gosu::Window.
23
- class Graphics
24
- {
25
- struct Impl;
26
- const GOSU_UNIQUE_PTR<Impl> pimpl;
27
-
28
- #if defined(GOSU_CPP11_ENABLED)
29
- // explicitly forbid copying and moving
30
- Graphics(Graphics&&) = delete;
31
- Graphics& operator=(Graphics&&) = delete;
32
- Graphics(const Graphics&) = delete;
33
- Graphics& operator=(const Graphics&) = delete;
34
- #endif
35
-
36
- public:
37
- Graphics(unsigned physicalWidth, unsigned physicalHeight, bool fullscreen);
38
- ~Graphics();
39
-
40
- // TODO: Replace by setBaseTransform()
41
- void setResolution(unsigned virtualWidth, unsigned virtualHeight,
42
- double horizontalBlackBarWidth = 0, double verticalBlackBarHeight = 0);
43
-
44
- unsigned width() const;
45
- unsigned height() const;
46
- bool fullscreen() const;
47
-
48
- //! Prepares the graphics object for drawing. Nothing must be drawn
49
- //! without calling begin.
50
- bool begin(Color clearWithColor = Color::BLACK);
51
- //! Every call to begin must have a matching call to end.
52
- void end();
53
- //! Flushes the Z queue to the screen and starts a new one.
54
- //! Useful for games that are *very* composite in nature (splitscreen).
55
- void flush();
56
-
57
- //! Finishes all pending Gosu drawing operations and executes
58
- //! the following OpenGL code in a clean environment.
59
- void beginGL();
60
- //! Resets Gosu into its default rendering state.
61
- void endGL();
62
- //! Schedules a custom GL functor to be executed at a certain Z level.
63
- //! The functor is called in a clean GL context (as given by beginGL/endGL).
64
- //! Gosu's rendering up to the Z level may not yet have been glFlush()ed.
65
- //! Note: You may not call any Gosu rendering functions from within the
66
- //! functor, and you must schedule it from within Window::draw's call tree.
67
- void scheduleGL(const std::tr1::function<void()>& functor, ZPos z);
68
-
69
- //! Enables clipping to a specified rectangle.
70
- void beginClipping(double x, double y, double width, double height);
71
- //! Disables clipping.
72
- void endClipping();
73
-
74
- //! Starts recording a macro. Cannot be nested.
75
- void beginRecording();
76
- //! Finishes building the macro and returns it as a drawable object.
77
- //! The width and height affect nothing about the recording process,
78
- //! the resulting macro will simply return these values when you ask
79
- //! it.
80
- //! Most usually, the return value is passed to Image::Image().
81
- GOSU_UNIQUE_PTR<Gosu::ImageData> endRecording(int width, int height);
82
-
83
- //! Pushes one transformation onto the transformation stack.
84
- void pushTransform(const Transform& transform);
85
- //! Pops one transformation from the transformation stack.
86
- void popTransform();
87
-
88
- //! Draws a line from one point to another (last pixel exclusive).
89
- //! Note: OpenGL lines are not reliable at all and may have a missing pixel at the start
90
- //! or end point. Please only use this for debugging purposes. Otherwise, use a quad or
91
- //! image to simulate lines, or contribute a better drawLine to Gosu.
92
- void drawLine(double x1, double y1, Color c1,
93
- double x2, double y2, Color c2,
94
- ZPos z, AlphaMode mode = amDefault);
95
-
96
- void drawTriangle(double x1, double y1, Color c1,
97
- double x2, double y2, Color c2,
98
- double x3, double y3, Color c3,
99
- ZPos z, AlphaMode mode = amDefault);
100
-
101
- void drawQuad(double x1, double y1, Color c1,
102
- double x2, double y2, Color c2,
103
- double x3, double y3, Color c3,
104
- double x4, double y4, Color c4,
105
- ZPos z, AlphaMode mode = amDefault);
106
-
107
- //! Turns a portion of a bitmap into something that can be drawn on
108
- //! this graphics object.
109
- GOSU_UNIQUE_PTR<ImageData> createImage(const Bitmap& src,
110
- unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
111
- unsigned borderFlags);
112
- };
113
- }
114
-
115
- #endif
1
+ //! \file Graphics.hpp
2
+ //! Interface of the Graphics class.
3
+
4
+ #ifndef GOSU_GRAPHICS_HPP
5
+ #define GOSU_GRAPHICS_HPP
6
+
7
+ #include <Gosu/Fwd.hpp>
8
+ #include <Gosu/Color.hpp>
9
+ #include <Gosu/GraphicsBase.hpp>
10
+ #include <Gosu/TR1.hpp>
11
+ #include <memory>
12
+
13
+ namespace Gosu
14
+ {
15
+ //! Returns the maximum size of an texture that will be allocated
16
+ //! internally by Gosu.
17
+ //! Useful when extending Gosu using OpenGL.
18
+ unsigned const MAX_TEXTURE_SIZE = 1024;
19
+
20
+ //! Serves as the target of all drawing and provides primitive drawing
21
+ //! functionality.
22
+ //! Usually created internally by Gosu::Window.
23
+ class Graphics
24
+ {
25
+ struct Impl;
26
+ const GOSU_UNIQUE_PTR<Impl> pimpl;
27
+
28
+ #if defined(GOSU_CPP11_ENABLED)
29
+ // explicitly forbid copying and moving
30
+ Graphics(Graphics&&) = delete;
31
+ Graphics& operator=(Graphics&&) = delete;
32
+ Graphics(const Graphics&) = delete;
33
+ Graphics& operator=(const Graphics&) = delete;
34
+ #endif
35
+
36
+ public:
37
+ Graphics(unsigned physicalWidth, unsigned physicalHeight, bool fullscreen);
38
+ ~Graphics();
39
+
40
+ // TODO: Replace by setBaseTransform()
41
+ void setResolution(unsigned virtualWidth, unsigned virtualHeight,
42
+ double horizontalBlackBarWidth = 0, double verticalBlackBarHeight = 0);
43
+
44
+ unsigned width() const;
45
+ unsigned height() const;
46
+ bool fullscreen() const;
47
+
48
+ //! Prepares the graphics object for drawing. Nothing must be drawn
49
+ //! without calling begin.
50
+ bool begin(Color clearWithColor = Color::BLACK);
51
+ //! Every call to begin must have a matching call to end.
52
+ void end();
53
+ //! Flushes the Z queue to the screen and starts a new one.
54
+ //! Useful for games that are *very* composite in nature (splitscreen).
55
+ void flush();
56
+
57
+ //! Finishes all pending Gosu drawing operations and executes
58
+ //! the following OpenGL code in a clean environment.
59
+ void beginGL();
60
+ //! Resets Gosu into its default rendering state.
61
+ void endGL();
62
+ //! Schedules a custom GL functor to be executed at a certain Z level.
63
+ //! The functor is called in a clean GL context (as given by beginGL/endGL).
64
+ //! Gosu's rendering up to the Z level may not yet have been glFlush()ed.
65
+ //! Note: You may not call any Gosu rendering functions from within the
66
+ //! functor, and you must schedule it from within Window::draw's call tree.
67
+ void scheduleGL(const std::tr1::function<void()>& functor, ZPos z);
68
+
69
+ //! Enables clipping to a specified rectangle.
70
+ void beginClipping(double x, double y, double width, double height);
71
+ //! Disables clipping.
72
+ void endClipping();
73
+
74
+ //! Starts recording a macro. Cannot be nested.
75
+ void beginRecording();
76
+ //! Finishes building the macro and returns it as a drawable object.
77
+ //! The width and height affect nothing about the recording process,
78
+ //! the resulting macro will simply return these values when you ask
79
+ //! it.
80
+ //! Most usually, the return value is passed to Image::Image().
81
+ GOSU_UNIQUE_PTR<Gosu::ImageData> endRecording(int width, int height);
82
+
83
+ //! Pushes one transformation onto the transformation stack.
84
+ void pushTransform(const Transform& transform);
85
+ //! Pops one transformation from the transformation stack.
86
+ void popTransform();
87
+
88
+ //! Draws a line from one point to another (last pixel exclusive).
89
+ //! Note: OpenGL lines are not reliable at all and may have a missing pixel at the start
90
+ //! or end point. Please only use this for debugging purposes. Otherwise, use a quad or
91
+ //! image to simulate lines, or contribute a better drawLine to Gosu.
92
+ void drawLine(double x1, double y1, Color c1,
93
+ double x2, double y2, Color c2,
94
+ ZPos z, AlphaMode mode = amDefault);
95
+
96
+ void drawTriangle(double x1, double y1, Color c1,
97
+ double x2, double y2, Color c2,
98
+ double x3, double y3, Color c3,
99
+ ZPos z, AlphaMode mode = amDefault);
100
+
101
+ void drawQuad(double x1, double y1, Color c1,
102
+ double x2, double y2, Color c2,
103
+ double x3, double y3, Color c3,
104
+ double x4, double y4, Color c4,
105
+ ZPos z, AlphaMode mode = amDefault);
106
+
107
+ //! Turns a portion of a bitmap into something that can be drawn on
108
+ //! this graphics object.
109
+ GOSU_UNIQUE_PTR<ImageData> createImage(const Bitmap& src,
110
+ unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
111
+ unsigned borderFlags);
112
+ };
113
+ }
114
+
115
+ #endif