diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 8a599fd7a3a9a0c99c05245216c0f1882937dec6..a76a1801f560969bd0ab491f9dca790cc7565c3f 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
var
g_GUIWindows: array of TGUIWindow;
g_ActiveWindow: TGUIWindow = nil;
var
g_GUIWindows: array of TGUIWindow;
g_ActiveWindow: TGUIWindow = nil;
+ g_GUIGrabInput: Boolean = False;
procedure g_GUI_Init();
function g_GUI_AddWindow(Window: TGUIWindow): TGUIWindow;
procedure g_GUI_Init();
function g_GUI_AddWindow(Window: TGUIWindow): TGUIWindow;
var
i: Integer;
ID: DWORD;
var
i: Integer;
ID: DWORD;
+ tw, th: Word;
begin
begin
- if FBackTexture <> '' then
+ if FBackTexture <> '' then // Here goes code duplication from g_game.pas:DrawMenuBackground()
if g_Texture_Get(FBackTexture, ID) then
if g_Texture_Get(FBackTexture, ID) then
- e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
+ begin
+ e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ e_GetTextureSize(ID, @tw, @th);
+ if tw = th then
+ tw := round(tw * 1.333 * (gScreenHeight / th))
+ else
+ tw := trunc(tw * (gScreenHeight / th));
+ e_DrawSize(ID, (gScreenWidth - tw) div 2, 0, 0, False, False, tw, gScreenHeight);
+ end
else
e_Clear(GL_COLOR_BUFFER_BIT, 0.5, 0.5, 0.5);
else
e_Clear(GL_COLOR_BUFFER_BIT, 0.5, 0.5, 0.5);
if Msg.Msg = WM_KEYDOWN then
begin
case Msg.wParam of
if Msg.Msg = WM_KEYDOWN then
begin
case Msg.wParam of
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ VK_ESCAPE:
begin
g_GUI_HideWindow;
Exit
begin
g_GUI_HideWindow;
Exit
end;
end;
end;
end;
- g_Touch_ShowKeyboard(FWindow.FActiveControl = Self);
+ g_GUIGrabInput := (@FOnEnterEvent = nil) and (FWindow.FActiveControl = Self);
+ g_Touch_ShowKeyboard(g_GUIGrabInput)
end;
procedure TGUIEdit.SetText(Text: string);
end;
procedure TGUIEdit.SetText(Text: string);
case Msg of
WM_KEYDOWN:
case wParam of
case Msg of
WM_KEYDOWN:
case wParam of
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ VK_ESCAPE:
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
FIsQuery := True;
end
FIsQuery := True;
end
- else
+ else if (wParam < VK_FIRSTKEY) and (wParam > VK_LASTKEY) then
begin
begin
- FKey := IK_ENTER; // <Enter>
+ // FKey := IK_ENTER; // <Enter>
+ FKey := wParam;
FIsQuery := False;
actDefCtl();
end;
FIsQuery := False;
actDefCtl();
end;
else if FIsQuery then
begin
case wParam of
else if FIsQuery then
begin
case wParam of
- IK_ENTER, IK_KPRETURN, VK_FIRE, VK_OPEN, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
+ IK_ENTER, IK_KPRETURN, VK_FIRSTKEY..VK_LASTKEY, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
else
if e_KeyNames[wParam] <> '' then
FKey := wParam;
else
if e_KeyNames[wParam] <> '' then
FKey := wParam;
end;
end;
end;
end;
end;
end;
+
+ g_GUIGrabInput := FIsQuery
end;
{ TGUIKeyRead2 }
end;
{ TGUIKeyRead2 }
case Msg of
WM_KEYDOWN:
case wParam of
case Msg of
WM_KEYDOWN:
case wParam of
- IK_ESCAPE, VK_ESCAPE, JOY0_JUMP, JOY1_JUMP, JOY2_JUMP, JOY3_JUMP:
+ VK_ESCAPE:
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
begin
if FIsQuery then actDefCtl();
FIsQuery := False;
FIsQuery := True;
end
FIsQuery := True;
end
- else
+ else if (wParam < VK_FIRSTKEY) and (wParam > VK_LASTKEY) then
begin
begin
- if (FKeyIdx = 0) then FKey0 := IK_ENTER else FKey1 := IK_ENTER; // <Enter>
+ // if (FKeyIdx = 0) then FKey0 := IK_ENTER else FKey1 := IK_ENTER; // <Enter>
+ if (FKeyIdx = 0) then FKey0 := wParam else FKey1 := wParam;
FIsQuery := False;
actDefCtl();
end;
FIsQuery := False;
actDefCtl();
end;
else if FIsQuery then
begin
case wParam of
else if FIsQuery then
begin
case wParam of
- IK_ENTER, IK_KPRETURN, VK_FIRE, VK_OPEN,
- JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
+ IK_ENTER, IK_KPRETURN, VK_FIRSTKEY..VK_LASTKEY, JOY0_ATTACK, JOY1_ATTACK, JOY2_ATTACK, JOY3_ATTACK: // Not <Enter
else
if e_KeyNames[wParam] <> '' then
begin
else
if e_KeyNames[wParam] <> '' then
begin
end;
end;
end;
end;
end;
end;
+
+ g_GUIGrabInput := FIsQuery
end;
end;
procedure TGUIFileListBox.OnMessage(var Msg: TMessage);
var
procedure TGUIFileListBox.OnMessage(var Msg: TMessage);
var
- a: Integer;
+ a, b: Integer;
begin
if not FEnabled then
Exit;
begin
if not FEnabled then
Exit;
end;
WM_CHAR:
end;
WM_CHAR:
- for a := 0 to High(FItems) do
+ for b := FIndex + 1 to High(FItems) + FIndex do
+ begin
+ a := b mod Length(FItems);
if ( (Length(FItems[a]) > 0) and
(LowerCase(FItems[a][1]) = LowerCase(Chr(wParam))) ) or
( (Length(FItems[a]) > 1) and
if ( (Length(FItems[a]) > 0) and
(LowerCase(FItems[a][1]) = LowerCase(Chr(wParam))) ) or
( (Length(FItems[a]) > 1) and
FOnChangeEvent(Self);
Break;
end;
FOnChangeEvent(Self);
Break;
end;
+ end;
end;
end;
end;
end;