gosu 0.7.39-x86-mingw32
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 +34 -0
- data/Gosu/Async.hpp +50 -0
- data/Gosu/Audio.hpp +163 -0
- data/Gosu/AutoLink.hpp +16 -0
- data/Gosu/Bitmap.hpp +96 -0
- data/Gosu/ButtonsMac.hpp +140 -0
- data/Gosu/ButtonsWin.hpp +140 -0
- data/Gosu/ButtonsX.hpp +141 -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 +120 -0
- data/Gosu/GraphicsBase.hpp +66 -0
- data/Gosu/IO.hpp +259 -0
- data/Gosu/Image.hpp +138 -0
- data/Gosu/ImageData.hpp +58 -0
- data/Gosu/Input.hpp +161 -0
- data/Gosu/Inspection.hpp +14 -0
- data/Gosu/Math.hpp +135 -0
- data/Gosu/Platform.hpp +73 -0
- data/Gosu/Sockets.hpp +137 -0
- data/Gosu/TR1.hpp +44 -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 +526 -0
- data/Gosu/WinUtility.hpp +75 -0
- data/Gosu/Window.hpp +124 -0
- data/README.txt +25 -0
- data/examples/ChipmunkIntegration.rb +275 -0
- data/examples/CptnRuby.rb +223 -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/FreeImage.dll +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib/gosu.for_1_8.so +0 -0
- data/lib/gosu.for_1_9.so +0 -0
- data/lib/gosu.rb +17 -0
- data/lib/gosu/patches.rb +75 -0
- data/lib/gosu/preview.rb +121 -0
- data/lib/gosu/run.rb +11 -0
- data/lib/gosu/swig_patches.rb +48 -0
- data/lib/gosu/zen.rb +28 -0
- data/lib/libsndfile.dll +0 -0
- metadata +138 -0
data/Gosu/Platform.hpp
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
//! \file Platform.hpp
|
2
|
+
//! Macros and utility functions to facilitate programming on all of Gosu's supported platforms.
|
3
|
+
|
4
|
+
#ifndef GOSU_PLATFORM_HPP
|
5
|
+
#define GOSU_PLATFORM_HPP
|
6
|
+
|
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
|
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
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#include <algorithm>
|
22
|
+
|
23
|
+
namespace Gosu
|
24
|
+
{
|
25
|
+
template<typename T> T IDENTITY_FUN(T t) { return t; }
|
26
|
+
template<typename T> T IDENTITY_FUN2(T t) { return t; }
|
27
|
+
|
28
|
+
template<typename T>
|
29
|
+
T CONV_FUN(T t)
|
30
|
+
{
|
31
|
+
char* begin = reinterpret_cast<char*>(&t);
|
32
|
+
std::reverse(begin, begin + sizeof t);
|
33
|
+
return t;
|
34
|
+
}
|
35
|
+
|
36
|
+
template<typename T> T CONV_FUN2(T t) { return CONV_FUN(t); }
|
37
|
+
}
|
38
|
+
|
39
|
+
#undef IDENTITY_FUN
|
40
|
+
#undef IDENTITY_FUN2
|
41
|
+
#undef CONV_FUN
|
42
|
+
#undef CONV_FUN2
|
43
|
+
|
44
|
+
#if defined(_MSC_VER)
|
45
|
+
# define GOSU_NORETURN __declspec(noreturn)
|
46
|
+
#elif defined(__GNUC__)
|
47
|
+
# define GOSU_NORETURN __attribute__ ((noreturn))
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#if defined(WIN32)
|
51
|
+
# define GOSU_IS_WIN
|
52
|
+
#else
|
53
|
+
# define GOSU_IS_UNIX
|
54
|
+
# if defined(__linux) || defined(__FreeBSD__)
|
55
|
+
# define GOSU_IS_X
|
56
|
+
# else
|
57
|
+
# define GOSU_IS_MAC
|
58
|
+
# include <TargetConditionals.h>
|
59
|
+
# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
60
|
+
# define GOSU_IS_IPHONE
|
61
|
+
# endif
|
62
|
+
# endif
|
63
|
+
#endif
|
64
|
+
|
65
|
+
#if defined(GOSU_IS_WIN)
|
66
|
+
# define GOSU_DEPRECATED __declspec(deprecated)
|
67
|
+
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
68
|
+
# define GOSU_DEPRECATED __attribute__((__deprecated__))
|
69
|
+
#else
|
70
|
+
# define GOSU_DEPRECATED
|
71
|
+
#endif
|
72
|
+
|
73
|
+
#endif
|
data/Gosu/Sockets.hpp
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
//! \file Sockets.hpp
|
2
|
+
//! Interface of the three socket classes, MessageSocket, CommSocket and ListenerSocket.
|
3
|
+
|
4
|
+
#ifndef GOSU_SOCKETS_HPP
|
5
|
+
#define GOSU_SOCKETS_HPP
|
6
|
+
|
7
|
+
#include <Gosu/TR1.hpp>
|
8
|
+
#include <cstddef>
|
9
|
+
#include <string>
|
10
|
+
|
11
|
+
namespace Gosu
|
12
|
+
{
|
13
|
+
//! Addresses are returned from and given to Gosu functions in host byte order.
|
14
|
+
typedef std::tr1::uint32_t SocketAddress;
|
15
|
+
|
16
|
+
//! Ports are returned from and given to Gosu functions in host byte order.
|
17
|
+
typedef std::tr1::uint16_t SocketPort;
|
18
|
+
|
19
|
+
//! Constant that can be used as a placeholder for an arbitrary port, e.g. when
|
20
|
+
//! starting to listen.
|
21
|
+
const SocketPort anyPort = 0;
|
22
|
+
|
23
|
+
//! Tries to convert a dotted IP4 string into an address suitable for
|
24
|
+
//! socket functions. If the string supplied is not such a string, it
|
25
|
+
//! tries to look up the host via DNS. If both methods fail, zero is
|
26
|
+
//! returned.
|
27
|
+
SocketAddress stringToAddress(const std::string& s);
|
28
|
+
//! Converts an address into a dotted IP4 string.
|
29
|
+
std::string addressToString(SocketAddress address);
|
30
|
+
|
31
|
+
//! Wraps an UDP socket. Message sockets can send data to and receive
|
32
|
+
//! data from arbitrary addresses. Also, message sockets send messages
|
33
|
+
//! (packets) which are limited in size and can arrive in any order, or
|
34
|
+
//! not at all.
|
35
|
+
class MessageSocket
|
36
|
+
{
|
37
|
+
struct Impl;
|
38
|
+
const std::auto_ptr<Impl> pimpl;
|
39
|
+
|
40
|
+
public:
|
41
|
+
//! Opens a message socket for listening at the specified port.
|
42
|
+
//! Gosu::anyPort may be passed to have the message socket use
|
43
|
+
//! a random free port.
|
44
|
+
explicit MessageSocket(SocketPort port);
|
45
|
+
~MessageSocket();
|
46
|
+
|
47
|
+
//! Returns the local address of the socket.
|
48
|
+
SocketAddress address() const;
|
49
|
+
//! Returns the local port of the socket.
|
50
|
+
SocketPort port() const;
|
51
|
+
//! Returns the maximum size, in bytes, of a packet that can be sent
|
52
|
+
//! from this socket.
|
53
|
+
std::size_t maxMessageSize() const;
|
54
|
+
|
55
|
+
//! Collects all the packets that were sent to this socket and
|
56
|
+
//! calls onReceive for each of them.
|
57
|
+
void update();
|
58
|
+
|
59
|
+
//! Sends something to the given port of the computer identified
|
60
|
+
//! by the address.
|
61
|
+
void send(SocketAddress address, SocketPort port,
|
62
|
+
const void* buffer, std::size_t size);
|
63
|
+
/*void broadcast(SocketPort port, const void* buffer,
|
64
|
+
std::size_t size);*/
|
65
|
+
|
66
|
+
//! If assigned, will be called by update for every packet received.
|
67
|
+
std::tr1::function<void (SocketAddress, SocketPort, const void*,
|
68
|
+
std::size_t)> onReceive;
|
69
|
+
};
|
70
|
+
|
71
|
+
//! Defines the way in which data is collected until the onReceive event
|
72
|
+
//! is called for CommSockets.
|
73
|
+
enum CommMode
|
74
|
+
{
|
75
|
+
cmRaw,
|
76
|
+
//cmLines,
|
77
|
+
cmManaged
|
78
|
+
};
|
79
|
+
|
80
|
+
class Socket;
|
81
|
+
|
82
|
+
//! Wraps a TCP socket that is used for one part of bi-directional
|
83
|
+
//! communication.
|
84
|
+
class CommSocket
|
85
|
+
{
|
86
|
+
struct Impl;
|
87
|
+
const std::auto_ptr<Impl> pimpl;
|
88
|
+
|
89
|
+
public:
|
90
|
+
CommSocket(CommMode mode, SocketAddress targetAddress,
|
91
|
+
SocketPort targetPort);
|
92
|
+
CommSocket(CommMode mode, Socket& socket);
|
93
|
+
~CommSocket();
|
94
|
+
|
95
|
+
SocketAddress address() const;
|
96
|
+
SocketPort port() const;
|
97
|
+
SocketAddress remoteAddress() const;
|
98
|
+
SocketPort remotePort() const;
|
99
|
+
CommMode mode() const;
|
100
|
+
|
101
|
+
bool connected() const;
|
102
|
+
void disconnect();
|
103
|
+
bool keepAlive() const;
|
104
|
+
void setKeepAlive(bool value);
|
105
|
+
|
106
|
+
void update();
|
107
|
+
void send(const void* buffer, std::size_t size);
|
108
|
+
void sendPendingData();
|
109
|
+
std::size_t pendingBytes() const;
|
110
|
+
|
111
|
+
std::tr1::function<void (const void*, std::size_t)> onReceive;
|
112
|
+
std::tr1::function<void ()> onDisconnection;
|
113
|
+
};
|
114
|
+
|
115
|
+
//! Wraps a TCP socket that waits on a specific port and can create
|
116
|
+
//! CommSocket instances via its onConnection event.
|
117
|
+
class ListenerSocket
|
118
|
+
{
|
119
|
+
struct Impl;
|
120
|
+
const std::auto_ptr<Impl> pimpl;
|
121
|
+
|
122
|
+
public:
|
123
|
+
ListenerSocket(SocketPort port);
|
124
|
+
~ListenerSocket();
|
125
|
+
|
126
|
+
SocketAddress address() const;
|
127
|
+
SocketPort port() const;
|
128
|
+
|
129
|
+
void update();
|
130
|
+
|
131
|
+
//! This signal is fired by update() whenever someone connects
|
132
|
+
//! to the port which is currently listened on.
|
133
|
+
std::tr1::function<void (Socket&)> onConnection;
|
134
|
+
};
|
135
|
+
}
|
136
|
+
|
137
|
+
#endif
|
data/Gosu/TR1.hpp
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
//! \file TR1.hpp
|
2
|
+
//! Includes all parts of C++03 (TR1) that are relevant for Gosu.
|
3
|
+
|
4
|
+
#ifndef GOSU_TR1_HPP
|
5
|
+
#define GOSU_TR1_HPP
|
6
|
+
|
7
|
+
#ifdef _MSC_VER
|
8
|
+
#include <array>
|
9
|
+
#include <memory>
|
10
|
+
#include <functional>
|
11
|
+
namespace std
|
12
|
+
{
|
13
|
+
namespace tr1
|
14
|
+
{
|
15
|
+
typedef unsigned char uint8_t;
|
16
|
+
typedef unsigned short uint16_t;
|
17
|
+
typedef unsigned int uint32_t;
|
18
|
+
typedef unsigned long long uint64_t;
|
19
|
+
typedef signed char int8_t;
|
20
|
+
typedef signed short int16_t;
|
21
|
+
typedef signed int int32_t;
|
22
|
+
typedef signed long long int64_t;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
#else
|
26
|
+
#include <tr1/array>
|
27
|
+
#include <tr1/memory>
|
28
|
+
#include <tr1/functional>
|
29
|
+
#if defined(__GNUC__) && (__GNUC__ < 4 || __GNUC_MINOR__ < 2)
|
30
|
+
#include <stdint.h>
|
31
|
+
namespace std
|
32
|
+
{
|
33
|
+
namespace tr1
|
34
|
+
{
|
35
|
+
using ::int8_t; using ::int16_t; using ::int32_t; using ::int64_t;
|
36
|
+
using ::uint8_t; using ::uint16_t; using ::uint32_t; using ::uint64_t;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
#else
|
40
|
+
#include <tr1/cstdint>
|
41
|
+
#endif
|
42
|
+
#endif
|
43
|
+
|
44
|
+
#endif
|
data/Gosu/Text.hpp
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
//! \file Text.hpp
|
2
|
+
//! Functions to output text on bitmaps.
|
3
|
+
|
4
|
+
#ifndef GOSU_TEXT_HPP
|
5
|
+
#define GOSU_TEXT_HPP
|
6
|
+
|
7
|
+
#include <Gosu/Fwd.hpp>
|
8
|
+
#include <Gosu/Color.hpp>
|
9
|
+
#include <Gosu/GraphicsBase.hpp>
|
10
|
+
#include <string>
|
11
|
+
|
12
|
+
namespace Gosu
|
13
|
+
{
|
14
|
+
//! Returns the name of a neutral font that is available on the current
|
15
|
+
//! platform.
|
16
|
+
std::wstring defaultFontName();
|
17
|
+
|
18
|
+
//! Returns the width an unformatted line of text would span on a bitmap if it were drawn using
|
19
|
+
//! drawText with the same arguments. This is a very low-level function that does not understand
|
20
|
+
//! any of Gosu's HTML-like markup.
|
21
|
+
//! \param text Unformatted text.
|
22
|
+
//! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
|
23
|
+
unsigned textWidth(const std::wstring& text,
|
24
|
+
const std::wstring& fontName, unsigned fontHeight,
|
25
|
+
unsigned fontFlags = 0);
|
26
|
+
|
27
|
+
//! Draws a line of unformatted text on a bitmap. This is a very low-level function that does not understand
|
28
|
+
//! any of Gosu's HTML-like markup.
|
29
|
+
//! \param text Unformatted text.
|
30
|
+
//! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
|
31
|
+
//! \param fontHeight Height, in pixels, of the text.
|
32
|
+
//! \param fontFlags Binary combination of members of the FontFlags
|
33
|
+
//! enum.
|
34
|
+
void drawText(Bitmap& bitmap, const std::wstring& text, int x, int y,
|
35
|
+
Color c, const std::wstring& fontName, unsigned fontHeight,
|
36
|
+
unsigned fontFlags = 0);
|
37
|
+
|
38
|
+
//! Creates a bitmap that is filled with a line of formatted text given to the function.
|
39
|
+
//! The line can contain line breaks and HTML-like markup.
|
40
|
+
//! \param text Formatted text.
|
41
|
+
//! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
|
42
|
+
//! \param fontHeight Height of the font in pixels.
|
43
|
+
//! \param fontFlags Binary combination of members of the FontFlags
|
44
|
+
//! enum.
|
45
|
+
Bitmap createText(const std::wstring& text,
|
46
|
+
const std::wstring& fontName, unsigned fontHeight,
|
47
|
+
unsigned fontFlags = 0);
|
48
|
+
|
49
|
+
//! Creates a bitmap that is filled with the formatted text given to the function.
|
50
|
+
//! The line can contain line breaks and HTML-like markup.
|
51
|
+
//! \param text Formatted text.
|
52
|
+
//! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
|
53
|
+
//! \param fontHeight Height of the font in pixels.
|
54
|
+
//! \param lineSpacing Spacing between two lines of text in pixels. Can be negative to make
|
55
|
+
//! text stick together more closely.
|
56
|
+
//! \param maxWidth Width of the bitmap that will be returned. Text
|
57
|
+
//! will be split into multiple lines to avoid drawing over the right
|
58
|
+
//! border. When a single word is too long, it will be truncated.
|
59
|
+
//! \param fontFlags Binary combination of members of the FontFlags
|
60
|
+
//! enum.
|
61
|
+
Bitmap createText(const std::wstring& text,
|
62
|
+
const std::wstring& fontName, unsigned fontHeight,
|
63
|
+
int lineSpacing, unsigned maxWidth, TextAlign align,
|
64
|
+
unsigned fontFlags = 0);
|
65
|
+
|
66
|
+
//! Registers a new HTML-style entity that can subsequently be used
|
67
|
+
//! with Gosu::Font and Gosu::createText. The name is given without & and ;.
|
68
|
+
void registerEntity(const std::wstring& name, const Bitmap& replacement);
|
69
|
+
}
|
70
|
+
|
71
|
+
#endif
|
data/Gosu/TextInput.hpp
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
//! \file TextInput.hpp
|
2
|
+
//! Interface of the TextInput class.
|
3
|
+
|
4
|
+
#ifndef GOSU_TEXTINPUT_HPP
|
5
|
+
#define GOSU_TEXTINPUT_HPP
|
6
|
+
|
7
|
+
#include <Gosu/Fwd.hpp>
|
8
|
+
#include <Gosu/Platform.hpp>
|
9
|
+
#include <Gosu/TR1.hpp>
|
10
|
+
#include <string>
|
11
|
+
|
12
|
+
namespace Gosu
|
13
|
+
{
|
14
|
+
//! TextInput instances are invisible objects that build a text string from input,
|
15
|
+
//! using the current operating system's keyboard layout.
|
16
|
+
//! At its most basic form, you only need to create a new TextInput instance and
|
17
|
+
//! pass it to your window via setTextInput. Until you call this function again,
|
18
|
+
//! passing 0, the TextInput object will build a text that can be accessed via
|
19
|
+
//! TextInput::text().
|
20
|
+
//! A TextInput object is purely abstract, though; drawing the input field is left
|
21
|
+
//! to the user. As with most of Gosu, how this is handled is completely left open.
|
22
|
+
//! TextInput only aims to provide enough code for your own GUIs to build upon.
|
23
|
+
class TextInput
|
24
|
+
{
|
25
|
+
struct Impl;
|
26
|
+
const std::auto_ptr<Impl> pimpl;
|
27
|
+
|
28
|
+
public:
|
29
|
+
TextInput();
|
30
|
+
virtual ~TextInput();
|
31
|
+
|
32
|
+
std::wstring text() const;
|
33
|
+
|
34
|
+
//! Replaces the current text by the given string and positions the cursor
|
35
|
+
//! at the end of the text, with an empty selection.
|
36
|
+
void setText(const std::wstring& text);
|
37
|
+
|
38
|
+
//! Position of the caret as the index of the character that it's left to.
|
39
|
+
unsigned caretPos() const;
|
40
|
+
//! Sets the caret position as returned by caretPos.
|
41
|
+
//! You usually also want to use setSelectionStart.
|
42
|
+
void setCaretPos(unsigned pos);
|
43
|
+
|
44
|
+
//! If there is a selection, the selectionStart() member yields its beginning,
|
45
|
+
//! using the same indexing scheme as caretPos. If there is no selection,
|
46
|
+
//! selectionStart() is equal to caretPos().
|
47
|
+
unsigned selectionStart() const;
|
48
|
+
//! Sets the start of the selection as returned by selectionStart.
|
49
|
+
void setSelectionStart(unsigned pos);
|
50
|
+
|
51
|
+
// Platform-specific communication with Gosu::Input.
|
52
|
+
#if defined(GOSU_IS_MAC)
|
53
|
+
bool feedNSEvent(void* event);
|
54
|
+
#elif defined(GOSU_IS_WIN)
|
55
|
+
bool feedMessage(unsigned long message, unsigned long wparam, unsigned long lparam);
|
56
|
+
#elif defined(GOSU_IS_X)
|
57
|
+
bool feedXEvent(void* display, void* event);
|
58
|
+
#endif
|
59
|
+
|
60
|
+
//! Overridable filter that is applied to all new text that is entered.
|
61
|
+
//! Allows for context-sensitive filtering/extending/... of the text.
|
62
|
+
//! The text will be inserted at caretPos afterwards.
|
63
|
+
virtual std::wstring filter(const std::wstring& textIn) const
|
64
|
+
{
|
65
|
+
return textIn;
|
66
|
+
}
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
#endif
|
data/Gosu/Timing.hpp
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
//! \file Timing.hpp
|
2
|
+
//! Functions for timing.
|
3
|
+
|
4
|
+
#ifndef GOSU_TIMING_HPP
|
5
|
+
#define GOSU_TIMING_HPP
|
6
|
+
|
7
|
+
namespace Gosu
|
8
|
+
{
|
9
|
+
//! Freezes the current thread for at least the specified time.
|
10
|
+
void sleep(unsigned milliseconds);
|
11
|
+
|
12
|
+
//! Incrementing, possibly wrapping millisecond timer.
|
13
|
+
unsigned long milliseconds();
|
14
|
+
}
|
15
|
+
|
16
|
+
#endif
|
data/Gosu/Utility.hpp
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
//! \file Utility.hpp
|
2
|
+
//! General purpose utility functions.
|
3
|
+
|
4
|
+
#ifndef GOSU_UTILITY_HPP
|
5
|
+
#define GOSU_UTILITY_HPP
|
6
|
+
|
7
|
+
#include <string>
|
8
|
+
#include <vector>
|
9
|
+
|
10
|
+
namespace Gosu
|
11
|
+
{
|
12
|
+
//! Converts an std::string into an std::wstring.
|
13
|
+
std::wstring utf8ToWstring(const std::string& utf8);
|
14
|
+
//! Converts an std::wstring into an std::string.
|
15
|
+
std::string wstringToUTF8(const std::wstring& ws);
|
16
|
+
|
17
|
+
//! Converts an std::string into an std::wstring using local encoding.
|
18
|
+
std::wstring widen(const std::string& s);
|
19
|
+
//! Converts an std::wstring into an std::string using local encoding.
|
20
|
+
std::string narrow(const std::wstring& ws);
|
21
|
+
|
22
|
+
//! Returns the user's preferred language, at the moment of calling the function. Expect return
|
23
|
+
//! values such as 'en_US', 'de_DE.UTF-8', 'ja', 'zh-Hans'. You can rely only on the first two letters
|
24
|
+
//! being a common language abbreviation.
|
25
|
+
std::string language();
|
26
|
+
}
|
27
|
+
|
28
|
+
#endif
|