summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7817765)
raw | patch | inline | side by side (parent: 7817765)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 4 Aug 2017 03:52:28 +0000 (06:52 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 4 Aug 2017 04:26:43 +0000 (07:26 +0300) |
src/game/g_gui.pas | patch | blob | history |
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 48700f74e782969b9b562b2f54250ca4d874e527..fbab591b37059bcbad512a6615e9f4f88067c78d 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
interface
uses
- e_graphics, e_input, g_playermodel, g_basic, MAPSTRUCT, wadreader;
+ e_graphics, e_input, e_log, g_playermodel, g_basic, MAPSTRUCT, wadreader;
const
MAINMENU_HEADER_COLOR: TRGB = (R:255; G:255; B:255);
if FItems[FIndex].Control <> nil then
FItems[FIndex].Control.OnMessage(Msg);
end;
- IK_RETURN, IK_KPRETURN:
+ IK_RETURN, IK_KPRETURN, IK_BACKSPACE:
begin
if FIndex <> -1 then
begin
end;
procedure TGUIKeyRead.OnMessage(var Msg: TMessage);
+ procedure actDefCtl ();
+ begin
+ with FWindow do
+ if FDefControl <> '' then
+ SetActive(GetControl(FDefControl))
+ else
+ SetActive(nil);
+ end;
+
begin
inherited;
case wParam of
IK_ESCAPE:
begin
- if FIsQuery then
- with FWindow do
- if FDefControl <> '' then
- SetActive(GetControl(FDefControl))
- else
- SetActive(nil);
-
+ if FIsQuery then actDefCtl();
FIsQuery := False;
end;
IK_RETURN, IK_KPRETURN:
begin
FKey := IK_ENTER; // <Enter>
FIsQuery := False;
-
- with FWindow do
- if FDefControl <> '' then
- SetActive(GetControl(FDefControl))
- else
- SetActive(nil);
+ actDefCtl();
end;
end;
+ IK_BACKSPACE: // clear keybinding if we aren't waiting for a key
+ begin
+ if not FIsQuery then
+ begin
+ FKey := 0;
+ actDefCtl();
+ end;
+ end;
end;
MESSAGE_DIKEY:
- if FIsQuery and (wParam <> IK_ENTER) and (wParam <> IK_KPRETURN) then // Not <Enter
begin
- if e_KeyNames[wParam] <> '' then
- FKey := wParam;
- FIsQuery := False;
-
- with FWindow do
- if FDefControl <> '' then
- SetActive(GetControl(FDefControl))
- else
- SetActive(nil);
+ if not FIsQuery and (wParam = IK_BACKSPACE) then
+ begin
+ FKey := 0;
+ actDefCtl();
+ end
+ else if FIsQuery and (wParam <> IK_ENTER) and (wParam <> IK_KPRETURN) then // Not <Enter
+ begin
+ e_WriteLog(Format('HIT! %s', ['3']), MSG_WARNING);
+ if e_KeyNames[wParam] <> '' then
+ FKey := wParam;
+ FIsQuery := False;
+ actDefCtl();
+ end;
end;
end;
end;