gosu 0.8.6-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gosu/Audio.hpp +171 -0
- data/Gosu/AutoLink.hpp +16 -0
- data/Gosu/Bitmap.hpp +96 -0
- data/Gosu/Buttons.hpp +265 -0
- data/Gosu/Color.hpp +204 -0
- data/Gosu/Directories.hpp +36 -0
- data/Gosu/Font.hpp +83 -0
- data/Gosu/Fwd.hpp +31 -0
- data/Gosu/Gosu.hpp +34 -0
- data/Gosu/Graphics.hpp +115 -0
- data/Gosu/GraphicsBase.hpp +110 -0
- data/Gosu/IO.hpp +269 -0
- data/Gosu/Image.hpp +122 -0
- data/Gosu/ImageData.hpp +61 -0
- data/Gosu/Input.hpp +149 -0
- data/Gosu/Inspection.hpp +14 -0
- data/Gosu/Math.hpp +135 -0
- data/Gosu/Platform.hpp +93 -0
- data/Gosu/Sockets.hpp +156 -0
- data/Gosu/TR1.hpp +56 -0
- data/Gosu/Text.hpp +71 -0
- data/Gosu/TextInput.hpp +70 -0
- data/Gosu/Timing.hpp +16 -0
- data/Gosu/Utility.hpp +28 -0
- data/Gosu/Version.hpp +19 -0
- data/Gosu/WinUtility.hpp +75 -0
- data/Gosu/Window.hpp +145 -0
- data/examples/ChipmunkIntegration.rb +275 -0
- data/examples/CptnRuby.rb +223 -0
- data/examples/GosuZen.rb +68 -0
- data/examples/MoreChipmunkAndRMagick.rb +155 -0
- data/examples/OpenGLIntegration.rb +226 -0
- data/examples/RMagickIntegration.rb +417 -0
- data/examples/TextInput.rb +154 -0
- data/examples/Tutorial.rb +131 -0
- data/examples/media/Beep.wav +0 -0
- data/examples/media/CptnRuby Gem.png +0 -0
- data/examples/media/CptnRuby Map.txt +25 -0
- data/examples/media/CptnRuby Tileset.png +0 -0
- data/examples/media/CptnRuby.png +0 -0
- data/examples/media/Cursor.png +0 -0
- data/examples/media/Earth.png +0 -0
- data/examples/media/Explosion.wav +0 -0
- data/examples/media/Landscape.svg +10 -0
- data/examples/media/LargeStar.png +0 -0
- data/examples/media/Smoke.png +0 -0
- data/examples/media/Soldier.png +0 -0
- data/examples/media/Space.png +0 -0
- data/examples/media/Star.png +0 -0
- data/examples/media/Starfighter.bmp +0 -0
- data/lib/gosu.rb +20 -0
- data/lib/gosu/patches.rb +81 -0
- data/lib/gosu/preview.rb +139 -0
- data/lib/gosu/run.rb +11 -0
- data/lib/gosu/swig_patches.rb +60 -0
- data/lib/gosu/zen.rb +89 -0
- data/lib64/2.1/gosu.so +0 -0
- data/lib64/FreeImage.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/lib64/SDL2.dll +0 -0
- data/lib64/libsndfile.dll +0 -0
- metadata +110 -0
data/Gosu/Color.hpp
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
//! \file Color.hpp
|
2
|
+
//! Interface of the Color class.
|
3
|
+
|
4
|
+
#ifndef GOSU_COLOR_HPP
|
5
|
+
#define GOSU_COLOR_HPP
|
6
|
+
|
7
|
+
#include <Gosu/Platform.hpp>
|
8
|
+
#include <Gosu/TR1.hpp>
|
9
|
+
|
10
|
+
namespace Gosu
|
11
|
+
{
|
12
|
+
//! Represents an RGBA color value with 8 bits for each channel. Can be
|
13
|
+
//! implicitly constructed from literals of the form 0xaarrggbb. Has fast
|
14
|
+
//! value semantics.
|
15
|
+
//! The four-byte layout in memory is RGBA. On Big-Endian machines the
|
16
|
+
//! unsigned int interpretation is 0xrrggbbaa, on Little-Endian machines
|
17
|
+
//! it is 0xaabbggrr.
|
18
|
+
class Color
|
19
|
+
{
|
20
|
+
std::tr1::uint32_t rep;
|
21
|
+
#ifdef GOSU_IS_LITTLE_ENDIAN
|
22
|
+
enum { RED_OFFSET = 0, GREEN_OFFSET = 8, BLUE_OFFSET = 16, ALPHA_OFFSET = 24 };
|
23
|
+
#else
|
24
|
+
enum { RED_OFFSET = 24, GREEN_OFFSET = 16, BLUE_OFFSET = 8, ALPHA_OFFSET = 0 };
|
25
|
+
#endif
|
26
|
+
|
27
|
+
public:
|
28
|
+
typedef std::tr1::uint8_t Channel;
|
29
|
+
static const unsigned GL_FORMAT = 0x1908; // GL_RGBA
|
30
|
+
|
31
|
+
//! The default constructor does not initialize the color to any value.
|
32
|
+
Color()
|
33
|
+
{
|
34
|
+
}
|
35
|
+
|
36
|
+
//! Conversion constructor for literals of the form 0xaarrggbb.
|
37
|
+
Color(unsigned argb)
|
38
|
+
{
|
39
|
+
*this = Color((argb >> 24) & 0xff, (argb >> 16) & 0xff,
|
40
|
+
(argb >> 8) & 0xff, (argb >> 0) & 0xff);
|
41
|
+
}
|
42
|
+
|
43
|
+
Color(Channel red, Channel green, Channel blue)
|
44
|
+
{
|
45
|
+
*this = Color(0xff, red, green, blue);
|
46
|
+
}
|
47
|
+
|
48
|
+
Color(Channel alpha, Channel red, Channel green, Channel blue)
|
49
|
+
{
|
50
|
+
rep = (alpha << ALPHA_OFFSET) | (red << RED_OFFSET) |
|
51
|
+
(green << GREEN_OFFSET) | (blue << BLUE_OFFSET);
|
52
|
+
}
|
53
|
+
|
54
|
+
//! Constructs a color from the given hue/saturation/value triple.
|
55
|
+
//! Ranges of these values are given as 0..360, 0..1 and 0..1,
|
56
|
+
//! respectively.
|
57
|
+
//! The alpha value is set to 1 from this method.
|
58
|
+
static Color fromHSV(double h, double s, double v);
|
59
|
+
static Color fromAHSV(Channel alpha, double h, double s, double v);
|
60
|
+
|
61
|
+
Channel red() const
|
62
|
+
{
|
63
|
+
return static_cast<Channel>(rep >> RED_OFFSET);
|
64
|
+
}
|
65
|
+
|
66
|
+
Channel green() const
|
67
|
+
{
|
68
|
+
return static_cast<Channel>(rep >> GREEN_OFFSET);
|
69
|
+
}
|
70
|
+
|
71
|
+
Channel blue() const
|
72
|
+
{
|
73
|
+
return static_cast<Channel>(rep >> BLUE_OFFSET);
|
74
|
+
}
|
75
|
+
|
76
|
+
Channel alpha() const
|
77
|
+
{
|
78
|
+
return static_cast<Channel>(rep >> ALPHA_OFFSET);
|
79
|
+
}
|
80
|
+
|
81
|
+
void setRed(Channel value)
|
82
|
+
{
|
83
|
+
rep &= ~(0xff << RED_OFFSET);
|
84
|
+
rep |= value << RED_OFFSET;
|
85
|
+
}
|
86
|
+
|
87
|
+
void setGreen(Channel value)
|
88
|
+
{
|
89
|
+
rep &= ~(0xff << GREEN_OFFSET);
|
90
|
+
rep |= value << GREEN_OFFSET;
|
91
|
+
}
|
92
|
+
|
93
|
+
void setBlue(Channel value)
|
94
|
+
{
|
95
|
+
rep &= ~(0xff << BLUE_OFFSET);
|
96
|
+
rep |= value << BLUE_OFFSET;
|
97
|
+
}
|
98
|
+
|
99
|
+
void setAlpha(Channel value)
|
100
|
+
{
|
101
|
+
rep &= ~(0xff << ALPHA_OFFSET);
|
102
|
+
rep |= value << ALPHA_OFFSET;
|
103
|
+
}
|
104
|
+
|
105
|
+
//! Returns the hue of the color, in the usual range of 0..360.
|
106
|
+
double hue() const;
|
107
|
+
|
108
|
+
//! Changes the current color so hue() will return h.
|
109
|
+
void setHue(double h);
|
110
|
+
|
111
|
+
//! Returns the saturation of the color, in the range of 0..1.
|
112
|
+
double saturation() const;
|
113
|
+
|
114
|
+
//! Changes the current color so saturation() will return s.
|
115
|
+
void setSaturation(double s);
|
116
|
+
|
117
|
+
//! Returns the value (brightness) of the color, in the range of 0..1.
|
118
|
+
double value() const;
|
119
|
+
|
120
|
+
//! Changes the current color so value() will return v.
|
121
|
+
void setValue(double v);
|
122
|
+
|
123
|
+
//! Returns the color in 0xaarrggbb representation.
|
124
|
+
std::tr1::uint32_t argb() const
|
125
|
+
{
|
126
|
+
return alpha() << 24 | red() << 16 | green() << 8 | blue();
|
127
|
+
}
|
128
|
+
|
129
|
+
//! Returns the color in 0x00bbggrr representation. Useful for Win32 programming.
|
130
|
+
std::tr1::uint32_t bgr() const
|
131
|
+
{
|
132
|
+
return blue() << 16 | green() << 8 | red();
|
133
|
+
}
|
134
|
+
|
135
|
+
//! Returns the color in 0xaabbggrr representation.
|
136
|
+
std::tr1::uint32_t abgr() const
|
137
|
+
{
|
138
|
+
return alpha() << 24 | blue() << 16 | green() << 8 | red();
|
139
|
+
}
|
140
|
+
|
141
|
+
//! Returns the internal representation of the color (RGBA in memory).
|
142
|
+
std::tr1::uint32_t gl() const
|
143
|
+
{
|
144
|
+
return rep;
|
145
|
+
}
|
146
|
+
|
147
|
+
static const Color NONE;
|
148
|
+
static const Color BLACK;
|
149
|
+
static const Color GRAY;
|
150
|
+
static const Color WHITE;
|
151
|
+
|
152
|
+
static const Color AQUA;
|
153
|
+
static const Color RED;
|
154
|
+
static const Color GREEN;
|
155
|
+
static const Color BLUE;
|
156
|
+
static const Color YELLOW;
|
157
|
+
static const Color FUCHSIA;
|
158
|
+
static const Color CYAN;
|
159
|
+
};
|
160
|
+
|
161
|
+
#ifndef SWIG
|
162
|
+
inline bool operator<(Color a, Color b)
|
163
|
+
{
|
164
|
+
return a.gl() < b.gl();
|
165
|
+
}
|
166
|
+
|
167
|
+
inline bool operator==(Color a, Color b)
|
168
|
+
{
|
169
|
+
return a.gl() == b.gl();
|
170
|
+
}
|
171
|
+
|
172
|
+
inline bool operator!=(Color a, Color b)
|
173
|
+
{
|
174
|
+
return a.gl() != b.gl();
|
175
|
+
}
|
176
|
+
|
177
|
+
//! Interpolates linearly between two colors, with a given weight towards
|
178
|
+
//! the second color.
|
179
|
+
//! Specialization of the general function in Gosu/Math.hpp.
|
180
|
+
Color interpolate(Color a, Color b, double weight = 0.5);
|
181
|
+
|
182
|
+
//! Combines two colors as if their channels were mapped to the 0..1 range
|
183
|
+
//! and then multiplied with each other.
|
184
|
+
Color multiply(Color a, Color b);
|
185
|
+
|
186
|
+
namespace Colors
|
187
|
+
{
|
188
|
+
GOSU_DEPRECATED const Color none (0x00000000);
|
189
|
+
GOSU_DEPRECATED const Color black (0xff000000);
|
190
|
+
GOSU_DEPRECATED const Color gray (0xff808080);
|
191
|
+
GOSU_DEPRECATED const Color white (0xffffffff);
|
192
|
+
|
193
|
+
GOSU_DEPRECATED const Color aqua (0xff00ffff);
|
194
|
+
GOSU_DEPRECATED const Color red (0xffff0000);
|
195
|
+
GOSU_DEPRECATED const Color green (0xff00ff00);
|
196
|
+
GOSU_DEPRECATED const Color blue (0xff0000ff);
|
197
|
+
GOSU_DEPRECATED const Color yellow (0xffffff00);
|
198
|
+
GOSU_DEPRECATED const Color fuchsia (0xffff00ff);
|
199
|
+
GOSU_DEPRECATED const Color cyan (0xff00ffff);
|
200
|
+
}
|
201
|
+
#endif
|
202
|
+
}
|
203
|
+
|
204
|
+
#endif
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//! \file Directories.hpp
|
2
|
+
//! Access to a small set of system paths.
|
3
|
+
|
4
|
+
#ifndef GOSU_DIRECTORIES_HPP
|
5
|
+
#define GOSU_DIRECTORIES_HPP
|
6
|
+
|
7
|
+
#include <string>
|
8
|
+
|
9
|
+
namespace Gosu
|
10
|
+
{
|
11
|
+
//! Prefix for a program's own resources.
|
12
|
+
//! On Windows, the executable's containing directory.
|
13
|
+
//! On OS X, the application's Resources subdirectory.
|
14
|
+
//! On Linux, the current directory.
|
15
|
+
std::wstring resourcePrefix();
|
16
|
+
|
17
|
+
//! Prefix for resources of a group of programs.
|
18
|
+
//! On Windows, the executable's containing directory.
|
19
|
+
//! On OS X, the application's containing subdirectory.
|
20
|
+
//! On Linux, the current directory.
|
21
|
+
std::wstring sharedResourcePrefix();
|
22
|
+
|
23
|
+
//! Prefix for user settings.
|
24
|
+
//! On Windows, the same as %APPDATA%.
|
25
|
+
//! On OS X, the user's Library/Preferences folder.
|
26
|
+
//! On Linux, the home directory plus a trailing dot for hidden files.
|
27
|
+
std::wstring userSettingsPrefix();
|
28
|
+
|
29
|
+
//! Prefix for user documents, e.g. save games.
|
30
|
+
//! On Windows, the My Documents folder.
|
31
|
+
//! On OS X, the user's Documents folder.
|
32
|
+
//! On Linux, the home directory.
|
33
|
+
std::wstring userDocsPrefix();
|
34
|
+
}
|
35
|
+
|
36
|
+
#endif
|
data/Gosu/Font.hpp
ADDED
@@ -0,0 +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
|
data/Gosu/Fwd.hpp
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
//! \file Fwd.hpp
|
2
|
+
//! Contains declarations of all of Gosu's available classes.
|
3
|
+
|
4
|
+
#ifndef GOSU_FWD_HPP
|
5
|
+
#define GOSU_FWD_HPP
|
6
|
+
|
7
|
+
//! The library's main namespace.
|
8
|
+
namespace Gosu
|
9
|
+
{
|
10
|
+
class Audio;
|
11
|
+
class Bitmap;
|
12
|
+
class Buffer;
|
13
|
+
class Button;
|
14
|
+
class Color;
|
15
|
+
class File;
|
16
|
+
class Font;
|
17
|
+
class Graphics;
|
18
|
+
class Image;
|
19
|
+
class ImageData;
|
20
|
+
class Input;
|
21
|
+
class Reader;
|
22
|
+
class Resource;
|
23
|
+
class Sample;
|
24
|
+
class Song;
|
25
|
+
class TextInput;
|
26
|
+
class Timer;
|
27
|
+
class Window;
|
28
|
+
class Writer;
|
29
|
+
}
|
30
|
+
|
31
|
+
#endif
|
data/Gosu/Gosu.hpp
ADDED
@@ -0,0 +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
|
data/Gosu/Graphics.hpp
ADDED
@@ -0,0 +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
|