aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-02 20:52:08 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-02 20:52:08 +0000
commit77927874d012232c7ee8e3cf068d3ca154afc2a9 (patch)
treeaaa503380edab007bd2d217b7399aaa4e19ccea5 /Game
parent4bc171087c21de201bb6ca2e12306e1d01aca11c (diff)
downloadusdx-77927874d012232c7ee8e3cf068d3ca154afc2a9.tar.gz
usdx-77927874d012232c7ee8e3cf068d3ca154afc2a9.tar.xz
usdx-77927874d012232c7ee8e3cf068d3ca154afc2a9.zip
MacOSX patch for WideUpperChar. The cwstring Unicode manager is not supported at the moment because of some problems with the iconv linker dependencies.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1056 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Menu/UMenu.pas34
-rw-r--r--Game/Code/Screens/UScreenSong.pas7
-rw-r--r--Game/Code/UltraStar.dpr8
3 files changed, 38 insertions, 11 deletions
diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas
index eb5c49a0..126fefa1 100644
--- a/Game/Code/Menu/UMenu.pas
+++ b/Game/Code/Menu/UMenu.pas
@@ -47,6 +47,7 @@ type
// interaction
function WideCharUpperCase(wchar: WideChar) : WideString;
+ function WideStringUpperCase(wstring: WideString) : WideString;
procedure AddInteraction(Typ, Num: integer);
procedure SetInteraction(Num: integer);
property Interaction: integer read SelInteraction write SetInteraction;
@@ -1563,16 +1564,39 @@ begin
// nothing
end;
+(*
+ * Wrapper for WideUpperCase. Needed because some plattforms have problems with
+ * unicode support.
+ *)
function TMenu.WideCharUpperCase(wchar: WideChar) : WideString;
begin
// On Linux and MacOSX the cwstring unit is necessary for Unicode function-calls.
// Otherwise you will get an EIntOverflow exception (thrown by unimplementedwidestring()).
+ // The Unicode manager cwstring does not work with MacOSX at the moment because
+ // of missing references to iconv. So we have to use Ansi... for the moment.
- // The FPC implementation of WideUpperCase returns nil if wchar is #0 (e.g. if an arrow key is pressed)
- if (wchar <> #0) then
- Result := WideUpperCase(wchar)
- else
- Result := #0;
+ {$IFNDEF DARWIN}
+ // The FPC implementation of WideUpperCase returns nil if wchar is #0 (e.g. if an arrow key is pressed)
+ if (wchar <> #0) then
+ Result := WideUpperCase(wchar)
+ else
+ Result := #0;
+ {$ELSE}
+ Result := AnsiUpperCase(wchar)
+ {$ENDIF}
+end;
+
+(*
+ * Wrapper for WideUpperCase. Needed because some plattforms have problems with
+ * unicode support.
+ *)
+function TMenu.WideStringUpperCase(wstring: WideString) : WideString;
+begin
+ {$IFNDEF DARWIN}
+ Result := WideUpperCase(wstring)
+ {$ELSE}
+ Result := AnsiUpperCase(wstring);
+ {$ENDIF}
end;
procedure TMenu.onHide;
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index d747f65a..e52b4c98 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -264,7 +264,7 @@ begin
begin
if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND
(Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND
- (WideCharUpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1] = Letter) then
+ (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1] = Letter) then
begin
SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
@@ -285,7 +285,7 @@ begin
begin
if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND
(Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND
- (WideCharUpperCase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1] = Letter) then
+ (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1] = Letter) then
begin
SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
@@ -848,7 +848,8 @@ begin
try
AddButton(300 + Pet*250, 140, 200, 200, '', TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections);
except
- ShowMessage('"No Cover" image is damaged. Ultrastar will exit now.');
+ ShowMessage('"No Cover" image is damaged. Ultrastar will exit now.');
+
Halt;
end;
I := Pet + 1;
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index 9b76c055..b71ae5a1 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -24,9 +24,11 @@ program UltraStar;
uses
{$IFDEF Unix}
- cthreads, // THIS MUST be the first used unit in FPC if Threads are used!!
- // (see http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial)
- cwstring, // Enable Unicode support
+ cthreads, // THIS MUST be the first used unit in FPC if Threads are used!!
+ // (see http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial)
+ {$IFNDEF DARWIN}
+ cwstring, // Enable Unicode support. MacOSX misses some references to iconv.
+ {$ENDIF}
{$ENDIF}
//------------------------------