Changeset 63 for trunk/Forms
- Timestamp:
- Nov 26, 2020, 1:18:19 PM (4 years ago)
- Location:
- trunk/Forms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r62 r63 8 8 ClientWidth = 1276 9 9 DesignTimePPI = 144 10 OnActivate = FormActivate 11 OnClose = FormClose 10 12 OnCreate = FormCreate 11 13 OnDestroy = FormDestroy 12 14 OnKeyPress = FormKeyPress 15 OnKeyUp = FormKeyUp 13 16 OnShow = FormShow 14 17 LCLVersion = '2.0.10.0' 15 WindowState = wsMaximized16 18 object PaintBox1: TPaintBox 17 19 Left = 0 … … 57 59 Top = 460 58 60 end 61 object PersistentForm1: TPersistentForm 62 MinVisiblePart = 50 63 EntireVisible = False 64 Left = 488 65 Top = 536 66 end 59 67 end -
trunk/Forms/UFormMain.pas
r62 r63 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, 9 ExtCtrls, UEngine, LCLType, types, UTranslator, UApplicationInfo, URegistry; 9 ExtCtrls, UEngine, LCLType, types, UTranslator, UApplicationInfo, URegistry, 10 UPersistentForm; 10 11 11 12 type … … 16 17 ApplicationInfo1: TApplicationInfo; 17 18 PaintBox1: TPaintBox; 19 PersistentForm1: TPersistentForm; 18 20 Timer1: TTimer; 19 21 Translator1: TTranslator; 22 procedure FormActivate(Sender: TObject); 23 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 20 24 procedure FormCreate(Sender: TObject); 21 25 procedure FormDestroy(Sender: TObject); 22 26 procedure FormKeyPress(Sender: TObject; var Key: char); 27 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 23 28 procedure FormShow(Sender: TObject); 24 29 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; … … 36 41 procedure Timer1Timer(Sender: TObject); 37 42 private 43 Initialized: Boolean; 38 44 procedure LoadConfig; 39 45 procedure SaveConfig; 40 46 public 47 FullScreen: Boolean; 41 48 Engine: TEngine; 42 49 procedure EraseBackground(DC: HDC); override; … … 45 52 var 46 53 FormMain: TFormMain; 54 47 55 48 56 implementation … … 63 71 end; 64 72 73 procedure TFormMain.FormActivate(Sender: TObject); 74 begin 75 if not Initialized then begin 76 Initialized := True; 77 end; 78 end; 79 80 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 81 begin 82 PersistentForm1.Save(Self); 83 end; 84 65 85 procedure TFormMain.FormDestroy(Sender: TObject); 66 86 begin … … 71 91 procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char); 72 92 begin 73 if (Key = #32)then begin93 if Key = #32 then begin 74 94 if Engine.State = gsRunning then Engine.State := gsPaused 75 95 else if Engine.State = gsPaused then Engine.State := gsRunning; … … 77 97 end; 78 98 99 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState 100 ); 101 const 102 KeyF11 = 122; 103 begin 104 if Key = KeyF11 then begin 105 FormMain.FullScreen := not FormMain.FullScreen; 106 FormMain.PersistentForm1.SetFullScreen(FormMain.FullScreen); 107 end; 108 end; 109 79 110 procedure TFormMain.FormShow(Sender: TObject); 80 111 begin 112 PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext; 113 PersistentForm1.Load(Self, False, True); 81 114 Randomize; 82 115 Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture);
Note:
See TracChangeset
for help on using the changeset viewer.