Hi,
1) Override TSvPrototypeGame.ProcessTerminate; By default it does this:
Code:
procedure TSvPrototypeGame.ProcessTerminate;
begin
// ESC key terminated by default
if SV.Input.KeyHit(Key_Escape) then
begin
Terminated := True;
end;
end;
2) You can get the KEY_LALT and/or the KEY_RALT keys but pressing ALT by itself will cause the window to loose the input focus. I have the system menu attribute added to the app window (so an icon can display) and I thinking maybe this is what's grabbing the focus. Pressing ALT will usually activate the window's menu.
You can override and capture ALT like what I've done below. I tried to call Win32 SetFocus but it does not seem to work. I will have to look into this. I never use ALT (alway in combination with another key) by itself is why I guess I've never ran into this issue.
Code:
function SetFocus(hWnd: Cardinal): Cardinal; stdcall; external 'User32.dll';
type
TGame = class(TSvPrototypeGame)
public
procedure UpdateInput(aElapsedTime: single); override;
end;
procedure TGame.UpdateInput(aElapsedTime: single);
begin
inherited;
if SV.Input.KeyHit(KEY_LALT) then
begin
Title := 'Jarrod';
SetFocus(SV.DisplayDevice.Handle);
end;
end;
Thanks for reporting.
Bookmarks