gosu 0.7.11 → 0.7.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gosu/Audio.hpp +33 -16
- data/Gosu/GraphicsBase.hpp +6 -1
- data/Gosu/Input.hpp +8 -2
- data/Gosu/Platform.hpp +63 -61
- data/Gosu/Window.hpp +11 -0
- data/GosuImpl/AudioFmod.cpp +89 -16
- data/GosuImpl/AudioSDL.cpp +59 -19
- data/GosuImpl/Graphics/BitmapUtils.cpp +3 -0
- data/GosuImpl/Graphics/Common.hpp +8 -3
- data/GosuImpl/Graphics/DrawOp.hpp +70 -7
- data/GosuImpl/Graphics/Graphics.cpp +34 -2
- data/GosuImpl/Graphics/TexChunk.cpp +7 -1
- data/GosuImpl/Graphics/Texture.cpp +31 -9
- data/GosuImpl/Iconv.hpp +3 -0
- data/GosuImpl/InputMac.mm +31 -10
- data/GosuImpl/InputWin.cpp +8 -0
- data/GosuImpl/InputX.cpp +64 -45
- data/GosuImpl/Math.cpp +1 -1
- data/GosuImpl/RubyGosu.swg +27 -7
- data/GosuImpl/RubyGosu_wrap.cxx +338 -205
- data/GosuImpl/Utility.cpp +1 -0
- data/GosuImpl/WindowMac.mm +29 -3
- data/GosuImpl/WindowWin.cpp +16 -5
- data/GosuImpl/WindowX.cpp +3 -3
- data/README.txt +7 -3
- data/Rakefile +2 -1
- data/mac/Gosu.icns +0 -0
- data/mac/Gosu.xcodeproj/jlnr.mode1v3 +74 -75
- data/mac/Gosu.xcodeproj/jlnr.pbxuser +731 -257
- data/mac/Gosu.xcodeproj/jlnr.perspectivev3 +1531 -0
- data/reference/Async_8hpp-source.html +1 -1
- data/reference/Audio_8hpp-source.html +68 -58
- data/reference/Audio_8hpp.html +1 -1
- data/reference/AutoLink_8hpp-source.html +1 -1
- data/reference/AutoLink_8hpp.html +1 -1
- data/reference/Bitmap_8hpp-source.html +1 -1
- data/reference/Bitmap_8hpp.html +1 -1
- data/reference/ButtonsMac_8hpp-source.html +1 -1
- data/reference/ButtonsWin_8hpp-source.html +1 -1
- data/reference/ButtonsX_8hpp-source.html +1 -1
- data/reference/Color_8hpp-source.html +1 -1
- data/reference/Color_8hpp.html +1 -1
- data/reference/Directories_8hpp-source.html +1 -1
- data/reference/Directories_8hpp.html +1 -1
- data/reference/Font_8hpp-source.html +1 -1
- data/reference/Font_8hpp.html +1 -1
- data/reference/Fwd_8hpp-source.html +1 -1
- data/reference/Fwd_8hpp.html +1 -1
- data/reference/Gosu_8hpp-source.html +1 -1
- data/reference/Gosu_8hpp.html +1 -1
- data/reference/GraphicsBase_8hpp-source.html +28 -26
- data/reference/GraphicsBase_8hpp.html +4 -1
- data/reference/Graphics_8hpp-source.html +1 -1
- data/reference/Graphics_8hpp.html +1 -1
- data/reference/IO_8hpp-source.html +1 -1
- data/reference/IO_8hpp.html +1 -1
- data/reference/ImageData_8hpp-source.html +1 -1
- data/reference/ImageData_8hpp.html +1 -1
- data/reference/Image_8hpp-source.html +1 -1
- data/reference/Image_8hpp.html +1 -1
- data/reference/Input_8hpp-source.html +19 -16
- data/reference/Input_8hpp.html +1 -1
- data/reference/Math_8hpp-source.html +1 -1
- data/reference/Math_8hpp.html +1 -1
- data/reference/Platform_8hpp-source.html +22 -20
- data/reference/Platform_8hpp.html +1 -1
- data/reference/RotFlip_8hpp-source.html +1 -1
- data/reference/RotFlip_8hpp.html +1 -1
- data/reference/Sockets_8hpp-source.html +1 -1
- data/reference/Sockets_8hpp.html +1 -1
- data/reference/TextInput_8hpp-source.html +1 -1
- data/reference/TextInput_8hpp.html +1 -1
- data/reference/Text_8hpp-source.html +1 -1
- data/reference/Text_8hpp.html +1 -1
- data/reference/Timing_8hpp-source.html +1 -1
- data/reference/Timing_8hpp.html +1 -1
- data/reference/Utility_8hpp-source.html +1 -1
- data/reference/Utility_8hpp.html +1 -1
- data/reference/WinUtility_8hpp-source.html +1 -1
- data/reference/WinUtility_8hpp.html +1 -1
- data/reference/Window_8hpp-source.html +67 -56
- data/reference/Window_8hpp.html +1 -1
- data/reference/annotated.html +1 -1
- data/reference/classGosu_1_1Audio-members.html +1 -1
- data/reference/classGosu_1_1Audio.html +1 -1
- data/reference/classGosu_1_1Bitmap-members.html +1 -1
- data/reference/classGosu_1_1Bitmap.html +1 -1
- data/reference/classGosu_1_1Buffer-members.html +1 -1
- data/reference/classGosu_1_1Buffer.html +1 -1
- data/reference/classGosu_1_1Button-members.html +1 -1
- data/reference/classGosu_1_1Button.html +1 -1
- data/reference/classGosu_1_1Color-members.html +1 -1
- data/reference/classGosu_1_1Color.html +1 -1
- data/reference/classGosu_1_1File-members.html +1 -1
- data/reference/classGosu_1_1File.html +1 -1
- data/reference/classGosu_1_1Font-members.html +1 -1
- data/reference/classGosu_1_1Font.html +1 -1
- data/reference/classGosu_1_1Graphics-members.html +1 -1
- data/reference/classGosu_1_1Graphics.html +1 -1
- data/reference/classGosu_1_1Image-members.html +1 -1
- data/reference/classGosu_1_1Image.html +1 -1
- data/reference/classGosu_1_1ImageData-members.html +1 -1
- data/reference/classGosu_1_1ImageData.html +1 -1
- data/reference/classGosu_1_1Input-members.html +2 -1
- data/reference/classGosu_1_1Input.html +34 -1
- data/reference/classGosu_1_1MessageSocket-members.html +1 -1
- data/reference/classGosu_1_1MessageSocket.html +1 -1
- data/reference/classGosu_1_1Resource-members.html +1 -1
- data/reference/classGosu_1_1Resource.html +1 -1
- data/reference/classGosu_1_1Sample-members.html +3 -3
- data/reference/classGosu_1_1Sample.html +23 -11
- data/reference/classGosu_1_1SampleInstance-members.html +4 -1
- data/reference/classGosu_1_1SampleInstance.html +11 -2
- data/reference/classGosu_1_1Song-members.html +5 -2
- data/reference/classGosu_1_1Song.html +78 -7
- data/reference/classGosu_1_1TextInput-members.html +1 -1
- data/reference/classGosu_1_1TextInput.html +1 -1
- data/reference/classGosu_1_1Window-members.html +1 -1
- data/reference/classGosu_1_1Window.html +1 -1
- data/reference/files.html +1 -1
- data/reference/functions.html +14 -6
- data/reference/functions_enum.html +1 -1
- data/reference/functions_func.html +14 -6
- data/reference/functions_vars.html +1 -1
- data/reference/hierarchy.html +1 -1
- data/reference/index.html +1 -1
- data/reference/namespaceGosu.html +20 -1
- data/reference/namespaceGosu_1_1Colors.html +1 -1
- data/reference/namespaceGosu_1_1Win.html +1 -1
- data/reference/namespacemembers.html +3 -1
- data/reference/namespacemembers_enum.html +1 -1
- data/reference/namespacemembers_eval.html +1 -1
- data/reference/namespacemembers_func.html +1 -1
- data/reference/namespacemembers_type.html +1 -1
- data/reference/namespacemembers_vars.html +3 -1
- data/reference/namespaces.html +1 -1
- data/windows/Gosu.sln +2 -2
- data/windows/Gosu.vcproj +8 -7
- data/windows/RubyGosu.vcproj +5 -5
- metadata +4 -3
- data/GosuImpl/Utility.cpp~RF6c566.TMP +0 -95
@@ -216,11 +216,13 @@ Here is a list of all documented namespace members with links to the namespaces
|
|
216
216
|
: <a class="el" href="namespaceGosu.html#b6bc6e428b84b2e2ac39133c64b4567e">Gosu</a>
|
217
217
|
</ul>
|
218
218
|
<h3><a class="anchor" name="index_z">- z -</a></h3><ul>
|
219
|
+
<li>zImmediate
|
220
|
+
: <a class="el" href="namespaceGosu.html#66e372da7f9b1ce440cc35da4b16b027">Gosu</a>
|
219
221
|
<li>ZPos
|
220
222
|
: <a class="el" href="namespaceGosu.html#a2fd8fe9574c0ad3fd52557cb160be49">Gosu</a>
|
221
223
|
</ul>
|
222
224
|
</div>
|
223
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
225
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:54 2009 for Gosu by
|
224
226
|
<a href="http://www.doxygen.org/index.html">
|
225
227
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
226
228
|
</body>
|
@@ -45,7 +45,7 @@
|
|
45
45
|
: <a class="el" href="namespaceGosu.html#f3bd16cebaf102e43f576d0a0ca1fcc3">Gosu</a>
|
46
46
|
</ul>
|
47
47
|
</div>
|
48
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
48
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:54 2009 for Gosu by
|
49
49
|
<a href="http://www.doxygen.org/index.html">
|
50
50
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
51
51
|
</body>
|
@@ -47,7 +47,7 @@
|
|
47
47
|
: <a class="el" href="namespaceGosu.html#f3bd16cebaf102e43f576d0a0ca1fcc337d6ddaeba2138192b0ae84e0882a246">Gosu</a>
|
48
48
|
</ul>
|
49
49
|
</div>
|
50
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
50
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:54 2009 for Gosu by
|
51
51
|
<a href="http://www.doxygen.org/index.html">
|
52
52
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
53
53
|
</body>
|
@@ -189,7 +189,7 @@
|
|
189
189
|
: <a class="el" href="namespaceGosu.html#b6bc6e428b84b2e2ac39133c64b4567e">Gosu</a>
|
190
190
|
</ul>
|
191
191
|
</div>
|
192
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
192
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:54 2009 for Gosu by
|
193
193
|
<a href="http://www.doxygen.org/index.html">
|
194
194
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
195
195
|
</body>
|
@@ -39,7 +39,7 @@
|
|
39
39
|
: <a class="el" href="namespaceGosu.html#a2fd8fe9574c0ad3fd52557cb160be49">Gosu</a>
|
40
40
|
</ul>
|
41
41
|
</div>
|
42
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
42
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:54 2009 for Gosu by
|
43
43
|
<a href="http://www.doxygen.org/index.html">
|
44
44
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
45
45
|
</body>
|
@@ -37,9 +37,11 @@
|
|
37
37
|
<ul>
|
38
38
|
<li>pi
|
39
39
|
: <a class="el" href="namespaceGosu.html#cc7336a0eba36412dab0e991fb3faf01">Gosu</a>
|
40
|
+
<li>zImmediate
|
41
|
+
: <a class="el" href="namespaceGosu.html#66e372da7f9b1ce440cc35da4b16b027">Gosu</a>
|
40
42
|
</ul>
|
41
43
|
</div>
|
42
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
44
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:54 2009 for Gosu by
|
43
45
|
<a href="http://www.doxygen.org/index.html">
|
44
46
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
45
47
|
</body>
|
data/reference/namespaces.html
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
<tr><td class="indexkey"><a class="el" href="namespaceGosu_1_1Win.html">Gosu::Win</a></td><td class="indexvalue">Implementation helpers for the Windows platform </td></tr>
|
29
29
|
</table>
|
30
30
|
</div>
|
31
|
-
<hr size="1"><address style="text-align: right;"><small>Generated on Sat
|
31
|
+
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Feb 7 22:34:53 2009 for Gosu by
|
32
32
|
<a href="http://www.doxygen.org/index.html">
|
33
33
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
|
34
34
|
</body>
|
data/windows/Gosu.sln
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
|
-
Microsoft Visual Studio Solution File, Format Version
|
3
|
-
# Visual Studio
|
2
|
+
Microsoft Visual Studio Solution File, Format Version 10.00
|
3
|
+
# Visual Studio 2008
|
4
4
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gosu", "Gosu.vcproj", "{4989339B-019C-4399-86F5-1D9245C420C6}"
|
5
5
|
EndProject
|
6
6
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RubyGosu", "RubyGosu.vcproj", "{1A89DFFB-65C3-4FE2-89A9-18D718A8822C}"
|
data/windows/Gosu.vcproj
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
<?xml version="1.0" encoding="Windows-1252"?>
|
2
2
|
<VisualStudioProject
|
3
3
|
ProjectType="Visual C++"
|
4
|
-
Version="
|
4
|
+
Version="9,00"
|
5
5
|
Name="Gosu"
|
6
6
|
ProjectGUID="{4989339B-019C-4399-86F5-1D9245C420C6}"
|
7
7
|
RootNamespace="Gosu"
|
8
8
|
Keyword="Win32Proj"
|
9
|
+
TargetFrameworkVersion="131072"
|
9
10
|
>
|
10
11
|
<Platforms>
|
11
12
|
<Platform
|
@@ -47,9 +48,8 @@
|
|
47
48
|
RuntimeLibrary="1"
|
48
49
|
UsePrecompiledHeader="0"
|
49
50
|
WarningLevel="3"
|
50
|
-
Detect64BitPortabilityProblems="true"
|
51
51
|
DebugInformationFormat="1"
|
52
|
-
DisableSpecificWarnings="4996"
|
52
|
+
DisableSpecificWarnings="4996;4244"
|
53
53
|
/>
|
54
54
|
<Tool
|
55
55
|
Name="VCManagedResourceCompilerTool"
|
@@ -62,7 +62,7 @@
|
|
62
62
|
/>
|
63
63
|
<Tool
|
64
64
|
Name="VCLibrarianTool"
|
65
|
-
AdditionalDependencies="fmodvc.lib opengl32.lib dinput8.lib winmm.lib dxguid.lib delayimp.lib"
|
65
|
+
AdditionalDependencies="fmodvc.lib opengl32.lib dinput8.lib winmm.lib dxguid.lib ws2_32.lib delayimp.lib"
|
66
66
|
OutputFile="$(OutDir)\$(ProjectName)Debug.lib"
|
67
67
|
/>
|
68
68
|
<Tool
|
@@ -107,16 +107,17 @@
|
|
107
107
|
<Tool
|
108
108
|
Name="VCCLCompilerTool"
|
109
109
|
AdditionalOptions="/I"zlib, libpng\zlib" /I"zlib, libpng\libpng""
|
110
|
+
Optimization="3"
|
110
111
|
EnableIntrinsicFunctions="true"
|
111
112
|
FavorSizeOrSpeed="1"
|
112
113
|
WholeProgramOptimization="false"
|
113
114
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
114
115
|
RuntimeLibrary="0"
|
116
|
+
FloatingPointModel="2"
|
115
117
|
UsePrecompiledHeader="0"
|
116
118
|
WarningLevel="3"
|
117
|
-
Detect64BitPortabilityProblems="true"
|
118
119
|
DebugInformationFormat="1"
|
119
|
-
DisableSpecificWarnings="4996"
|
120
|
+
DisableSpecificWarnings="4996;4244"
|
120
121
|
/>
|
121
122
|
<Tool
|
122
123
|
Name="VCManagedResourceCompilerTool"
|
@@ -129,7 +130,7 @@
|
|
129
130
|
/>
|
130
131
|
<Tool
|
131
132
|
Name="VCLibrarianTool"
|
132
|
-
AdditionalDependencies="fmodvc.lib opengl32.lib dinput8.lib winmm.lib dxguid.lib delayimp.lib"
|
133
|
+
AdditionalDependencies="fmodvc.lib opengl32.lib dinput8.lib winmm.lib dxguid.lib ws2_32.lib delayimp.lib"
|
133
134
|
/>
|
134
135
|
<Tool
|
135
136
|
Name="VCALinkTool"
|
data/windows/RubyGosu.vcproj
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
<?xml version="1.0" encoding="Windows-1252"?>
|
2
2
|
<VisualStudioProject
|
3
3
|
ProjectType="Visual C++"
|
4
|
-
Version="
|
4
|
+
Version="9,00"
|
5
5
|
Name="RubyGosu"
|
6
6
|
ProjectGUID="{1A89DFFB-65C3-4FE2-89A9-18D718A8822C}"
|
7
7
|
RootNamespace="RubyGosu"
|
8
8
|
Keyword="Win32Proj"
|
9
|
+
TargetFrameworkVersion="131072"
|
9
10
|
>
|
10
11
|
<Platforms>
|
11
12
|
<Platform
|
@@ -44,8 +45,8 @@
|
|
44
45
|
RuntimeLibrary="0"
|
45
46
|
UsePrecompiledHeader="0"
|
46
47
|
WarningLevel="3"
|
47
|
-
Detect64BitPortabilityProblems="true"
|
48
48
|
DebugInformationFormat="3"
|
49
|
+
DisableSpecificWarnings="4996;4244"
|
49
50
|
/>
|
50
51
|
<Tool
|
51
52
|
Name="VCManagedResourceCompilerTool"
|
@@ -67,6 +68,8 @@
|
|
67
68
|
SubSystem="2"
|
68
69
|
OptimizeReferences="2"
|
69
70
|
EnableCOMDATFolding="2"
|
71
|
+
RandomizedBaseAddress="1"
|
72
|
+
DataExecutionPrevention="0"
|
70
73
|
ImportLibrary="$(ConfigurationName)\Unused.lib"
|
71
74
|
TargetMachine="1"
|
72
75
|
/>
|
@@ -88,9 +91,6 @@
|
|
88
91
|
<Tool
|
89
92
|
Name="VCAppVerifierTool"
|
90
93
|
/>
|
91
|
-
<Tool
|
92
|
-
Name="VCWebDeploymentTool"
|
93
|
-
/>
|
94
94
|
<Tool
|
95
95
|
Name="VCPostBuildEventTool"
|
96
96
|
/>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Raschke
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2009-02-07 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -252,7 +252,6 @@ files:
|
|
252
252
|
- GosuImpl/TimingUnix.cpp
|
253
253
|
- GosuImpl/TimingWin.cpp
|
254
254
|
- GosuImpl/Utility.cpp
|
255
|
-
- GosuImpl/Utility.cpp~RF6c566.TMP
|
256
255
|
- GosuImpl/WindowMac.mm
|
257
256
|
- GosuImpl/WindowWin.cpp
|
258
257
|
- GosuImpl/WindowX.cpp
|
@@ -265,6 +264,7 @@ files:
|
|
265
264
|
- mac/Gosu.xcodeproj/jlnr.mode1v3
|
266
265
|
- mac/Gosu.xcodeproj/jlnr.mode2v3
|
267
266
|
- mac/Gosu.xcodeproj/jlnr.pbxuser
|
267
|
+
- mac/Gosu.xcodeproj/jlnr.perspectivev3
|
268
268
|
- mac/Gosu.xcodeproj/project.pbxproj
|
269
269
|
- mac/libboost_thread_1_34_1_universal.a
|
270
270
|
- mac/libboost_thread_d_1_34_1_universal.a
|
@@ -274,6 +274,7 @@ files:
|
|
274
274
|
- mac/English.lproj/InfoPlist.strings
|
275
275
|
- mac/Gosu-Info.plist
|
276
276
|
- mac/RubyGosu Template-Info.plist
|
277
|
+
- mac/Gosu.icns
|
277
278
|
- windows/Gosu.sln
|
278
279
|
- windows/Gosu.vcproj
|
279
280
|
- windows/RubyGosu.vcproj
|
@@ -1,95 +0,0 @@
|
|
1
|
-
#include <Gosu/Utility.hpp>
|
2
|
-
#include <Gosu/Platform.hpp>
|
3
|
-
#include <cstddef>
|
4
|
-
#include <cstdlib>
|
5
|
-
#include <stdexcept>
|
6
|
-
#include <algorithm>
|
7
|
-
#include <vector>
|
8
|
-
#include <GosuImpl/Iconv.hpp>
|
9
|
-
using namespace std;
|
10
|
-
|
11
|
-
#ifndef GOSU_IS_WIN
|
12
|
-
namespace {
|
13
|
-
extern const char UTF_8[] = "UTF-8";
|
14
|
-
#ifdef __BIG_ENDIAN__
|
15
|
-
extern const char UCS_4_INTERNAL[] = "UCS-4BE";
|
16
|
-
#else
|
17
|
-
extern const char UCS_4_INTERNAL[] = "UCS-4LE";
|
18
|
-
#endif
|
19
|
-
}
|
20
|
-
|
21
|
-
wstring Gosu::utf8ToWstring(const string& s)
|
22
|
-
{
|
23
|
-
return iconvert<wstring, UCS_4_INTERNAL, UTF_8>(s);
|
24
|
-
}
|
25
|
-
string Gosu::wstringToUTF8(const std::wstring& ws)
|
26
|
-
{
|
27
|
-
return iconvert<string, UTF_8, UCS_4_INTERNAL>(ws);
|
28
|
-
}
|
29
|
-
|
30
|
-
#ifdef GOSU_IS_MAC
|
31
|
-
// This is only necessary on OS X (for text output)
|
32
|
-
// TODO: Move to respective files now that iconvert<> has been extracted
|
33
|
-
// from this file.
|
34
|
-
|
35
|
-
namespace {
|
36
|
-
extern const char MACROMAN[] = "MacRoman";
|
37
|
-
extern const char UCS_2_INTERNAL[] = "UCS-2-INTERNAL";
|
38
|
-
}
|
39
|
-
|
40
|
-
namespace Gosu {
|
41
|
-
wstring macRomanToWstring(const string& s)
|
42
|
-
{
|
43
|
-
return iconvert<wstring, UCS_4_INTERNAL, MACROMAN>(s);
|
44
|
-
}
|
45
|
-
vector<unsigned short> wstringToUniChars(const wstring& ws)
|
46
|
-
{
|
47
|
-
return iconvert<vector<unsigned short>, UCS_2_INTERNAL, UCS_4_INTERNAL>(ws);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
#endif
|
52
|
-
#else
|
53
|
-
#include <windows.h>
|
54
|
-
wstring Gosu::utf8ToWstring(const string& utf8)
|
55
|
-
{
|
56
|
-
vector<wchar_t> buffer(utf8.size() + 1);
|
57
|
-
MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), utf8.size() + 1, &buffer[0], buffer.size());
|
58
|
-
return &buffer[0];
|
59
|
-
}
|
60
|
-
string Gosu::wstringToUTF8(const wstring& ws)
|
61
|
-
{
|
62
|
-
unsigned size = WideCharToMultiByte(CP_UTF8, 0, ws.c_str(), ws.size(), 0, 0, 0, 0);
|
63
|
-
vector<char> buffer(size + 1);
|
64
|
-
WideCharToMultiByte(CP_UTF8, 0, ws.c_str(), ws.size(), &buffer[0], buffer.size(), 0, 0);
|
65
|
-
return &buffer[0];
|
66
|
-
}
|
67
|
-
#endif
|
68
|
-
|
69
|
-
wstring Gosu::widen(const string& s)
|
70
|
-
{
|
71
|
-
#ifdef GOSU_IS_X
|
72
|
-
setlocale(LC_ALL, "");
|
73
|
-
#endif
|
74
|
-
|
75
|
-
size_t wideLen = std::mbstowcs(0, s.c_str(), 0);
|
76
|
-
if (wideLen == static_cast<size_t>(-1))
|
77
|
-
throw std::runtime_error("Could not convert from string to wstring: " + s);
|
78
|
-
|
79
|
-
vector<wchar_t> buf(wideLen + 1);
|
80
|
-
mbstowcs(&buf.front(), s.c_str(), buf.size());
|
81
|
-
|
82
|
-
return wstring(buf.begin(), buf.end() - 1);
|
83
|
-
}
|
84
|
-
|
85
|
-
string Gosu::narrow(const wstring& ws)
|
86
|
-
{
|
87
|
-
size_t narrowLen = std::wcstombs(0, ws.c_str(), 0);
|
88
|
-
if (narrowLen == static_cast<size_t>(-1))
|
89
|
-
throw std::runtime_error("Could not convert from wstring to string: " + string(ws.begin(), ws.end()));
|
90
|
-
|
91
|
-
vector<char> buf(narrowLen + 1);
|
92
|
-
wcstombs(&buf.front(), ws.c_str(), buf.size());
|
93
|
-
|
94
|
-
return string(buf.begin(), buf.end() - 1);
|
95
|
-
}
|