Changeset 6 for trunk/UMainForm.pas
- Timestamp:
- Mar 6, 2011, 7:31:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMainForm.pas
r4 r6 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 ComCtrls, Menus, UCore;9 ComCtrls, Menus, ActnList, UCore; 10 10 11 11 type … … 14 14 15 15 TMainForm = class(TForm) 16 AShowMap: TAction; 17 ANewGame: TAction; 18 AExit: TAction; 19 AFullScreen: TAction; 20 ActionList1: TActionList; 16 21 Image1: TImage; 17 22 MainMenu1: TMainMenu; … … 19 24 MenuItem2: TMenuItem; 20 25 MenuItem3: TMenuItem; 21 MenuItemShowMap: TMenuItem; 26 MenuItem4: TMenuItem; 27 MenuItem5: TMenuItem; 28 MenuItem6: TMenuItem; 22 29 StatusBar1: TStatusBar; 23 30 TimerDraw: TTimer; 24 31 TimerEngineTick: TTimer; 32 procedure AExitExecute(Sender: TObject); 33 procedure AFullScreenExecute(Sender: TObject); 34 procedure ANewGameExecute(Sender: TObject); 35 procedure AShowMapExecute(Sender: TObject); 25 36 procedure FormCreate(Sender: TObject); 26 37 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); … … 28 39 procedure FormShow(Sender: TObject); 29 40 procedure Image1Resize(Sender: TObject); 30 procedure MenuItem2Click(Sender: TObject);31 procedure MenuItem3Click(Sender: TObject);32 procedure MenuItemShowMapClick(Sender: TObject);33 41 procedure TimerDrawTimer(Sender: TObject); 34 42 procedure TimerEngineTickTimer(Sender: TObject); 35 43 private 44 OriginalBounds: TRect; 45 OriginalWindowState: TWindowState; 46 ScreenBounds: TRect; 36 47 public 37 48 { public declarations } … … 106 117 end; 107 118 119 procedure TMainForm.AFullScreenExecute(Sender: TObject); 120 begin 121 if BorderStyle <> bsNone then begin 122 // To full screen 123 OriginalWindowState := WindowState; 124 OriginalBounds := BoundsRect; 125 126 BorderStyle := bsNone; 127 ScreenBounds := Screen.MonitorFromWindow(Handle).BoundsRect; 128 with ScreenBounds do 129 SetBounds(Left, Top, Right - Left, Bottom - Top) ; 130 end else begin 131 // From full screen 132 {$IFDEF MSWINDOWS} 133 BorderStyle := bsSizeable; 134 {$ENDIF} 135 if OriginalWindowState = wsMaximized then 136 WindowState := wsMaximized 137 else 138 with OriginalBounds do 139 SetBounds(Left, Top, Right - Left, Bottom - Top) ; 140 {$IFDEF LINUX} 141 BorderStyle := bsSizeable; 142 {$ENDIF} 143 end; 144 end; 145 146 procedure TMainForm.ANewGameExecute(Sender: TObject); 147 begin 148 Engine.NewGame; 149 end; 150 151 procedure TMainForm.AShowMapExecute(Sender: TObject); 152 begin 153 MapForm.Show; 154 end; 155 156 procedure TMainForm.AExitExecute(Sender: TObject); 157 begin 158 Close; 159 end; 160 108 161 procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; 109 162 Shift: TShiftState); … … 129 182 end; 130 183 131 procedure TMainForm.MenuItem2Click(Sender: TObject);132 begin133 Close;134 end;135 136 procedure TMainForm.MenuItem3Click(Sender: TObject);137 begin138 Engine.NewGame;139 end;140 141 procedure TMainForm.MenuItemShowMapClick(Sender: TObject);142 begin143 MapForm.Show;144 end;145 146 184 end. 147 185
Note:
See TracChangeset
for help on using the changeset viewer.