gosu 0.10.9.pre1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gosu/Audio.hpp +35 -66
- data/Gosu/AutoLink.hpp +14 -16
- data/Gosu/Bitmap.hpp +50 -37
- data/Gosu/Buttons.hpp +246 -265
- data/Gosu/Color.hpp +32 -76
- data/Gosu/Directories.hpp +14 -17
- data/Gosu/Font.hpp +28 -34
- data/Gosu/Fwd.hpp +27 -31
- data/Gosu/Gosu.hpp +2 -5
- data/Gosu/Graphics.hpp +31 -48
- data/Gosu/GraphicsBase.hpp +27 -58
- data/Gosu/IO.hpp +44 -56
- data/Gosu/Image.hpp +29 -73
- data/Gosu/ImageData.hpp +13 -17
- data/Gosu/Input.hpp +42 -57
- data/Gosu/Inspection.hpp +2 -6
- data/Gosu/Math.hpp +32 -38
- data/Gosu/Platform.hpp +10 -29
- data/Gosu/Text.hpp +30 -39
- data/Gosu/TextInput.hpp +29 -36
- data/Gosu/Timing.hpp +14 -16
- data/Gosu/Utility.hpp +10 -15
- data/Gosu/Version.hpp +13 -14
- data/Gosu/Window.hpp +53 -68
- data/README.md +23 -11
- data/ext/gosu/extconf.rb +31 -81
- data/lib/gosu/patches.rb +35 -19
- data/lib/gosu/run.rb +13 -4
- data/rdoc/gosu.rb +24 -20
- data/src/ALChannelManagement.hpp +119 -0
- data/src/{Audio/Audio.cpp → Audio.cpp} +177 -211
- data/src/AudioFile.hpp +57 -0
- data/src/AudioToolboxFile.hpp +214 -0
- data/src/Bitmap.cpp +159 -0
- data/src/BitmapIO.cpp +141 -0
- data/src/BlockAllocator.cpp +133 -0
- data/src/{Graphics/BlockAllocator.hpp → BlockAllocator.hpp} +34 -35
- data/src/ClipRectStack.hpp +87 -0
- data/src/{Graphics/Color.cpp → Color.cpp} +30 -28
- data/src/DirectoriesApple.cpp +68 -0
- data/src/DirectoriesUnix.cpp +20 -18
- data/src/DirectoriesWin.cpp +40 -41
- data/src/DrawOp.hpp +168 -0
- data/src/DrawOpQueue.hpp +190 -0
- data/src/FileUnix.cpp +40 -46
- data/src/FileWin.cpp +42 -38
- data/src/Font.cpp +165 -0
- data/src/{Text/FormattedString.hpp → FormattedString.hpp} +114 -114
- data/src/GosuAppDelegate.cpp +30 -0
- data/src/{UIKit/GosuAppDelegate.h → GosuAppDelegate.h} +0 -0
- data/src/{UIKit/GosuGLView.mm → GosuGLView.cpp} +22 -17
- data/src/{UIKit/GosuGLView.h → GosuGLView.h} +0 -0
- data/src/GosuViewController.cpp +231 -0
- data/src/{UIKit/GosuViewController.h → GosuViewController.h} +0 -0
- data/src/Graphics.cpp +464 -0
- data/src/{Graphics/Common.hpp → GraphicsImpl.hpp} +29 -32
- data/src/IO.cpp +17 -16
- data/src/Iconv.hpp +13 -22
- data/src/Image.cpp +142 -0
- data/src/Input.cpp +459 -0
- data/src/InputUIKit.cpp +197 -0
- data/src/Inspection.cpp +4 -5
- data/src/LargeImageData.cpp +151 -0
- data/src/LargeImageData.hpp +43 -0
- data/src/{Graphics/Macro.cpp → Macro.cpp} +77 -78
- data/src/Macro.hpp +30 -0
- data/src/Math.cpp +17 -29
- data/src/{Audio/OggFile.hpp → OggFile.hpp} +19 -24
- data/src/RenderState.hpp +205 -0
- data/src/Resolution.cpp +86 -0
- data/src/ResolutionApple.cpp +25 -0
- data/{ext/gosu/gosu_wrap.cxx → src/RubyGosu.cxx} +2256 -1707
- data/{ext/gosu/gosu_wrap.h → src/RubyGosu.h} +9 -9
- data/src/{Audio/SndFile.hpp → SndFile.hpp} +54 -43
- data/src/TexChunk.cpp +117 -0
- data/src/{Graphics/TexChunk.hpp → TexChunk.hpp} +13 -18
- data/src/Text.cpp +371 -0
- data/src/TextApple.cpp +209 -0
- data/src/TextInput.cpp +278 -0
- data/src/TextTTFWin.cpp +251 -0
- data/src/{Text/TextUnix.cpp → TextUnix.cpp} +96 -92
- data/src/TextWin.cpp +194 -0
- data/src/{Graphics/Texture.cpp → Texture.cpp} +35 -38
- data/src/{Graphics/Texture.hpp → Texture.hpp} +9 -13
- data/src/TimingApple.cpp +11 -7
- data/src/TimingUnix.cpp +13 -7
- data/src/TimingWin.cpp +6 -1
- data/src/{Graphics/Transform.cpp → Transform.cpp} +17 -12
- data/src/{Graphics/TransformStack.hpp → TransformStack.hpp} +24 -25
- data/src/Utility.cpp +29 -70
- data/src/UtilityApple.cpp +52 -0
- data/src/UtilityWin.cpp +7 -4
- data/src/Version.cpp +22 -0
- data/src/WinMain.cpp +30 -33
- data/src/WinUtility.cpp +24 -22
- data/src/WinUtility.hpp +11 -20
- data/src/Window.cpp +142 -112
- data/src/WindowUIKit.cpp +155 -0
- data/src/stb_image.h +384 -173
- data/src/stb_vorbis.c +20 -18
- metadata +60 -62
- data/Gosu/TR1.hpp +0 -56
- data/src/AppleUtility.hpp +0 -66
- data/src/Audio/ALChannelManagement.hpp +0 -114
- data/src/Audio/Audio.mm +0 -1
- data/src/Audio/AudioFile.hpp +0 -53
- data/src/Audio/AudioToolboxFile.hpp +0 -207
- data/src/Bitmap/Bitmap.cpp +0 -183
- data/src/Bitmap/BitmapIO.cpp +0 -176
- data/src/DirectoriesApple.mm +0 -71
- data/src/Graphics/BlockAllocator.cpp +0 -142
- data/src/Graphics/ClipRectStack.hpp +0 -93
- data/src/Graphics/DrawOp.hpp +0 -175
- data/src/Graphics/DrawOpQueue.hpp +0 -188
- data/src/Graphics/Graphics.cpp +0 -478
- data/src/Graphics/Image.cpp +0 -193
- data/src/Graphics/LargeImageData.cpp +0 -133
- data/src/Graphics/LargeImageData.hpp +0 -46
- data/src/Graphics/Macro.hpp +0 -36
- data/src/Graphics/RenderState.hpp +0 -211
- data/src/Graphics/Resolution.cpp +0 -91
- data/src/Graphics/ResolutionApple.mm +0 -19
- data/src/Graphics/TexChunk.cpp +0 -112
- data/src/Input/Input.cpp +0 -463
- data/src/Input/InputUIKit.mm +0 -190
- data/src/Input/TextInput.cpp +0 -261
- data/src/Text/Font.cpp +0 -175
- data/src/Text/Text.cpp +0 -391
- data/src/Text/TextApple.mm +0 -227
- data/src/Text/TextTTFWin.cpp +0 -249
- data/src/Text/TextWin.cpp +0 -186
- data/src/UIKit/GosuAppDelegate.mm +0 -24
- data/src/UIKit/GosuViewController.mm +0 -211
- data/src/UtilityApple.mm +0 -63
- data/src/WindowUIKit.mm +0 -139
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ad2451369f43dadcb9f88a84fead3c5e3eb2dd3
|
4
|
+
data.tar.gz: 284ae60ac4f93bb14e3188c53652ed86bd439168
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b17636aa514351891d603b9dae3a5210e506f130ef8ced28094c2f2d94c66ee299c40bf25f3959dccf9813bd134b9127b7748553999731c9821d0b4af1bbd591
|
7
|
+
data.tar.gz: 6be1bb1c2228e69c25936ece224ce831c9f36fd25b12306ad91667439748186bd0d7b7fefdac51e99ad122042592714f49b60c7616873e75fb5967896fb417b3
|
data/Gosu/Audio.hpp
CHANGED
@@ -1,63 +1,50 @@
|
|
1
1
|
//! \file Audio.hpp
|
2
2
|
//! Contains all the classes of Gosu's audio system.
|
3
3
|
|
4
|
-
#
|
5
|
-
#define GOSU_AUDIO_HPP
|
4
|
+
#pragma once
|
6
5
|
|
7
|
-
#ifdef WIN32
|
8
|
-
#ifndef NOMINMAX
|
9
|
-
#define NOMINMAX
|
10
|
-
#endif
|
11
|
-
#include <windows.h>
|
12
|
-
#endif
|
13
6
|
#include <Gosu/Fwd.hpp>
|
14
7
|
#include <Gosu/IO.hpp>
|
15
8
|
#include <Gosu/Platform.hpp>
|
16
|
-
#include <Gosu/TR1.hpp>
|
17
9
|
#include <memory>
|
18
10
|
#include <string>
|
19
11
|
|
20
12
|
namespace Gosu
|
21
13
|
{
|
22
|
-
// Deprecated.
|
23
|
-
#ifndef SWIG
|
24
|
-
class Audio;
|
25
|
-
#endif
|
26
|
-
|
27
14
|
//! An instance of a Sample playing. Can be used to stop sounds dynamically,
|
28
15
|
//! or to check if they are finished.
|
29
16
|
//! It is recommended that you throw away sample instances if possible,
|
30
17
|
//! as they could accidentally refer to other sounds being played after
|
31
18
|
//! a very long time has passed.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
bool alive() const;
|
19
|
+
class SampleInstance
|
20
|
+
{
|
21
|
+
int handle, extra;
|
22
|
+
bool alive() const;
|
36
23
|
|
37
|
-
|
38
|
-
//! Called by Sample, do not use.
|
39
|
-
|
40
|
-
SampleInstance(int handle, int extra);
|
24
|
+
public:
|
25
|
+
//! Called internally by Sample, do not use.
|
26
|
+
SampleInstance(int handle, int extra);
|
41
27
|
|
42
|
-
|
43
|
-
|
44
|
-
//! Pauses this instance to be resumed afterwards. It will still keep a channel filled while
|
28
|
+
bool playing() const;
|
29
|
+
bool paused() const;
|
30
|
+
//! Pauses this instance to be resumed afterwards. It will still keep a channel filled while
|
31
|
+
//! paused.
|
45
32
|
void pause();
|
46
33
|
void resume();
|
47
34
|
//! Stops this instance of a sound being played.
|
48
35
|
//! Calling this twice, or too late, does not do any harm.
|
49
|
-
|
36
|
+
void stop();
|
50
37
|
|
51
38
|
//! \param volume Can be anything from 0.0 (silence) to 1.0 (full
|
52
39
|
//! volume).
|
53
|
-
void
|
40
|
+
void change_volume(double volume);
|
54
41
|
//! \param pan Can be anything from -1.0 (left) to 1.0 (right).
|
55
|
-
void
|
42
|
+
void change_pan(double pan);
|
56
43
|
//! \param speed Playback speed is only limited by FMOD's
|
57
44
|
//! capabilities and can accept very high or low values. Use 1.0 for
|
58
45
|
//! normal playback speed.
|
59
|
-
void
|
60
|
-
|
46
|
+
void change_speed(double speed);
|
47
|
+
};
|
61
48
|
|
62
49
|
//! A sample is a short sound that is completely loaded in memory, can be
|
63
50
|
//! played multiple times at once and offers very flexible playback
|
@@ -65,12 +52,12 @@ namespace Gosu
|
|
65
52
|
class Sample
|
66
53
|
{
|
67
54
|
struct SampleData;
|
68
|
-
std::
|
69
|
-
|
55
|
+
std::shared_ptr<SampleData> data;
|
56
|
+
|
70
57
|
public:
|
71
58
|
//! Constructs a sample that can be played on the specified audio
|
72
59
|
//! system and loads the sample from a file.
|
73
|
-
explicit Sample(const std::
|
60
|
+
explicit Sample(const std::string& filename);
|
74
61
|
|
75
62
|
//! Constructs a sample that can be played on the specified audio
|
76
63
|
//! system and loads the sample data from a stream.
|
@@ -82,8 +69,7 @@ namespace Gosu
|
|
82
69
|
//! \param speed Playback speed is only limited by the underlying audio library,
|
83
70
|
//! and can accept very high or low values. Use 1.0 for
|
84
71
|
//! normal playback speed.
|
85
|
-
SampleInstance play(double volume = 1, double speed = 1,
|
86
|
-
bool looping = false) const;
|
72
|
+
SampleInstance play(double volume = 1, double speed = 1, bool looping = false) const;
|
87
73
|
|
88
74
|
//! Plays the sample with panning. Even if pan is 0.0, the sample will
|
89
75
|
//! not be as loud as if it were played by calling play() due to the
|
@@ -94,39 +80,29 @@ namespace Gosu
|
|
94
80
|
//! \param speed Playback speed is only limited by by the underlying audio library,
|
95
81
|
//! and can accept very high
|
96
82
|
//! or low values. Use 1.0 for normal playback speed.
|
97
|
-
SampleInstance
|
83
|
+
SampleInstance play_pan(double pan, double volume = 1, double speed = 1,
|
98
84
|
bool looping = false) const;
|
99
|
-
|
100
|
-
#ifndef SWIG
|
101
|
-
GOSU_DEPRECATED Sample(Audio& audio, const std::wstring& filename);
|
102
|
-
GOSU_DEPRECATED Sample(Audio& audio, Reader reader);
|
103
|
-
#endif
|
104
85
|
};
|
105
86
|
|
106
|
-
//! Songs are less flexible than samples
|
107
|
-
//!
|
87
|
+
//! Songs are less flexible than samples. Only Song can be played at any given time,
|
88
|
+
//! and there is no way to control its pan (stereo position) or speed.
|
108
89
|
class Song
|
109
90
|
{
|
110
91
|
class BaseData;
|
111
92
|
class ModuleData;
|
112
93
|
class StreamData;
|
113
|
-
|
114
|
-
|
115
|
-
|
94
|
+
std::unique_ptr<BaseData> data;
|
95
|
+
|
96
|
+
// Non-movable to avoid dangling internal references.
|
116
97
|
Song(Song&&) = delete;
|
98
|
+
// Non-movable to avoid dangling internal references.
|
117
99
|
Song& operator=(Song&&) = delete;
|
118
|
-
Song(const Song&) = delete;
|
119
|
-
Song& operator=(const Song&) = delete;
|
120
|
-
#else
|
121
|
-
Song(const Song&);
|
122
|
-
Song& operator=(const Song&);
|
123
|
-
#endif
|
124
100
|
|
125
101
|
public:
|
126
102
|
//! Constructs a song that can be played on the provided audio system
|
127
103
|
//! and loads the song from a file. The type is determined from the
|
128
104
|
//! filename.
|
129
|
-
explicit Song(const std::
|
105
|
+
explicit Song(const std::string& filename);
|
130
106
|
|
131
107
|
//! Constructs a song of the specified type that can be played on the
|
132
108
|
//! provided audio system and loads the song data from a stream.
|
@@ -137,36 +113,29 @@ namespace Gosu
|
|
137
113
|
//! Returns the song currently being played or paused, or 0 if
|
138
114
|
//! no song has been played yet or the last song has finished
|
139
115
|
//! playing.
|
140
|
-
static Song*
|
116
|
+
static Song* current_song();
|
141
117
|
|
142
118
|
//! Starts or resumes playback of the song. This will stop all other
|
143
119
|
//! songs and set the current song to this object.
|
144
120
|
void play(bool looping = false);
|
145
121
|
//! Pauses playback of the song. It is not considered being played.
|
146
|
-
//!
|
122
|
+
//! current_song will stay the same.
|
147
123
|
void pause();
|
148
124
|
//! Returns true if the song is the current song, but in paused
|
149
125
|
//! mode.
|
150
126
|
bool paused() const;
|
151
127
|
//! Stops playback of this song if it is currently played or paused.
|
152
|
-
//! Afterwards,
|
128
|
+
//! Afterwards, current_song will return nullptr.
|
153
129
|
void stop();
|
154
130
|
//! Returns true if the song is currently playing.
|
155
131
|
bool playing() const;
|
156
132
|
//! Returns the current volume of the song.
|
157
133
|
double volume() const;
|
158
|
-
//!
|
159
|
-
|
134
|
+
//! \param volume Can be anything from 0.0 (silence) to 1.0 (full
|
135
|
+
//! volume).
|
136
|
+
void change_volume(double volume);
|
160
137
|
|
161
138
|
//! Called every tick by Window for management purposes.
|
162
139
|
static void update();
|
163
|
-
|
164
|
-
#ifndef SWIG
|
165
|
-
enum Type { stStream, stModule };
|
166
|
-
GOSU_DEPRECATED Song(Audio&, const std::wstring& filename);
|
167
|
-
GOSU_DEPRECATED Song(Audio&, Type type, Reader reader);
|
168
|
-
#endif
|
169
140
|
};
|
170
141
|
}
|
171
|
-
|
172
|
-
#endif
|
data/Gosu/AutoLink.hpp
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
//! \file AutoLink.hpp
|
2
|
-
//! Contains pragmas that make MSVC link against all the necessary libraries
|
3
|
-
//! automatically.
|
4
|
-
|
5
|
-
#ifdef _MSC_VER
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
#endif
|
16
|
-
#endif
|
1
|
+
//! \file AutoLink.hpp
|
2
|
+
//! Contains pragmas that make MSVC link against all the necessary libraries
|
3
|
+
//! automatically.
|
4
|
+
|
5
|
+
#ifdef _MSC_VER
|
6
|
+
#pragma once
|
7
|
+
|
8
|
+
#ifdef NDEBUG
|
9
|
+
#pragma comment(lib, "Gosu.lib")
|
10
|
+
#else
|
11
|
+
#pragma comment(lib, "GosuDebug.lib")
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#endif
|
data/Gosu/Bitmap.hpp
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
//! \file Bitmap.hpp
|
2
2
|
//! Interface of the Bitmap class.
|
3
3
|
|
4
|
-
#
|
5
|
-
#define GOSU_BITMAP_HPP
|
4
|
+
#pragma once
|
6
5
|
|
7
|
-
#include <Gosu/Color.hpp>
|
8
6
|
#include <Gosu/Fwd.hpp>
|
7
|
+
#include <Gosu/Color.hpp>
|
9
8
|
#include <Gosu/GraphicsBase.hpp>
|
10
9
|
#include <Gosu/Platform.hpp>
|
11
10
|
#include <string>
|
@@ -23,11 +22,25 @@ namespace Gosu
|
|
23
22
|
std::vector<Color> pixels;
|
24
23
|
|
25
24
|
public:
|
26
|
-
Bitmap()
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
Bitmap()
|
26
|
+
: w(0), h(0)
|
27
|
+
{
|
28
|
+
}
|
29
|
+
|
30
|
+
Bitmap(unsigned w, unsigned h, Color c = Color::NONE)
|
31
|
+
: w(w), h(h), pixels(w * h, c)
|
32
|
+
{
|
33
|
+
}
|
34
|
+
|
35
|
+
unsigned width() const
|
36
|
+
{
|
37
|
+
return w;
|
38
|
+
}
|
39
|
+
|
40
|
+
unsigned height() const
|
41
|
+
{
|
42
|
+
return h;
|
43
|
+
}
|
31
44
|
|
32
45
|
void swap(Bitmap& other);
|
33
46
|
|
@@ -35,11 +48,17 @@ namespace Gosu
|
|
35
48
|
|
36
49
|
//! Returns the color at the specified position. x and y must be on the
|
37
50
|
//! bitmap.
|
38
|
-
Color
|
51
|
+
Color get_pixel(unsigned x, unsigned y) const
|
52
|
+
{
|
53
|
+
return pixels[y * w + x];
|
54
|
+
}
|
39
55
|
|
40
56
|
//! Sets the pixel at the specified position to a color. x and y must
|
41
57
|
//! be on the bitmap.
|
42
|
-
void
|
58
|
+
void set_pixel(unsigned x, unsigned y, Color c)
|
59
|
+
{
|
60
|
+
pixels[y * w + x] = c;
|
61
|
+
}
|
43
62
|
|
44
63
|
//! Inserts a bitmap at the given position. Parts of the inserted
|
45
64
|
//! bitmap that would be outside of the target bitmap will be
|
@@ -49,48 +68,42 @@ namespace Gosu
|
|
49
68
|
//! Inserts a portion of a bitmap at the given position. Parts of the
|
50
69
|
//! inserted bitmap that would be outside of the target bitmap will be
|
51
70
|
//! clipped away.
|
52
|
-
void insert(const Bitmap& source, int x, int y, unsigned
|
53
|
-
unsigned
|
71
|
+
void insert(const Bitmap& source, int x, int y, unsigned src_x, unsigned src_y,
|
72
|
+
unsigned src_width, unsigned src_height);
|
54
73
|
|
55
74
|
//! Direct access to the array of color values. May be useful for optimized
|
56
75
|
//! OpenGL operations.
|
57
|
-
const Color* data() const
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
76
|
+
const Color* data() const
|
77
|
+
{
|
78
|
+
return &pixels[0];
|
79
|
+
}
|
80
|
+
|
81
|
+
Color* data()
|
82
|
+
{
|
83
|
+
return &pixels[0];
|
84
|
+
}
|
63
85
|
};
|
64
86
|
|
65
87
|
//! Loads any supported image into a Bitmap.
|
66
|
-
void
|
88
|
+
void load_image_file(Bitmap& bitmap, const std::string& filename);
|
67
89
|
//! Loads any supported image into a Bitmap.
|
68
|
-
void
|
90
|
+
void load_image_file(Bitmap& bitmap, Reader input);
|
69
91
|
|
70
92
|
//! Saves a Bitmap to a file.
|
71
|
-
void
|
93
|
+
void save_image_file(const Bitmap& bitmap, const std::string& filename);
|
72
94
|
//! Saves a Bitmap to an arbitrary resource.
|
73
|
-
void
|
74
|
-
const std::
|
95
|
+
void save_image_file(const Bitmap& bitmap, Writer writer,
|
96
|
+
const std::string& format_hint = "png");
|
75
97
|
|
76
98
|
//! Set the alpha value of all pixels which are equal to the color key
|
77
99
|
//! to zero. Color values are adjusted so that no borders show up when
|
78
100
|
//! the image is stretched or rotated.
|
79
|
-
void
|
101
|
+
void apply_color_key(Bitmap& bitmap, Color key);
|
80
102
|
|
81
|
-
//! The reverse of
|
103
|
+
//! The reverse of apply_color_key. Resets all fully transparent pixels by
|
82
104
|
//! a background color, makes all other pixels fully opaque.
|
83
|
-
void
|
105
|
+
void unapply_color_key(Bitmap& bitmap, Color background);
|
84
106
|
|
85
|
-
void
|
86
|
-
unsigned
|
87
|
-
unsigned borderFlags);
|
88
|
-
|
89
|
-
// Use loadImageFile/saveImageFile instead.
|
90
|
-
GOSU_DEPRECATED Reader loadFromBMP(Bitmap& bmp, Reader reader);
|
91
|
-
GOSU_DEPRECATED Writer saveToBMP(const Bitmap& bmp, Writer writer);
|
92
|
-
GOSU_DEPRECATED Reader loadFromPNG(Bitmap& bmp, Reader reader);
|
93
|
-
GOSU_DEPRECATED Writer saveToPNG(const Bitmap& bmp, Writer writer);
|
107
|
+
void apply_border_flags(Bitmap& dest, const Bitmap& source, unsigned src_x, unsigned src_y,
|
108
|
+
unsigned src_width, unsigned src_height, unsigned border_flags);
|
94
109
|
}
|
95
|
-
|
96
|
-
#endif
|
data/Gosu/Buttons.hpp
CHANGED
@@ -1,265 +1,246 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
gp3Button15,
|
248
|
-
|
249
|
-
gpRangeEnd = gp3Button15,
|
250
|
-
|
251
|
-
numButtons = gpRangeEnd + 1,
|
252
|
-
numGamepads = 4,
|
253
|
-
noButton = 0xffffffff,
|
254
|
-
|
255
|
-
kbNum = kbRangeEnd - kbRangeBegin + 1,
|
256
|
-
msNum = msRangeEnd - msRangeBegin + 1,
|
257
|
-
gpNum = gpRangeEnd - gpRangeBegin + 1,
|
258
|
-
gpNumPerGamepad = gpNum / (numGamepads + 1)
|
259
|
-
};
|
260
|
-
}
|
261
|
-
|
262
|
-
#undef GOSU_SCANCODE
|
263
|
-
#undef GOSU_SPECIAL_SCANCODE
|
264
|
-
|
265
|
-
#endif
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <Gosu/Platform.hpp>
|
4
|
+
|
5
|
+
namespace Gosu
|
6
|
+
{
|
7
|
+
//! List of button ids that can be used with Gosu::Input.
|
8
|
+
//! This enumeration contains ids for keyboard keys (KB_*),
|
9
|
+
//! mouse buttons and mouse wheel (MS_*) and gamepad buttons (GP_*).
|
10
|
+
enum ButtonName
|
11
|
+
{
|
12
|
+
KB_RANGE_BEGIN,
|
13
|
+
KB_ESCAPE = 41,
|
14
|
+
KB_F1 = 58,
|
15
|
+
KB_F2 = 59,
|
16
|
+
KB_F3 = 60,
|
17
|
+
KB_F4 = 61,
|
18
|
+
KB_F5 = 62,
|
19
|
+
KB_F6 = 63,
|
20
|
+
KB_F7 = 64,
|
21
|
+
KB_F8 = 65,
|
22
|
+
KB_F9 = 66,
|
23
|
+
KB_F10 = 67,
|
24
|
+
KB_F11 = 68,
|
25
|
+
KB_F12 = 69,
|
26
|
+
KB_0 = 39,
|
27
|
+
KB_1 = 30,
|
28
|
+
KB_2 = 31,
|
29
|
+
KB_3 = 32,
|
30
|
+
KB_4 = 33,
|
31
|
+
KB_5 = 34,
|
32
|
+
KB_6 = 35,
|
33
|
+
KB_7 = 36,
|
34
|
+
KB_8 = 37,
|
35
|
+
KB_9 = 38,
|
36
|
+
KB_TAB = 43,
|
37
|
+
KB_RETURN = 40,
|
38
|
+
KB_SPACE = 44,
|
39
|
+
KB_LEFT_SHIFT = 225,
|
40
|
+
KB_RIGHT_SHIFT = 229,
|
41
|
+
KB_LEFT_CONTROL = 224,
|
42
|
+
KB_RIGHT_CONTROL = 228,
|
43
|
+
KB_LEFT_ALT = 226,
|
44
|
+
KB_RIGHT_ALT = 230,
|
45
|
+
KB_LEFT_META = 227,
|
46
|
+
KB_RIGHT_META = 231,
|
47
|
+
KB_BACKSPACE = 42,
|
48
|
+
KB_LEFT = 80,
|
49
|
+
KB_RIGHT = 79,
|
50
|
+
KB_UP = 82,
|
51
|
+
KB_DOWN = 81,
|
52
|
+
KB_HOME = 74,
|
53
|
+
KB_END = 77,
|
54
|
+
KB_INSERT = 73,
|
55
|
+
KB_DELETE = 76,
|
56
|
+
KB_PAGE_UP = 75,
|
57
|
+
KB_PAGE_DOWN = 78,
|
58
|
+
KB_ENTER = 88,
|
59
|
+
KB_BACKTICK = 53,
|
60
|
+
KB_MINUS = 45,
|
61
|
+
KB_EQUALS = 46,
|
62
|
+
KB_LEFT_BRACKET = 47,
|
63
|
+
KB_RIGHT_BRACKET = 48,
|
64
|
+
KB_BACKSLASH = 49,
|
65
|
+
KB_SEMICOLON = 51,
|
66
|
+
KB_APOSTROPHE = 52,
|
67
|
+
KB_COMMA = 54,
|
68
|
+
KB_PERIOD = 55,
|
69
|
+
KB_SLASH = 49,
|
70
|
+
KB_A = 4,
|
71
|
+
KB_B = 5,
|
72
|
+
KB_C = 6,
|
73
|
+
KB_D = 7,
|
74
|
+
KB_E = 8,
|
75
|
+
KB_F = 9,
|
76
|
+
KB_G = 10,
|
77
|
+
KB_H = 11,
|
78
|
+
KB_I = 12,
|
79
|
+
KB_J = 13,
|
80
|
+
KB_K = 14,
|
81
|
+
KB_L = 15,
|
82
|
+
KB_M = 16,
|
83
|
+
KB_N = 17,
|
84
|
+
KB_O = 18,
|
85
|
+
KB_P = 19,
|
86
|
+
KB_Q = 20,
|
87
|
+
KB_R = 21,
|
88
|
+
KB_S = 22,
|
89
|
+
KB_T = 23,
|
90
|
+
KB_U = 24,
|
91
|
+
KB_V = 25,
|
92
|
+
KB_W = 26,
|
93
|
+
KB_X = 27,
|
94
|
+
KB_Y = 28,
|
95
|
+
KB_Z = 29,
|
96
|
+
KB_ISO = 100, // ` on US/UK macOS, < ON EU macOS, \ in US/UK Windows
|
97
|
+
KB_NUMPAD_0 = 98,
|
98
|
+
KB_NUMPAD_1 = 89,
|
99
|
+
KB_NUMPAD_2 = 90,
|
100
|
+
KB_NUMPAD_3 = 91,
|
101
|
+
KB_NUMPAD_4 = 92,
|
102
|
+
KB_NUMPAD_5 = 93,
|
103
|
+
KB_NUMPAD_6 = 94,
|
104
|
+
KB_NUMPAD_7 = 95,
|
105
|
+
KB_NUMPAD_8 = 96,
|
106
|
+
KB_NUMPAD_9 = 97,
|
107
|
+
KB_NUMPAD_PLUS = 87,
|
108
|
+
KB_NUMPAD_MINUS = 86,
|
109
|
+
KB_NUMPAD_MULTIPLY = 85,
|
110
|
+
KB_NUMPAD_DIVIDE = 84,
|
111
|
+
KB_RANGE_END = 0xff,
|
112
|
+
|
113
|
+
MS_RANGE_BEGIN,
|
114
|
+
MS_LEFT = MS_RANGE_BEGIN,
|
115
|
+
MS_MIDDLE,
|
116
|
+
MS_RIGHT,
|
117
|
+
MS_WHEEL_UP,
|
118
|
+
MS_WHEEL_DOWN,
|
119
|
+
MS_OTHER_0,
|
120
|
+
MS_OTHER_1,
|
121
|
+
MS_OTHER_2,
|
122
|
+
MS_OTHER_3,
|
123
|
+
MS_OTHER_4,
|
124
|
+
MS_OTHER_5,
|
125
|
+
MS_OTHER_6,
|
126
|
+
MS_OTHER_7,
|
127
|
+
MS_RANGE_END = 0x110,
|
128
|
+
|
129
|
+
GP_RANGE_BEGIN,
|
130
|
+
GP_LEFT = GP_RANGE_BEGIN,
|
131
|
+
GP_RIGHT,
|
132
|
+
GP_UP,
|
133
|
+
GP_DOWN,
|
134
|
+
GP_BUTTON_0,
|
135
|
+
GP_BUTTON_1,
|
136
|
+
GP_BUTTON_2,
|
137
|
+
GP_BUTTON_3,
|
138
|
+
GP_BUTTON_4,
|
139
|
+
GP_BUTTON_5,
|
140
|
+
GP_BUTTON_6,
|
141
|
+
GP_BUTTON_7,
|
142
|
+
GP_BUTTON_8,
|
143
|
+
GP_BUTTON_9,
|
144
|
+
GP_BUTTON_10,
|
145
|
+
GP_BUTTON_11,
|
146
|
+
GP_BUTTON_12,
|
147
|
+
GP_BUTTON_13,
|
148
|
+
GP_BUTTON_14,
|
149
|
+
GP_BUTTON_15,
|
150
|
+
|
151
|
+
GP_0_LEFT,
|
152
|
+
GP_0_RIGHT,
|
153
|
+
GP_0_UP,
|
154
|
+
GP_0_DOWN,
|
155
|
+
GP_0_BUTTON_0,
|
156
|
+
GP_0_BUTTON_1,
|
157
|
+
GP_0_BUTTON_2,
|
158
|
+
GP_0_BUTTON_3,
|
159
|
+
GP_0_BUTTON_4,
|
160
|
+
GP_0_BUTTON_5,
|
161
|
+
GP_0_BUTTON_6,
|
162
|
+
GP_0_BUTTON_7,
|
163
|
+
GP_0_BUTTON_8,
|
164
|
+
GP_0_BUTTON_9,
|
165
|
+
GP_0_BUTTON_10,
|
166
|
+
GP_0_BUTTON_11,
|
167
|
+
GP_0_BUTTON_12,
|
168
|
+
GP_0_BUTTON_13,
|
169
|
+
GP_0_BUTTON_14,
|
170
|
+
GP_0_BUTTON_15,
|
171
|
+
|
172
|
+
GP_1_LEFT,
|
173
|
+
GP_1_RIGHT,
|
174
|
+
GP_1_UP,
|
175
|
+
GP_1_DOWN,
|
176
|
+
GP_1_BUTTON_0,
|
177
|
+
GP_1_BUTTON_1,
|
178
|
+
GP_1_BUTTON_2,
|
179
|
+
GP_1_BUTTON_3,
|
180
|
+
GP_1_BUTTON_4,
|
181
|
+
GP_1_BUTTON_5,
|
182
|
+
GP_1_BUTTON_6,
|
183
|
+
GP_1_BUTTON_7,
|
184
|
+
GP_1_BUTTON_8,
|
185
|
+
GP_1_BUTTON_9,
|
186
|
+
GP_1_BUTTON_10,
|
187
|
+
GP_1_BUTTON_11,
|
188
|
+
GP_1_BUTTON_12,
|
189
|
+
GP_1_BUTTON_13,
|
190
|
+
GP_1_BUTTON_14,
|
191
|
+
GP_1_BUTTON_15,
|
192
|
+
|
193
|
+
GP_2_LEFT,
|
194
|
+
GP_2_RIGHT,
|
195
|
+
GP_2_UP,
|
196
|
+
GP_2_DOWN,
|
197
|
+
GP_2_BUTTON_0,
|
198
|
+
GP_2_BUTTON_1,
|
199
|
+
GP_2_BUTTON_2,
|
200
|
+
GP_2_BUTTON_3,
|
201
|
+
GP_2_BUTTON_4,
|
202
|
+
GP_2_BUTTON_5,
|
203
|
+
GP_2_BUTTON_6,
|
204
|
+
GP_2_BUTTON_7,
|
205
|
+
GP_2_BUTTON_8,
|
206
|
+
GP_2_BUTTON_9,
|
207
|
+
GP_2_BUTTON_10,
|
208
|
+
GP_2_BUTTON_11,
|
209
|
+
GP_2_BUTTON_12,
|
210
|
+
GP_2_BUTTON_13,
|
211
|
+
GP_2_BUTTON_14,
|
212
|
+
GP_2_BUTTON_15,
|
213
|
+
|
214
|
+
GP_3_LEFT,
|
215
|
+
GP_3_RIGHT,
|
216
|
+
GP_3_UP,
|
217
|
+
GP_3_DOWN,
|
218
|
+
GP_3_BUTTON_0,
|
219
|
+
GP_3_BUTTON_1,
|
220
|
+
GP_3_BUTTON_2,
|
221
|
+
GP_3_BUTTON_3,
|
222
|
+
GP_3_BUTTON_4,
|
223
|
+
GP_3_BUTTON_5,
|
224
|
+
GP_3_BUTTON_6,
|
225
|
+
GP_3_BUTTON_7,
|
226
|
+
GP_3_BUTTON_8,
|
227
|
+
GP_3_BUTTON_9,
|
228
|
+
GP_3_BUTTON_10,
|
229
|
+
GP_3_BUTTON_11,
|
230
|
+
GP_3_BUTTON_12,
|
231
|
+
GP_3_BUTTON_13,
|
232
|
+
GP_3_BUTTON_14,
|
233
|
+
GP_3_BUTTON_15,
|
234
|
+
|
235
|
+
GP_RANGE_END = GP_3_BUTTON_15,
|
236
|
+
|
237
|
+
NUM_BUTTONS = GP_RANGE_END + 1,
|
238
|
+
NUM_GAMEPADS = 4,
|
239
|
+
NO_BUTTON = 0xffffffff,
|
240
|
+
|
241
|
+
KB_NUM = KB_RANGE_END - KB_RANGE_BEGIN + 1,
|
242
|
+
MS_NUM = MS_RANGE_END - MS_RANGE_BEGIN + 1,
|
243
|
+
GP_NUM = GP_RANGE_END - GP_RANGE_BEGIN + 1,
|
244
|
+
GP_NUM_PER_GAMEPAD = GP_NUM / (NUM_GAMEPADS + 1)
|
245
|
+
};
|
246
|
+
}
|