From 2e66e4bb6719e92c53bcbf40c82bf5d7644719cb Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 12 Jan 2009 16:55:45 +0000 Subject: CharCode parameter of ParseInput changed from WideChar to UCS4Char (as some chars might reguire two WideChar). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1565 b956fd51-792f-4845-bead-9b4dfca2ff2c --- unicode/src/screens/UScreenOpen.pas | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'unicode/src/screens/UScreenOpen.pas') diff --git a/unicode/src/screens/UScreenOpen.pas b/unicode/src/screens/UScreenOpen.pas index 8c03ba50..ac524f4c 100644 --- a/unicode/src/screens/UScreenOpen.pas +++ b/unicode/src/screens/UScreenOpen.pas @@ -33,8 +33,22 @@ interface {$I switches.inc} -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, - ULyrics, Math, gl, UThemes; +uses + SDL, + SysUtils, + Math, + gl, + UMenu, + UMusic, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + UMenuText, + ULyrics, + UThemes; type TScreenOpen = class(TMenu) @@ -49,25 +63,34 @@ type procedure AddBox(X, Y, W, H: real); constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; // function Draw: boolean; override; // procedure Finish; end; implementation -uses UGraphic, UDraw, UMain, USkins; -function TScreenOpen.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UDraw, + UMain, + USkins, + UUnicodeUtils; + +function TScreenOpen.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys case CharCode of - '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '.', ':', '\': + Ord('0')..Ord('9'), + Ord('a')..Ord('z'), + Ord('A')..Ord('Z'), + Ord(' '), Ord('-'), Ord('.'), Ord(':'), Ord('\'): begin if Interaction = 0 then begin - Text[TextN].Text := Text[TextN].Text + CharCode; + Text[TextN].Text := Text[TextN].Text + UCS4ToUTF8String(CharCode); end; end; end; -- cgit v1.2.3