Results 1 to 10 of 42

Thread: SvPascal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #29
    simvector
    Guest
    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.
    Last edited by simvector; 16-07-2011 at 08:07 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •