Changeset 14 for trunk/UMainForm.pas


Ignore:
Timestamp:
Mar 22, 2011, 6:35:54 PM (14 years ago)
Author:
george
Message:
  • Fixed: If application focus is lost clear all pressed keys.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UMainForm.pas

    r13 r14  
    11unit UMainForm;
    22
    3 {$mode objfpc}{$H+}
     3{$mode Delphi}{$H+}
    44
    55interface
     
    3535    procedure AShowMapExecute(Sender: TObject);
    3636    procedure FormCreate(Sender: TObject);
     37    procedure FormDeactivate(Sender: TObject);
    3738    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    3839    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     
    9091procedure TMainForm.FormCreate(Sender: TObject);
    9192begin
     93  Application.OnDeactivate := FormDeactivate;
    9294  Randomize;
    9395  DoubleBuffered := True;
     
    126128  Engine.NewGame;
    127129  Image1Resize(Self);
     130end;
     131
     132procedure TMainForm.FormDeactivate(Sender: TObject);
     133begin
     134  Engine.KeyBoard.ClearAll;
    128135end;
    129136
     
    173180  Shift: TShiftState);
    174181begin
    175   Engine.KeyState[Key] := True;
     182  Engine.KeyBoard.KeyState[Key] := True;
    176183  StatusBar1.Panels[0].Text := IntToStr(Key);
    177184end;
     
    180187  );
    181188begin
    182   Engine.KeyState[Key] := False;
     189  Engine.KeyBoard.KeyState[Key] := False;
    183190end;
    184191
Note: See TracChangeset for help on using the changeset viewer.