gosu 0.7.10.1
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/COPYING.txt +29 -0
- data/Gosu/Async.hpp +48 -0
- data/Gosu/Audio.hpp +145 -0
- data/Gosu/AutoLink.hpp +16 -0
- data/Gosu/Bitmap.hpp +85 -0
- data/Gosu/ButtonsMac.hpp +114 -0
- data/Gosu/ButtonsWin.hpp +111 -0
- data/Gosu/ButtonsX.hpp +115 -0
- data/Gosu/Color.hpp +172 -0
- data/Gosu/Directories.hpp +36 -0
- data/Gosu/Font.hpp +59 -0
- data/Gosu/Fwd.hpp +31 -0
- data/Gosu/Gosu.hpp +26 -0
- data/Gosu/Graphics.hpp +86 -0
- data/Gosu/GraphicsBase.hpp +45 -0
- data/Gosu/IO.hpp +255 -0
- data/Gosu/Image.hpp +148 -0
- data/Gosu/ImageData.hpp +45 -0
- data/Gosu/Input.hpp +116 -0
- data/Gosu/Math.hpp +95 -0
- data/Gosu/Platform.hpp +61 -0
- data/Gosu/RotFlip.hpp +116 -0
- data/Gosu/Sockets.hpp +129 -0
- data/Gosu/Text.hpp +47 -0
- data/Gosu/TextInput.hpp +57 -0
- data/Gosu/Timing.hpp +16 -0
- data/Gosu/Utility.hpp +24 -0
- data/Gosu/WinUtility.hpp +76 -0
- data/Gosu/Window.hpp +84 -0
- data/GosuImpl/Async.cpp +37 -0
- data/GosuImpl/AudioFmod.cpp +417 -0
- data/GosuImpl/AudioSDL.cpp +255 -0
- data/GosuImpl/DirectoriesMac.mm +38 -0
- data/GosuImpl/DirectoriesUnix.cpp +48 -0
- data/GosuImpl/DirectoriesWin.cpp +42 -0
- data/GosuImpl/FileUnix.cpp +100 -0
- data/GosuImpl/FileWin.cpp +83 -0
- data/GosuImpl/Graphics/Bitmap.cpp +116 -0
- data/GosuImpl/Graphics/BitmapBMP.cpp +232 -0
- data/GosuImpl/Graphics/BitmapColorKey.cpp +39 -0
- data/GosuImpl/Graphics/BitmapPNG.cpp +276 -0
- data/GosuImpl/Graphics/BitmapUtils.cpp +67 -0
- data/GosuImpl/Graphics/BlockAllocator.cpp +127 -0
- data/GosuImpl/Graphics/BlockAllocator.hpp +34 -0
- data/GosuImpl/Graphics/Color.cpp +126 -0
- data/GosuImpl/Graphics/Common.hpp +21 -0
- data/GosuImpl/Graphics/DrawOp.hpp +154 -0
- data/GosuImpl/Graphics/Font.cpp +110 -0
- data/GosuImpl/Graphics/Graphics.cpp +295 -0
- data/GosuImpl/Graphics/Image.cpp +159 -0
- data/GosuImpl/Graphics/LargeImageData.cpp +115 -0
- data/GosuImpl/Graphics/LargeImageData.hpp +37 -0
- data/GosuImpl/Graphics/RotFlip.cpp +184 -0
- data/GosuImpl/Graphics/TexChunk.cpp +77 -0
- data/GosuImpl/Graphics/TexChunk.hpp +40 -0
- data/GosuImpl/Graphics/Text.cpp +223 -0
- data/GosuImpl/Graphics/TextMac.cpp +242 -0
- data/GosuImpl/Graphics/TextPangoFT.cpp +186 -0
- data/GosuImpl/Graphics/TextWin.cpp +172 -0
- data/GosuImpl/Graphics/Texture.cpp +104 -0
- data/GosuImpl/Graphics/Texture.hpp +34 -0
- data/GosuImpl/IO.cpp +48 -0
- data/GosuImpl/InputMac.mm +677 -0
- data/GosuImpl/InputWin.cpp +444 -0
- data/GosuImpl/InputX.cpp +158 -0
- data/GosuImpl/MacUtility.hpp +48 -0
- data/GosuImpl/Math.cpp +49 -0
- data/GosuImpl/RubyGosu.swg +474 -0
- data/GosuImpl/RubyGosuStub.mm +17 -0
- data/GosuImpl/RubyGosu_DllMain.cxx +30 -0
- data/GosuImpl/RubyGosu_wrap.cxx +8521 -0
- data/GosuImpl/RubyGosu_wrap.h +31 -0
- data/GosuImpl/Sockets/CommSocket.cpp +304 -0
- data/GosuImpl/Sockets/ListenerSocket.cpp +60 -0
- data/GosuImpl/Sockets/MessageSocket.cpp +136 -0
- data/GosuImpl/Sockets/Socket.cpp +145 -0
- data/GosuImpl/Sockets/Sockets.hpp +66 -0
- data/GosuImpl/TextInputMac.mm +207 -0
- data/GosuImpl/TextInputWin.cpp +197 -0
- data/GosuImpl/TextInputX.cpp +201 -0
- data/GosuImpl/TextTTFWin.cpp +247 -0
- data/GosuImpl/TimingUnix.cpp +17 -0
- data/GosuImpl/TimingWin.cpp +28 -0
- data/GosuImpl/Utility.cpp +140 -0
- data/GosuImpl/WinMain.cpp +69 -0
- data/GosuImpl/WinUtility.cpp +137 -0
- data/GosuImpl/WindowMac.mm +466 -0
- data/GosuImpl/WindowWin.cpp +447 -0
- data/GosuImpl/WindowX.cpp +392 -0
- data/GosuImpl/X11vroot.h +118 -0
- data/README.txt +13 -0
- data/Rakefile +178 -0
- data/examples/ChipmunkIntegration.rb +275 -0
- data/examples/CptnRuby.rb +231 -0
- data/examples/MoreChipmunkAndRMagick.rb +155 -0
- data/examples/OpenGLIntegration.rb +232 -0
- data/examples/RMagickIntegration.rb +449 -0
- data/examples/TextInput.cpp +170 -0
- data/examples/TextInput.rb +139 -0
- data/examples/Tutorial.cpp +215 -0
- data/examples/Tutorial.rb +137 -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/LargeStar.png +0 -0
- data/examples/media/Sky.jpg +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/linux/Makefile.in +98 -0
- data/linux/configure +5658 -0
- data/linux/configure.ac +126 -0
- data/linux/extconf.rb +11 -0
- data/mac/English.lproj/InfoPlist.strings +0 -0
- data/mac/Gosu-Info.plist +26 -0
- data/mac/Gosu.xcodeproj/project.pbxproj +1194 -0
- data/mac/RubyGosu Template-Info.plist +26 -0
- data/mac/libboost_thread_1_34_1_universal.a +0 -0
- data/mac/libboost_thread_d_1_34_1_universal.a +0 -0
- data/mac/libfmod_universal.a +0 -0
- data/mac/libpng_universal.a +0 -0
- data/mac/libz_universal.a +0 -0
- data/reference/Async_8hpp-source.html +70 -0
- data/reference/Audio_8hpp-source.html +114 -0
- data/reference/Audio_8hpp.html +50 -0
- data/reference/AutoLink_8hpp-source.html +38 -0
- data/reference/AutoLink_8hpp.html +34 -0
- data/reference/Bitmap_8hpp-source.html +85 -0
- data/reference/Bitmap_8hpp.html +58 -0
- data/reference/ButtonsMac_8hpp-source.html +133 -0
- data/reference/ButtonsWin_8hpp-source.html +133 -0
- data/reference/ButtonsX_8hpp-source.html +134 -0
- data/reference/Color_8hpp-source.html +169 -0
- data/reference/Color_8hpp.html +85 -0
- data/reference/Directories_8hpp-source.html +42 -0
- data/reference/Directories_8hpp.html +46 -0
- data/reference/Font_8hpp-source.html +65 -0
- data/reference/Font_8hpp.html +41 -0
- data/reference/Fwd_8hpp-source.html +52 -0
- data/reference/Fwd_8hpp.html +37 -0
- data/reference/Gosu_8hpp-source.html +48 -0
- data/reference/Gosu_8hpp.html +34 -0
- data/reference/GraphicsBase_8hpp-source.html +57 -0
- data/reference/GraphicsBase_8hpp.html +56 -0
- data/reference/Graphics_8hpp-source.html +96 -0
- data/reference/Graphics_8hpp.html +53 -0
- data/reference/IO_8hpp-source.html +255 -0
- data/reference/IO_8hpp.html +74 -0
- data/reference/ImageData_8hpp-source.html +62 -0
- data/reference/ImageData_8hpp.html +43 -0
- data/reference/Image_8hpp-source.html +126 -0
- data/reference/Image_8hpp.html +48 -0
- data/reference/Input_8hpp-source.html +118 -0
- data/reference/Input_8hpp.html +50 -0
- data/reference/Math_8hpp-source.html +92 -0
- data/reference/Math_8hpp.html +74 -0
- data/reference/Platform_8hpp-source.html +83 -0
- data/reference/Platform_8hpp.html +73 -0
- data/reference/RotFlip_8hpp-source.html +138 -0
- data/reference/RotFlip_8hpp.html +77 -0
- data/reference/Sockets_8hpp-source.html +130 -0
- data/reference/Sockets_8hpp.html +66 -0
- data/reference/TextInput_8hpp-source.html +64 -0
- data/reference/TextInput_8hpp.html +41 -0
- data/reference/Text_8hpp-source.html +51 -0
- data/reference/Text_8hpp.html +46 -0
- data/reference/Timing_8hpp-source.html +36 -0
- data/reference/Timing_8hpp.html +42 -0
- data/reference/Utility_8hpp-source.html +44 -0
- data/reference/Utility_8hpp.html +48 -0
- data/reference/WinUtility_8hpp-source.html +79 -0
- data/reference/WinUtility_8hpp.html +64 -0
- data/reference/Window_8hpp-source.html +91 -0
- data/reference/Window_8hpp.html +41 -0
- data/reference/annotated.html +51 -0
- data/reference/classGosu_1_1Audio-members.html +34 -0
- data/reference/classGosu_1_1Audio.html +46 -0
- data/reference/classGosu_1_1Bitmap-members.html +44 -0
- data/reference/classGosu_1_1Bitmap.html +263 -0
- data/reference/classGosu_1_1Buffer-members.html +44 -0
- data/reference/classGosu_1_1Buffer.html +78 -0
- data/reference/classGosu_1_1Buffer.png +0 -0
- data/reference/classGosu_1_1Button-members.html +36 -0
- data/reference/classGosu_1_1Button.html +143 -0
- data/reference/classGosu_1_1Color-members.html +56 -0
- data/reference/classGosu_1_1Color.html +387 -0
- data/reference/classGosu_1_1File-members.html +41 -0
- data/reference/classGosu_1_1File.html +69 -0
- data/reference/classGosu_1_1File.png +0 -0
- data/reference/classGosu_1_1Font-members.html +39 -0
- data/reference/classGosu_1_1Font.html +309 -0
- data/reference/classGosu_1_1Graphics-members.html +50 -0
- data/reference/classGosu_1_1Graphics.html +234 -0
- data/reference/classGosu_1_1Image-members.html +45 -0
- data/reference/classGosu_1_1Image.html +518 -0
- data/reference/classGosu_1_1ImageData-members.html +37 -0
- data/reference/classGosu_1_1ImageData.html +60 -0
- data/reference/classGosu_1_1Input-members.html +44 -0
- data/reference/classGosu_1_1Input.html +223 -0
- data/reference/classGosu_1_1MessageSocket-members.html +40 -0
- data/reference/classGosu_1_1MessageSocket.html +233 -0
- data/reference/classGosu_1_1Resource-members.html +39 -0
- data/reference/classGosu_1_1Resource.html +116 -0
- data/reference/classGosu_1_1Resource.png +0 -0
- data/reference/classGosu_1_1Sample-members.html +37 -0
- data/reference/classGosu_1_1Sample.html +200 -0
- data/reference/classGosu_1_1SampleInstance-members.html +38 -0
- data/reference/classGosu_1_1SampleInstance.html +169 -0
- data/reference/classGosu_1_1Song-members.html +43 -0
- data/reference/classGosu_1_1Song.html +260 -0
- data/reference/classGosu_1_1TextInput-members.html +38 -0
- data/reference/classGosu_1_1TextInput.html +121 -0
- data/reference/classGosu_1_1Window-members.html +50 -0
- data/reference/classGosu_1_1Window.html +271 -0
- data/reference/doxyfile +233 -0
- data/reference/doxygen.css +433 -0
- data/reference/doxygen.png +0 -0
- data/reference/files.html +54 -0
- data/reference/functions.html +236 -0
- data/reference/functions_enum.html +45 -0
- data/reference/functions_func.html +227 -0
- data/reference/functions_vars.html +47 -0
- data/reference/hierarchy.html +53 -0
- data/reference/index.html +26 -0
- data/reference/namespaceGosu.html +2890 -0
- data/reference/namespaceGosu_1_1Colors.html +70 -0
- data/reference/namespaceGosu_1_1Win.html +275 -0
- data/reference/namespacemembers.html +216 -0
- data/reference/namespacemembers_enum.html +52 -0
- data/reference/namespacemembers_eval.html +54 -0
- data/reference/namespacemembers_func.html +185 -0
- data/reference/namespacemembers_type.html +46 -0
- data/reference/namespacemembers_vars.html +46 -0
- data/reference/namespaces.html +35 -0
- data/reference/tab_b.gif +0 -0
- data/reference/tab_l.gif +0 -0
- data/reference/tab_r.gif +0 -0
- data/reference/tabs.css +102 -0
- data/windows/Gosu.sln +29 -0
- data/windows/Gosu.vcproj +553 -0
- data/windows/RubyGosu.vcproj +138 -0
- metadata +305 -0
data/COPYING.txt
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (C) 2004-2007 Julian Raschke, Jan Lücker and all contributors.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
+
copy of this software and associated documentation files (the "Software"),
|
5
|
+
to deal in the Software without restriction, including without limitation
|
6
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
8
|
+
Software is furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
19
|
+
DEALINGS IN THE SOFTWARE.
|
20
|
+
|
21
|
+
Julian Raschke julian@raschke.de
|
22
|
+
Jan Lücker jan.luecker@gmx.de
|
23
|
+
http://code.google.com/p/gosu/
|
24
|
+
|
25
|
+
***
|
26
|
+
|
27
|
+
Does NOT apply to fmod.dll shipped with the Windows version of Gosu,
|
28
|
+
or the bytecode of FMOD contained in Gosu.framework and gosu.bundle on OS X.
|
29
|
+
FMOD is a property of Firelight Technologies Pty, Ltd., see www.fmod.org.
|
data/Gosu/Async.hpp
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
// Undocumented for the first few iterations. Interface may change rapidly.
|
2
|
+
// This is mainly a proof of concept. Stability will be the highest on OS X.
|
3
|
+
|
4
|
+
#ifndef GOSU_ASYNC_HPP
|
5
|
+
#define GOSU_ASYNC_HPP
|
6
|
+
|
7
|
+
#include <Gosu/Fwd.hpp>
|
8
|
+
#include <boost/shared_ptr.hpp>
|
9
|
+
#include <boost/thread.hpp>
|
10
|
+
#include <memory>
|
11
|
+
#include <string>
|
12
|
+
|
13
|
+
namespace Gosu
|
14
|
+
{
|
15
|
+
template<typename Result>
|
16
|
+
class AsyncResult
|
17
|
+
{
|
18
|
+
boost::shared_ptr<boost::try_mutex> mutex;
|
19
|
+
boost::shared_ptr<std::auto_ptr<Result> > result;
|
20
|
+
|
21
|
+
public:
|
22
|
+
AsyncResult(const boost::shared_ptr<boost::try_mutex>& mutex,
|
23
|
+
const boost::shared_ptr<std::auto_ptr<Result> >& result)
|
24
|
+
: mutex(mutex), result(result)
|
25
|
+
{
|
26
|
+
}
|
27
|
+
|
28
|
+
bool hasValue() const
|
29
|
+
{
|
30
|
+
boost::try_mutex::scoped_try_lock lock(*mutex);
|
31
|
+
return lock && result->get();
|
32
|
+
}
|
33
|
+
|
34
|
+
std::auto_ptr<Result> takeValue()
|
35
|
+
{
|
36
|
+
boost::try_mutex::scoped_lock lock(*mutex);
|
37
|
+
return *result;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
// TODO: Will only work if the window doesn't die inbetween.
|
42
|
+
// TODO: More functions to come; or a general interface?
|
43
|
+
|
44
|
+
AsyncResult<Image>
|
45
|
+
asyncNewImage(Window& window, const std::wstring& filename);
|
46
|
+
}
|
47
|
+
|
48
|
+
#endif
|
data/Gosu/Audio.hpp
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
//! \file Audio.hpp
|
2
|
+
//! Contains all the classes of Gosu's audio system.
|
3
|
+
|
4
|
+
// REDESIGN: Rename all changeXXX() member functions to setXXX().
|
5
|
+
// REDESIGN: Don't require window argument, is this possible?
|
6
|
+
|
7
|
+
#ifndef GOSU_AUDIO_HPP
|
8
|
+
#define GOSU_AUDIO_HPP
|
9
|
+
|
10
|
+
#ifdef WIN32
|
11
|
+
#include <windows.h>
|
12
|
+
#endif
|
13
|
+
#include <Gosu/Fwd.hpp>
|
14
|
+
#include <Gosu/Platform.hpp>
|
15
|
+
#include <boost/scoped_ptr.hpp>
|
16
|
+
#include <boost/utility.hpp>
|
17
|
+
#include <string>
|
18
|
+
|
19
|
+
namespace Gosu
|
20
|
+
{
|
21
|
+
//! Manages initialization and finalization of audio libraries. Must be
|
22
|
+
//! created before and destroyed after all samples and songs.
|
23
|
+
//! There can only be one instance of Gosu::Audio.
|
24
|
+
//! Usually created internally by Gosu::Window.
|
25
|
+
class Audio : boost::noncopyable
|
26
|
+
{
|
27
|
+
public:
|
28
|
+
#ifdef GOSU_IS_WIN
|
29
|
+
explicit Audio(HWND window);
|
30
|
+
#else
|
31
|
+
Audio();
|
32
|
+
#endif
|
33
|
+
~Audio();
|
34
|
+
};
|
35
|
+
|
36
|
+
//! An instance of a Sample playing. Can be used to stop sounds dynamically,
|
37
|
+
//! or to check if they are finished.
|
38
|
+
//! It is recommended that you throw away sample instances if possible,
|
39
|
+
//! as they could accidentally refer to sounds played very long ago.
|
40
|
+
class SampleInstance
|
41
|
+
{
|
42
|
+
int handle, extra;
|
43
|
+
|
44
|
+
public:
|
45
|
+
//! Called by Sample, do not use.
|
46
|
+
SampleInstance(int handle, int extra);
|
47
|
+
|
48
|
+
bool playing() const;
|
49
|
+
void stop();
|
50
|
+
|
51
|
+
//! \param volume Can be anything from 0.0 (silence) to 1.0 (full
|
52
|
+
//! volume).
|
53
|
+
void changeVolume(double volume);
|
54
|
+
//! \param pan Can be anything from -1.0 (left) to 1.0 (right).
|
55
|
+
void changePan(double pan);
|
56
|
+
//! \param speed Playback speed is only limited by FMOD's
|
57
|
+
//! capatibilities and can accept very high or low values. Use 1.0 for
|
58
|
+
//! normal playback speed.
|
59
|
+
void changeSpeed(double speed);
|
60
|
+
};
|
61
|
+
|
62
|
+
//! A sample is a short sound that is completely loaded in memory, can be
|
63
|
+
//! played multiple times at once and offers very flexible playback
|
64
|
+
//! parameters. In short, use samples for everything that's not music.
|
65
|
+
class Sample
|
66
|
+
{
|
67
|
+
struct SampleData;
|
68
|
+
boost::scoped_ptr<SampleData> data;
|
69
|
+
|
70
|
+
public:
|
71
|
+
//! Constructs a sample that can be played on the specified audio
|
72
|
+
//! system and loads the sample from a file.
|
73
|
+
Sample(Audio& audio, const std::wstring& filename);
|
74
|
+
|
75
|
+
//! Constructs a sample that can be played on the specified audio
|
76
|
+
//! system and loads the sample data from a stream.
|
77
|
+
Sample(Audio& audio, Reader reader);
|
78
|
+
|
79
|
+
~Sample();
|
80
|
+
|
81
|
+
//! Plays the sample without panning.
|
82
|
+
//! \param volume Can be anything from 0.0 (silence) to 1.0 (full
|
83
|
+
//! volume).
|
84
|
+
//! \param speed Playback speed is only limited by FMOD's
|
85
|
+
//! capatibilities and can accept very high or low values. Use 1.0 for
|
86
|
+
//! normal playback speed.
|
87
|
+
SampleInstance play(double volume = 1, double speed = 1) const;
|
88
|
+
|
89
|
+
//! Plays the sample with panning. Even if pan is 0.0, the sample will
|
90
|
+
//! not be as loud as if it were played by calling play() due to the
|
91
|
+
//! way FMOD's panning works.
|
92
|
+
//! \param pan Can be anything from -1.0 (left) to 1.0 (right).
|
93
|
+
//! \param volume Can be anything from 0.0 (silence) to 1.0 (full
|
94
|
+
//! volume).
|
95
|
+
//! \param speed Playback speed is only limited by FMOD's
|
96
|
+
//! capatibilities and can accept very high or low values. Use 1.0 for
|
97
|
+
//! normal playback speed.
|
98
|
+
SampleInstance playPan(double pan, double volume = 1, double speed = 1) const;
|
99
|
+
};
|
100
|
+
|
101
|
+
//! Songs are less flexible than samples in that they can only be played
|
102
|
+
//! one at a time and without panning or speed parameters.
|
103
|
+
class Song
|
104
|
+
{
|
105
|
+
class BaseData;
|
106
|
+
class ModuleData;
|
107
|
+
class StreamData;
|
108
|
+
boost::scoped_ptr<BaseData> data;
|
109
|
+
|
110
|
+
public:
|
111
|
+
//! There are two types of songs that can be loaded as a Song: Streamed
|
112
|
+
//! songs (like OGG) and modules (like MOD or XM).
|
113
|
+
enum Type
|
114
|
+
{
|
115
|
+
stStream,
|
116
|
+
stModule
|
117
|
+
};
|
118
|
+
|
119
|
+
//! Constructs a song that can be played on the provided audio system
|
120
|
+
//! and loads the song from a file. The type is determined from the
|
121
|
+
//! filename.
|
122
|
+
Song(Audio&, const std::wstring& filename);
|
123
|
+
|
124
|
+
//! Constructs a song of the specified type that can be played on the
|
125
|
+
//! provided audio system and loads the song data from a stream.
|
126
|
+
Song(Audio&, Type type, Reader reader);
|
127
|
+
|
128
|
+
~Song();
|
129
|
+
|
130
|
+
//! Starts playback of the song. This will stop all other songs and
|
131
|
+
//! cause the currently played song to restart if called on the
|
132
|
+
//! current song.
|
133
|
+
void play();
|
134
|
+
//! Stops playback of this song if it is currently played.
|
135
|
+
void stop();
|
136
|
+
//! Returns if the song is currently playing.
|
137
|
+
bool playing() const;
|
138
|
+
//! Returns the current volume of the song.
|
139
|
+
double volume() const;
|
140
|
+
//! Changes the volume of the song.
|
141
|
+
void changeVolume(double volume);
|
142
|
+
};
|
143
|
+
}
|
144
|
+
|
145
|
+
#endif
|
data/Gosu/AutoLink.hpp
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
//! \file AutoLink.hpp
|
2
|
+
//! Contains pragmas that make MSVC link against all the necessary libraries
|
3
|
+
//! automatically.
|
4
|
+
|
5
|
+
#ifdef _MSC_VER
|
6
|
+
#ifndef GOSU_AUTOLINK_HPP
|
7
|
+
#define GOSU_AUTOLINK_HPP
|
8
|
+
|
9
|
+
#ifdef NDEBUG
|
10
|
+
#pragma comment(lib, "Gosu.lib")
|
11
|
+
#else
|
12
|
+
#pragma comment(lib, "GosuDebug.lib")
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#endif
|
16
|
+
#endif
|
data/Gosu/Bitmap.hpp
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
//! \file Bitmap.hpp
|
2
|
+
//! Interface of the Bitmap class.
|
3
|
+
|
4
|
+
#ifndef GOSU_BITMAP_HPP
|
5
|
+
#define GOSU_BITMAP_HPP
|
6
|
+
|
7
|
+
#include <Gosu/Color.hpp>
|
8
|
+
#include <Gosu/Fwd.hpp>
|
9
|
+
#include <Gosu/GraphicsBase.hpp>
|
10
|
+
#include <boost/scoped_ptr.hpp>
|
11
|
+
#include <string>
|
12
|
+
#include <vector>
|
13
|
+
|
14
|
+
namespace Gosu
|
15
|
+
{
|
16
|
+
//! Rectangular area of pixels, each represented by a Color value. Provides
|
17
|
+
//! minimal drawing functionality and serves as a temporary holder for
|
18
|
+
//! graphical resources which are usually turned into Images later.
|
19
|
+
//! Has (expensive) value semantics.
|
20
|
+
class Bitmap
|
21
|
+
{
|
22
|
+
unsigned w, h;
|
23
|
+
std::vector<Color> pixels;
|
24
|
+
|
25
|
+
public:
|
26
|
+
Bitmap();
|
27
|
+
|
28
|
+
unsigned width() const { return w; }
|
29
|
+
unsigned height() const { return h; }
|
30
|
+
|
31
|
+
void swap(Bitmap& other);
|
32
|
+
|
33
|
+
void resize(unsigned width, unsigned height, Color c = Colors::none);
|
34
|
+
|
35
|
+
void fill(Color c);
|
36
|
+
void replace(Color oldColor, Color newColor);
|
37
|
+
|
38
|
+
//! Returns the color at the specified position. x and y must be on the
|
39
|
+
//! bitmap.
|
40
|
+
Color getPixel(unsigned x, unsigned y) const { return pixels[y * w + x]; }
|
41
|
+
|
42
|
+
//! Sets the pixel at the specified position to a color. x and y must
|
43
|
+
//! be on the bitmap.
|
44
|
+
void setPixel(unsigned x, unsigned y, Color c) { pixels[y * w + x] = c; }
|
45
|
+
|
46
|
+
//! Inserts a bitmap at the given position. Parts of the inserted
|
47
|
+
//! bitmap that would be outside of the target bitmap will be
|
48
|
+
//! clipped away.
|
49
|
+
void insert(const Bitmap& source, int x, int y);
|
50
|
+
|
51
|
+
//! Inserts a portion of a bitmap at the given position. Parts of the
|
52
|
+
//! inserted bitmap that would be outside of the target bitmap will be
|
53
|
+
//! clipped away.
|
54
|
+
void insert(const Bitmap& source, int x, int y, unsigned srcX,
|
55
|
+
unsigned srcY, unsigned srcWidth, unsigned srcHeight);
|
56
|
+
|
57
|
+
#ifndef __BIG_ENDIAN__
|
58
|
+
//! Undocumented optimization for Image creation; to be changed.
|
59
|
+
const unsigned* glCompatibleData() const { return reinterpret_cast<const unsigned*>(&pixels[0]); }
|
60
|
+
#endif
|
61
|
+
};
|
62
|
+
|
63
|
+
//! Loads a Windows or OS/2 BMP file into the given bitmap.
|
64
|
+
Reader loadFromBMP(Bitmap& bmp, Reader reader);
|
65
|
+
//! Saves the contents of the given bitmap into windows BMP file data.
|
66
|
+
Writer saveToBMP(const Bitmap& bmp, Writer writer);
|
67
|
+
//! Loads a PNG file into the given bitmap.
|
68
|
+
Reader loadFromPNG(Bitmap& bmp, Reader reader);
|
69
|
+
//! Saves the contents of the given bitmap into PNG file data, 24 bits.
|
70
|
+
Writer saveToPNG(const Bitmap& bmp, Writer writer);
|
71
|
+
|
72
|
+
//! Set the alpha value of all pixels which are equal to the color key
|
73
|
+
//! to zero. Color values are adjusted so that no borders show up when
|
74
|
+
//! the image is stretched or rotated.
|
75
|
+
void applyColorKey(Bitmap& bitmap, Color key);
|
76
|
+
|
77
|
+
void applyBorderFlags(Bitmap& dest, const Bitmap& source,
|
78
|
+
unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight,
|
79
|
+
unsigned borderFlags);
|
80
|
+
|
81
|
+
// Still to be moved around & undocumented, beware! (TODO)
|
82
|
+
Bitmap quickLoadBitmap(const std::wstring& filename);
|
83
|
+
}
|
84
|
+
|
85
|
+
#endif
|
data/Gosu/ButtonsMac.hpp
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#ifndef GOSU_BUTTONSMAC_HPP
|
2
|
+
#define GOSU_BUTTONSMAC_HPP
|
3
|
+
|
4
|
+
namespace Gosu
|
5
|
+
{
|
6
|
+
//! List of all the button ids that can be used with Gosu::Input.
|
7
|
+
//! This enumeration contains ids for non-character keyboard keys (kb*),
|
8
|
+
//! mouse buttons and mouse wheel (ms*) and gamepad buttons (gp*).
|
9
|
+
enum ButtonName
|
10
|
+
{
|
11
|
+
kbRangeBegin = 0x01,
|
12
|
+
kbEscape = 0x35,
|
13
|
+
kbF1 = 0x7a,
|
14
|
+
kbF2 = 0x78,
|
15
|
+
kbF3 = 0x63,
|
16
|
+
kbF4 = 0x76,
|
17
|
+
kbF5 = 0x60,
|
18
|
+
kbF6 = 0x61,
|
19
|
+
kbF7 = 0x62,
|
20
|
+
kbF8 = 0x64,
|
21
|
+
kbF9 = 0x65,
|
22
|
+
kbF10 = 0x6d,
|
23
|
+
kbF11 = 0x67,
|
24
|
+
kbF12 = 0x6f,
|
25
|
+
kb1 = 0x12,
|
26
|
+
kb2 = 0x13,
|
27
|
+
kb3 = 0x14,
|
28
|
+
kb4 = 0x15,
|
29
|
+
kb5 = 0x17,
|
30
|
+
kb6 = 0x16,
|
31
|
+
kb7 = 0x1a,
|
32
|
+
kb8 = 0x1c,
|
33
|
+
kb9 = 0x19,
|
34
|
+
kb0 = 0x1d,
|
35
|
+
kbTab = 0x30,
|
36
|
+
kbReturn = 0x24,
|
37
|
+
kbSpace = 0x31,
|
38
|
+
kbLeftShift = 0x38,
|
39
|
+
kbRightShift = 0x3c,
|
40
|
+
kbLeftControl = 0x3b,
|
41
|
+
kbRightControl = 0x3e,
|
42
|
+
kbLeftAlt = 0x3a,
|
43
|
+
kbRightAlt = 0x3d,
|
44
|
+
kbLeftMeta = 0x37,
|
45
|
+
kbRightMeta = 0x36,
|
46
|
+
kbBackspace = 0x33,
|
47
|
+
kbLeft = 0x7b,
|
48
|
+
kbRight = 0x7c,
|
49
|
+
kbUp = 0x7e,
|
50
|
+
kbDown = 0x7d,
|
51
|
+
kbHome = 0x73,
|
52
|
+
kbEnd = 0x77,
|
53
|
+
kbInsert = 0x72,
|
54
|
+
kbDelete = 0x75,
|
55
|
+
kbPageUp = 0x74,
|
56
|
+
kbPageDown = 0x79,
|
57
|
+
kbEnter = 0x4c,
|
58
|
+
kbNumpad1 = 0x53,
|
59
|
+
kbNumpad2 = 0x54,
|
60
|
+
kbNumpad3 = 0x55,
|
61
|
+
kbNumpad4 = 0x56,
|
62
|
+
kbNumpad5 = 0x57,
|
63
|
+
kbNumpad6 = 0x58,
|
64
|
+
kbNumpad7 = 0x59,
|
65
|
+
kbNumpad8 = 0x5b,
|
66
|
+
kbNumpad9 = 0x5c,
|
67
|
+
kbNumpad0 = 0x52,
|
68
|
+
kbNumpadAdd = 0x45,
|
69
|
+
kbNumpadSubtract = 0x4e,
|
70
|
+
kbNumpadMultiply = 0x43,
|
71
|
+
kbNumpadDivide = 0x4b,
|
72
|
+
kbRangeEnd = 0xffff,
|
73
|
+
|
74
|
+
msRangeBegin,
|
75
|
+
msLeft = msRangeBegin,
|
76
|
+
msRight,
|
77
|
+
msMiddle,
|
78
|
+
msWheelUp,
|
79
|
+
msWheelDown,
|
80
|
+
msRangeEnd,
|
81
|
+
|
82
|
+
gpRangeBegin,
|
83
|
+
gpLeft = gpRangeBegin,
|
84
|
+
gpRight,
|
85
|
+
gpUp,
|
86
|
+
gpDown,
|
87
|
+
gpButton0,
|
88
|
+
gpButton1,
|
89
|
+
gpButton2,
|
90
|
+
gpButton3,
|
91
|
+
gpButton4,
|
92
|
+
gpButton5,
|
93
|
+
gpButton6,
|
94
|
+
gpButton7,
|
95
|
+
gpButton8,
|
96
|
+
gpButton9,
|
97
|
+
gpButton10,
|
98
|
+
gpButton11,
|
99
|
+
gpButton12,
|
100
|
+
gpButton13,
|
101
|
+
gpButton14,
|
102
|
+
gpButton15,
|
103
|
+
gpRangeEnd = gpButton15,
|
104
|
+
|
105
|
+
kbNum = kbRangeEnd - kbRangeBegin + 1,
|
106
|
+
msNum = msRangeEnd - msRangeBegin + 1,
|
107
|
+
gpNum = gpRangeEnd - gpRangeBegin + 1,
|
108
|
+
|
109
|
+
numButtons = gpRangeEnd + 1,
|
110
|
+
noButton = 0xffffffff
|
111
|
+
};
|
112
|
+
}
|
113
|
+
|
114
|
+
#endif
|
data/Gosu/ButtonsWin.hpp
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
#ifndef GOSU_BUTTONSWIN_HPP
|
2
|
+
#define GOSU_BUTTONSWIN_HPP
|
3
|
+
|
4
|
+
namespace Gosu
|
5
|
+
{
|
6
|
+
enum ButtonName
|
7
|
+
{
|
8
|
+
kbRangeBegin = 1,
|
9
|
+
kbEscape = 0x01,
|
10
|
+
kbF1 = 0x3b,
|
11
|
+
kbF2 = 0x3c,
|
12
|
+
kbF3 = 0x3d,
|
13
|
+
kbF4 = 0x3e,
|
14
|
+
kbF5 = 0x3f,
|
15
|
+
kbF6 = 0x40,
|
16
|
+
kbF7 = 0x41,
|
17
|
+
kbF8 = 0x42,
|
18
|
+
kbF9 = 0x43,
|
19
|
+
kbF10 = 0x44,
|
20
|
+
kbF11 = 0x57,
|
21
|
+
kbF12 = 0x58,
|
22
|
+
kb0 = 0x0b,
|
23
|
+
kb1 = 0x02,
|
24
|
+
kb2 = 0x03,
|
25
|
+
kb3 = 0x04,
|
26
|
+
kb4 = 0x05,
|
27
|
+
kb5 = 0x06,
|
28
|
+
kb6 = 0x07,
|
29
|
+
kb7 = 0x08,
|
30
|
+
kb8 = 0x09,
|
31
|
+
kb9 = 0x0a,
|
32
|
+
kbTab = 0x0f,
|
33
|
+
kbReturn = 0x1c,
|
34
|
+
kbSpace = 0x39,
|
35
|
+
kbLeftShift = 0x2a,
|
36
|
+
kbRightShift = 0x36,
|
37
|
+
kbLeftControl = 0x1d,
|
38
|
+
kbRightControl = 0x9d,
|
39
|
+
kbLeftAlt = 0x38,
|
40
|
+
kbRightAlt = 0xb8,
|
41
|
+
kbLeftMeta = 0xdb,
|
42
|
+
kbRightMeta = 0xdc,
|
43
|
+
kbBackspace = 0x0e,
|
44
|
+
kbLeft = 0xcb,
|
45
|
+
kbRight = 0xcd,
|
46
|
+
kbUp = 0xc8,
|
47
|
+
kbDown = 0xd0,
|
48
|
+
kbHome = 0xc7,
|
49
|
+
kbEnd = 0xcf,
|
50
|
+
kbInsert = 0xd2,
|
51
|
+
kbDelete = 0xd3,
|
52
|
+
kbPageUp = 0xc9,
|
53
|
+
kbPageDown = 0xd1,
|
54
|
+
kbEnter = 0x9c,
|
55
|
+
kbNumpad0 = 0x52,
|
56
|
+
kbNumpad1 = 0x4f,
|
57
|
+
kbNumpad2 = 0x50,
|
58
|
+
kbNumpad3 = 0x51,
|
59
|
+
kbNumpad4 = 0x4b,
|
60
|
+
kbNumpad5 = 0x4c,
|
61
|
+
kbNumpad6 = 0x4d,
|
62
|
+
kbNumpad7 = 0x47,
|
63
|
+
kbNumpad8 = 0x48,
|
64
|
+
kbNumpad9 = 0x49,
|
65
|
+
kbNumpadAdd = 0x4e,
|
66
|
+
kbNumpadSubtract = 0x4a,
|
67
|
+
kbNumpadMultiply = 0x37,
|
68
|
+
kbNumpadDivide = 0xb5,
|
69
|
+
kbRangeEnd = 0xff,
|
70
|
+
|
71
|
+
msRangeBegin,
|
72
|
+
msLeft = msRangeBegin,
|
73
|
+
msRight,
|
74
|
+
msMiddle,
|
75
|
+
msWheelUp,
|
76
|
+
msWheelDown,
|
77
|
+
msRangeEnd,
|
78
|
+
|
79
|
+
gpRangeBegin,
|
80
|
+
gpLeft = gpRangeBegin,
|
81
|
+
gpRight,
|
82
|
+
gpUp,
|
83
|
+
gpDown,
|
84
|
+
gpButton0,
|
85
|
+
gpButton1,
|
86
|
+
gpButton2,
|
87
|
+
gpButton3,
|
88
|
+
gpButton4,
|
89
|
+
gpButton5,
|
90
|
+
gpButton6,
|
91
|
+
gpButton7,
|
92
|
+
gpButton8,
|
93
|
+
gpButton9,
|
94
|
+
gpButton10,
|
95
|
+
gpButton11,
|
96
|
+
gpButton12,
|
97
|
+
gpButton13,
|
98
|
+
gpButton14,
|
99
|
+
gpButton15,
|
100
|
+
gpRangeEnd = gpButton15,
|
101
|
+
|
102
|
+
kbNum = kbRangeEnd - kbRangeBegin + 1,
|
103
|
+
msNum = msRangeEnd - msRangeBegin + 1,
|
104
|
+
gpNum = gpRangeEnd - gpRangeBegin + 1,
|
105
|
+
|
106
|
+
numButtons = gpRangeEnd,
|
107
|
+
noButton = 0xffffffff
|
108
|
+
};
|
109
|
+
}
|
110
|
+
|
111
|
+
#endif
|