gosu 0.7.29 → 0.7.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gosu/Audio.hpp +4 -12
- data/Gosu/Bitmap.hpp +32 -22
- data/Gosu/Color.hpp +10 -8
- data/Gosu/GraphicsBase.hpp +5 -9
- data/Gosu/Platform.hpp +15 -15
- data/Gosu/Version.hpp +2 -2
- data/GosuImpl/Audio/AudioAudiere.cpp +23 -18
- data/GosuImpl/Graphics/Bitmap.cpp +4 -35
- data/GosuImpl/Graphics/BitmapApple.mm +127 -64
- data/GosuImpl/Graphics/BitmapBMP.cpp +5 -179
- data/GosuImpl/Graphics/BitmapColorKey.cpp +11 -0
- data/GosuImpl/Graphics/BitmapFreeImage.cpp +121 -0
- data/GosuImpl/Graphics/BitmapGDIplus.cpp +204 -0
- data/GosuImpl/Graphics/BitmapUtils.cpp +20 -21
- data/GosuImpl/Graphics/Font.cpp +2 -3
- data/GosuImpl/Graphics/Graphics.cpp +3 -2
- data/GosuImpl/Graphics/LargeImageData.cpp +1 -2
- data/GosuImpl/Graphics/Text.cpp +5 -12
- data/GosuImpl/Graphics/TextTouch.mm +1 -2
- data/GosuImpl/Graphics/Texture.cpp +2 -4
- data/GosuImpl/RubyGosu.swg +20 -26
- data/GosuImpl/RubyGosu_SWIG_RENAME_PATCH.patch +21 -0
- data/GosuImpl/RubyGosu_SWIG_TYPE_PATCH.patch +11 -0
- data/GosuImpl/RubyGosu_wrap.cxx +105 -72
- data/GosuImpl/RubyGosu_wrap.h +1 -1
- data/README.txt +25 -26
- data/examples/RMagickIntegration.rb +77 -103
- data/examples/media/Landscape.svg +10 -0
- data/lib/gosu/patches.rb +5 -5
- data/lib/gosu/swig_patches.rb +22 -0
- data/linux/extconf.rb +55 -22
- metadata +10 -7
- data/GosuImpl/Graphics/BitmapPNG.cpp +0 -279
- data/examples/media/Sky.jpg +0 -0
data/Gosu/Audio.hpp
CHANGED
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
namespace Gosu
|
|
21
21
|
{
|
|
22
22
|
// Deprecated.
|
|
23
|
-
|
|
23
|
+
#ifndef SWIG
|
|
24
|
+
GOSU_DEPRECATED class Audio;
|
|
25
|
+
#endif
|
|
24
26
|
|
|
25
27
|
//! An instance of a Sample playing. Can be used to stop sounds dynamically,
|
|
26
28
|
//! or to check if they are finished.
|
|
@@ -94,8 +96,6 @@ namespace Gosu
|
|
|
94
96
|
SampleInstance playPan(double pan, double volume = 1, double speed = 1,
|
|
95
97
|
bool looping = false) const;
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
// Deprecated.
|
|
99
99
|
#ifndef SWIG
|
|
100
100
|
GOSU_DEPRECATED Sample(Audio& audio, const std::wstring& filename);
|
|
101
101
|
GOSU_DEPRECATED Sample(Audio& audio, Reader reader);
|
|
@@ -150,16 +150,8 @@ namespace Gosu
|
|
|
150
150
|
//! Called every tick by Window for management purposes.
|
|
151
151
|
static void update();
|
|
152
152
|
|
|
153
|
-
// Deprecated.
|
|
154
153
|
#ifndef SWIG
|
|
155
|
-
|
|
156
|
-
//! songs (like OGG) and modules (like MOD or XM).
|
|
157
|
-
enum Type
|
|
158
|
-
{
|
|
159
|
-
stStream,
|
|
160
|
-
stModule
|
|
161
|
-
};
|
|
162
|
-
|
|
154
|
+
enum Type { stStream, stModule };
|
|
163
155
|
GOSU_DEPRECATED Song(Audio&, const std::wstring& filename);
|
|
164
156
|
GOSU_DEPRECATED Song(Audio&, Type type, Reader reader);
|
|
165
157
|
#endif
|
data/Gosu/Bitmap.hpp
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#include <Gosu/Color.hpp>
|
|
8
8
|
#include <Gosu/Fwd.hpp>
|
|
9
9
|
#include <Gosu/GraphicsBase.hpp>
|
|
10
|
+
#include <Gosu/Platform.hpp>
|
|
10
11
|
#include <boost/scoped_ptr.hpp>
|
|
11
12
|
#include <string>
|
|
12
13
|
#include <vector>
|
|
@@ -23,18 +24,16 @@ namespace Gosu
|
|
|
23
24
|
std::vector<Color> pixels;
|
|
24
25
|
|
|
25
26
|
public:
|
|
26
|
-
Bitmap()
|
|
27
|
+
Bitmap() : w(0), h(0) {}
|
|
28
|
+
Bitmap(unsigned w, unsigned h, Color c = Color::NONE) : w(w), h(h), pixels(w * h, c) {}
|
|
27
29
|
|
|
28
|
-
unsigned width()
|
|
30
|
+
unsigned width() const { return w; }
|
|
29
31
|
unsigned height() const { return h; }
|
|
30
32
|
|
|
31
33
|
void swap(Bitmap& other);
|
|
32
34
|
|
|
33
35
|
void resize(unsigned width, unsigned height, Color c = Color::NONE);
|
|
34
|
-
|
|
35
|
-
void fill(Color c);
|
|
36
|
-
void replace(Color oldColor, Color newColor);
|
|
37
|
-
|
|
36
|
+
|
|
38
37
|
//! Returns the color at the specified position. x and y must be on the
|
|
39
38
|
//! bitmap.
|
|
40
39
|
Color getPixel(unsigned x, unsigned y) const { return pixels[y * w + x]; }
|
|
@@ -56,32 +55,43 @@ namespace Gosu
|
|
|
56
55
|
|
|
57
56
|
//! Direct access to the array of color values. May be useful for optimized
|
|
58
57
|
//! OpenGL operations.
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
};
|
|
58
|
+
const Color* data() const { return &pixels[0]; }
|
|
59
|
+
Color* data() { return &pixels[0]; }
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
// Work with data() instead if you need fast operations.
|
|
62
|
+
GOSU_DEPRECATED void fill(Color c);
|
|
63
|
+
GOSU_DEPRECATED void replace(Color oldColor, Color newColor);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
//! Loads any supported image into a Bitmap.
|
|
67
|
+
Bitmap loadImageFile(const std::wstring& filename);
|
|
68
|
+
//! Loads any supported image into a Bitmap.
|
|
69
|
+
Bitmap loadImageFile(Reader input);
|
|
71
70
|
|
|
71
|
+
//! Saves a Bitmap to a file.
|
|
72
|
+
void saveImageFile(const Bitmap& bitmap, const std::wstring& filename);
|
|
73
|
+
//! Saves a Bitmap to an arbitrary resource.
|
|
74
|
+
void saveImageFile(const Bitmap& bitmap, Gosu::Writer writer,
|
|
75
|
+
const std::wstring& formatHint = L"png");
|
|
76
|
+
|
|
72
77
|
//! Set the alpha value of all pixels which are equal to the color key
|
|
73
78
|
//! to zero. Color values are adjusted so that no borders show up when
|
|
74
79
|
//! the image is stretched or rotated.
|
|
75
80
|
void applyColorKey(Bitmap& bitmap, Color key);
|
|
76
81
|
|
|
82
|
+
//! The reverse of applyColorKey. Resets all fully transparent pixels by
|
|
83
|
+
//! a background color, makes all other pixels fully opaque.
|
|
84
|
+
void unapplyColorKey(Bitmap& bitmap, Color background);
|
|
85
|
+
|
|
77
86
|
void applyBorderFlags(Bitmap& dest, const Bitmap& source,
|
|
78
87
|
unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
|
|
79
88
|
unsigned borderFlags);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
|
|
90
|
+
// Use loadImageFile/saveImageFile instead.
|
|
91
|
+
GOSU_DEPRECATED Reader loadFromBMP(Bitmap& bmp, Reader reader);
|
|
92
|
+
GOSU_DEPRECATED Writer saveToBMP(const Bitmap& bmp, Writer writer);
|
|
93
|
+
GOSU_DEPRECATED Reader loadFromPNG(Bitmap& bmp, Reader reader);
|
|
94
|
+
GOSU_DEPRECATED Writer saveToPNG(const Bitmap& bmp, Writer writer);
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
#endif
|
data/Gosu/Color.hpp
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
namespace Gosu
|
|
11
11
|
{
|
|
12
|
-
//! Represents an
|
|
12
|
+
//! Represents an RGBA color value with 8 bits for each channel. Can be
|
|
13
13
|
//! implicitly constructed from literals of the form 0xaarrggbb. Has fast
|
|
14
14
|
//! value semantics.
|
|
15
15
|
//! The four-byte layout in memory is RGBA. On Big-Endian machines the
|
|
@@ -138,6 +138,12 @@ namespace Gosu
|
|
|
138
138
|
return alpha() << 24 | blue() << 16 | green() << 8 | red();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
//! Returns the internal representation of the color (RGBA in memory).
|
|
142
|
+
boost::uint32_t gl() const
|
|
143
|
+
{
|
|
144
|
+
return rep;
|
|
145
|
+
}
|
|
146
|
+
|
|
141
147
|
static const Color NONE;
|
|
142
148
|
static const Color BLACK;
|
|
143
149
|
static const Color GRAY;
|
|
@@ -152,24 +158,20 @@ namespace Gosu
|
|
|
152
158
|
static const Color CYAN;
|
|
153
159
|
};
|
|
154
160
|
|
|
155
|
-
// Causes weird errors when included in the SWIG wrapping process.
|
|
156
|
-
// If, with a future version of SWIG, this can be included and
|
|
157
|
-
// require 'gosu'; include Gosu
|
|
158
|
-
// works from within Ruby, the #ifndef guard can be removed.
|
|
159
161
|
#ifndef SWIG
|
|
160
162
|
inline bool operator<(Color a, Color b)
|
|
161
163
|
{
|
|
162
|
-
return a.
|
|
164
|
+
return a.gl() < b.gl();
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
inline bool operator==(Color a, Color b)
|
|
166
168
|
{
|
|
167
|
-
return a.
|
|
169
|
+
return a.gl() == b.gl();
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
inline bool operator!=(Color a, Color b)
|
|
171
173
|
{
|
|
172
|
-
return a.
|
|
174
|
+
return a.gl() != b.gl();
|
|
173
175
|
}
|
|
174
176
|
#endif
|
|
175
177
|
|
data/Gosu/GraphicsBase.hpp
CHANGED
|
@@ -14,15 +14,6 @@ namespace Gosu
|
|
|
14
14
|
//! lower ZPos value, that is, they are performed last.
|
|
15
15
|
typedef double ZPos;
|
|
16
16
|
|
|
17
|
-
//! The lowest possible Z position. By using this, you tell Gosu that
|
|
18
|
-
//! your drawing operation does not need Z ordering and can be performed
|
|
19
|
-
//! immediately.
|
|
20
|
-
//! Deprecated because this turned out not be very useful in optimizing.
|
|
21
|
-
#ifndef SWIG
|
|
22
|
-
GOSU_DEPRECATED
|
|
23
|
-
#endif
|
|
24
|
-
const double zImmediate = -std::numeric_limits<double>::infinity();
|
|
25
|
-
|
|
26
17
|
//! Determines the way colors are combined when one is drawn onto
|
|
27
18
|
//! another.
|
|
28
19
|
enum AlphaMode
|
|
@@ -64,6 +55,11 @@ namespace Gosu
|
|
|
64
55
|
bfTileableBottom = 8,
|
|
65
56
|
bfTileable = bfTileableLeft | bfTileableTop | bfTileableRight | bfTileableBottom
|
|
66
57
|
};
|
|
58
|
+
|
|
59
|
+
#ifndef SWIG
|
|
60
|
+
// A not so useful optimization.
|
|
61
|
+
GOSU_DEPRECATED const double zImmediate = -std::numeric_limits<double>::infinity();
|
|
62
|
+
#endif
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
#endif
|
data/Gosu/Platform.hpp
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
#define GOSU_PLATFORM_HPP
|
|
6
6
|
|
|
7
7
|
#ifdef __BIG_ENDIAN__
|
|
8
|
-
#define GOSU_IS_BIG_ENDIAN
|
|
9
|
-
#define IDENTITY_FUN bigToNative
|
|
10
|
-
#define IDENTITY_FUN2 nativeToBig
|
|
11
|
-
#define CONV_FUN littleToNative
|
|
12
|
-
#define CONV_FUN2 nativeToLittle
|
|
8
|
+
# define GOSU_IS_BIG_ENDIAN
|
|
9
|
+
# define IDENTITY_FUN bigToNative
|
|
10
|
+
# define IDENTITY_FUN2 nativeToBig
|
|
11
|
+
# define CONV_FUN littleToNative
|
|
12
|
+
# define CONV_FUN2 nativeToLittle
|
|
13
13
|
#else
|
|
14
|
-
#define GOSU_IS_LITTLE_ENDIAN
|
|
15
|
-
#define IDENTITY_FUN littleToNative
|
|
16
|
-
#define IDENTITY_FUN2 nativeToLittle
|
|
17
|
-
#define CONV_FUN bigToNative
|
|
18
|
-
#define CONV_FUN2 nativeToBig
|
|
14
|
+
# define GOSU_IS_LITTLE_ENDIAN
|
|
15
|
+
# define IDENTITY_FUN littleToNative
|
|
16
|
+
# define IDENTITY_FUN2 nativeToLittle
|
|
17
|
+
# define CONV_FUN bigToNative
|
|
18
|
+
# define CONV_FUN2 nativeToBig
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
21
|
#include <algorithm>
|
|
@@ -42,9 +42,9 @@ namespace Gosu
|
|
|
42
42
|
#undef CONV_FUN2
|
|
43
43
|
|
|
44
44
|
#if defined(_MSC_VER)
|
|
45
|
-
#define GOSU_NORETURN __declspec(noreturn)
|
|
45
|
+
# define GOSU_NORETURN __declspec(noreturn)
|
|
46
46
|
#elif defined(__GNUC__)
|
|
47
|
-
#define GOSU_NORETURN __attribute__ ((noreturn))
|
|
47
|
+
# define GOSU_NORETURN __attribute__ ((noreturn))
|
|
48
48
|
#endif
|
|
49
49
|
|
|
50
50
|
#if defined(WIN32)
|
|
@@ -62,10 +62,10 @@ namespace Gosu
|
|
|
62
62
|
# endif
|
|
63
63
|
#endif
|
|
64
64
|
|
|
65
|
-
#if (
|
|
66
|
-
# define GOSU_DEPRECATED __attribute__((__deprecated__))
|
|
67
|
-
#elif defined(GOSU_IS_WIN)
|
|
65
|
+
#if defined(GOSU_IS_WIN)
|
|
68
66
|
# define GOSU_DEPRECATED __declspec(deprecated)
|
|
67
|
+
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
|
68
|
+
# define GOSU_DEPRECATED __attribute__((__deprecated__))
|
|
69
69
|
#else
|
|
70
70
|
# define GOSU_DEPRECATED
|
|
71
71
|
#endif
|
data/Gosu/Version.hpp
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include <Gosu/Audio.hpp>
|
|
2
2
|
#include <Gosu/Math.hpp>
|
|
3
3
|
#include <Gosu/IO.hpp>
|
|
4
|
+
#include <Gosu/Utility.hpp>
|
|
4
5
|
#include <boost/foreach.hpp>
|
|
5
6
|
#include <algorithm>
|
|
6
7
|
#include <stdexcept>
|
|
@@ -55,8 +56,12 @@ namespace Gosu
|
|
|
55
56
|
ADR_METHOD(void) streamStopped(StopEvent* event)
|
|
56
57
|
{
|
|
57
58
|
if (event->getReason() == StopEvent::STREAM_ENDED)
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
BOOST_FOREACH (NumberedStream& stream, streams)
|
|
60
|
+
if (stream.stream == event->getOutputStream())
|
|
61
|
+
{
|
|
62
|
+
stream.stream = 0;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
public:
|
|
@@ -91,17 +96,6 @@ namespace Gosu
|
|
|
91
96
|
{
|
|
92
97
|
streams.at(handle).stream = 0;
|
|
93
98
|
}
|
|
94
|
-
|
|
95
|
-
bool clear(OutputStreamPtr stream)
|
|
96
|
-
{
|
|
97
|
-
BOOST_FOREACH (NumberedStream& numberedStream, streams)
|
|
98
|
-
if (numberedStream.stream == stream)
|
|
99
|
-
{
|
|
100
|
-
numberedStream.stream = 0;
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
99
|
};
|
|
106
100
|
|
|
107
101
|
// Intentionally leak. Let Windows clean up on program exit.
|
|
@@ -148,7 +142,6 @@ namespace Gosu
|
|
|
148
142
|
}
|
|
149
143
|
return device;
|
|
150
144
|
}
|
|
151
|
-
|
|
152
145
|
}
|
|
153
146
|
}
|
|
154
147
|
|
|
@@ -217,6 +210,8 @@ Gosu::Sample::Sample(const std::wstring& filename)
|
|
|
217
210
|
|
|
218
211
|
SampleSourcePtr source = OpenSampleSource(MemoryBuffer(filename), FF_AUTODETECT);
|
|
219
212
|
data->buffer = CreateSampleBuffer(source);
|
|
213
|
+
if (!data->buffer)
|
|
214
|
+
throw std::runtime_error("Cannot open " + wstringToUTF8(filename));
|
|
220
215
|
}
|
|
221
216
|
|
|
222
217
|
Gosu::Sample::Sample(Reader reader)
|
|
@@ -225,6 +220,8 @@ Gosu::Sample::Sample(Reader reader)
|
|
|
225
220
|
|
|
226
221
|
SampleSourcePtr source = audiere::OpenSampleSource(MemoryBuffer(reader), FF_AUTODETECT);
|
|
227
222
|
data->buffer = CreateSampleBuffer(source);
|
|
223
|
+
if (!data->buffer)
|
|
224
|
+
throw std::runtime_error("Cannot open audio file");
|
|
228
225
|
}
|
|
229
226
|
|
|
230
227
|
Gosu::SampleInstance Gosu::Sample::play(double volume, double speed,
|
|
@@ -271,6 +268,7 @@ public:
|
|
|
271
268
|
|
|
272
269
|
virtual void play(bool looping) = 0;
|
|
273
270
|
virtual bool playing() const = 0;
|
|
271
|
+
virtual bool paused() const = 0;
|
|
274
272
|
virtual void pause() = 0;
|
|
275
273
|
virtual void stop() = 0;
|
|
276
274
|
|
|
@@ -297,6 +295,8 @@ class Gosu::Song::StreamData : public BaseData
|
|
|
297
295
|
{
|
|
298
296
|
int handle, extra;
|
|
299
297
|
stream = OpenSound(device(), buffer, true);
|
|
298
|
+
if (!stream)
|
|
299
|
+
throw std::runtime_error("Cannot open audio file for streaming");
|
|
300
300
|
streams.put(stream, handle, extra);
|
|
301
301
|
instance = SampleInstance(handle, extra);
|
|
302
302
|
loop = false;
|
|
@@ -327,6 +327,11 @@ public:
|
|
|
327
327
|
{
|
|
328
328
|
return instance.playing();
|
|
329
329
|
}
|
|
330
|
+
|
|
331
|
+
bool paused() const
|
|
332
|
+
{
|
|
333
|
+
return instance.paused();
|
|
334
|
+
}
|
|
330
335
|
|
|
331
336
|
void pause()
|
|
332
337
|
{
|
|
@@ -335,7 +340,7 @@ public:
|
|
|
335
340
|
|
|
336
341
|
void stop()
|
|
337
342
|
{
|
|
338
|
-
instance.
|
|
343
|
+
instance.stop();
|
|
339
344
|
stream->reset();
|
|
340
345
|
}
|
|
341
346
|
|
|
@@ -361,9 +366,9 @@ Gosu::Song::~Song()
|
|
|
361
366
|
|
|
362
367
|
Gosu::Song* Gosu::Song::currentSong()
|
|
363
368
|
{
|
|
364
|
-
if (curSong)
|
|
369
|
+
if (curSong && (curSong->playing() || curSong->paused()))
|
|
365
370
|
return curSong;
|
|
366
|
-
return 0;
|
|
371
|
+
return curSong = 0;
|
|
367
372
|
}
|
|
368
373
|
|
|
369
374
|
void Gosu::Song::play(bool looping)
|
|
@@ -387,7 +392,7 @@ void Gosu::Song::pause()
|
|
|
387
392
|
|
|
388
393
|
bool Gosu::Song::paused() const
|
|
389
394
|
{
|
|
390
|
-
return curSong == this &&
|
|
395
|
+
return curSong == this && data->paused();
|
|
391
396
|
}
|
|
392
397
|
|
|
393
398
|
void Gosu::Song::stop()
|
|
@@ -3,21 +3,6 @@
|
|
|
3
3
|
#include <algorithm>
|
|
4
4
|
#include <vector>
|
|
5
5
|
|
|
6
|
-
Gosu::Bitmap::Bitmap()
|
|
7
|
-
: w(0), h(0)
|
|
8
|
-
{
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/*unsigned Gosu::Bitmap::width() const
|
|
12
|
-
{
|
|
13
|
-
return w;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
unsigned Gosu::Bitmap::height() const
|
|
17
|
-
{
|
|
18
|
-
return h;
|
|
19
|
-
}*/
|
|
20
|
-
|
|
21
6
|
void Gosu::Bitmap::swap(Bitmap& other)
|
|
22
7
|
{
|
|
23
8
|
std::swap(pixels, other.pixels);
|
|
@@ -27,10 +12,10 @@ void Gosu::Bitmap::swap(Bitmap& other)
|
|
|
27
12
|
|
|
28
13
|
void Gosu::Bitmap::resize(unsigned width, unsigned height, Color c)
|
|
29
14
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
temp
|
|
15
|
+
if (width == w && height == h)
|
|
16
|
+
return;
|
|
17
|
+
|
|
18
|
+
Bitmap temp(width, height, c);
|
|
34
19
|
temp.insert(*this, 0, 0);
|
|
35
20
|
swap(temp);
|
|
36
21
|
}
|
|
@@ -45,22 +30,6 @@ void Gosu::Bitmap::replace(Color what, Color with)
|
|
|
45
30
|
std::replace(pixels.begin(), pixels.end(), what, with);
|
|
46
31
|
}
|
|
47
32
|
|
|
48
|
-
/*Gosu::Color Gosu::Bitmap::getPixel(unsigned x, unsigned y) const
|
|
49
|
-
{
|
|
50
|
-
assert(x <= w);
|
|
51
|
-
assert(y <= h);
|
|
52
|
-
assert(w*h > 0);
|
|
53
|
-
return pixels[y * w + x];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
void Gosu::Bitmap::setPixel(unsigned x, unsigned y, Color c)
|
|
57
|
-
{
|
|
58
|
-
assert(x <= w);
|
|
59
|
-
assert(y <= h);
|
|
60
|
-
assert(w*h > 0);
|
|
61
|
-
pixels[y * w + x] = c;
|
|
62
|
-
}*/
|
|
63
|
-
|
|
64
33
|
void Gosu::Bitmap::insert(const Bitmap& source, int x, int y)
|
|
65
34
|
{
|
|
66
35
|
insert(source, x, y, 0, 0, source.width(), source.height());
|