Changeset 79
- Timestamp:
- Feb 11, 2021, 11:20:18 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r72 r79 18 18 LCLVersion = '2.0.10.0' 19 19 object MainMenu1: TMainMenu 20 Left = 32 520 Left = 328 21 21 Top = 152 22 22 object MenuItemGame: TMenuItem … … 33 33 object MenuItemExit: TMenuItem 34 34 Action = Core.AExit 35 end 36 end 37 object MenuItem5: TMenuItem 38 Caption = 'View' 39 object MenuItemFullScreen: TMenuItem 40 Caption = 'Full screen' 41 ShortCut = 122 42 OnClick = MenuItemFullScreenClick 35 43 end 36 44 end -
trunk/Forms/UFormMain.lrj
r72 r79 2 2 {"hash":217976,"name":"tformmain.caption","sourcebytes":[50,48,52,56],"value":"2048"}, 3 3 {"hash":317493,"name":"tformmain.menuitemgame.caption","sourcebytes":[71,97,109,101],"value":"Game"}, 4 {"hash":380871,"name":"tformmain.menuitem5.caption","sourcebytes":[86,105,101,119],"value":"View"}, 5 {"hash":131549534,"name":"tformmain.menuitemfullscreen.caption","sourcebytes":[70,117,108,108,32,115,99,114,101,101,110],"value":"Full screen"}, 4 6 {"hash":5989939,"name":"tformmain.menuitemtools.caption","sourcebytes":[84,111,111,108,115],"value":"Tools"}, 5 7 {"hash":322608,"name":"tformmain.menuitemhelp.caption","sourcebytes":[72,101,108,112],"value":"Help"} -
trunk/Forms/UFormMain.pas
r72 r79 28 28 MenuItem3: TMenuItem; 29 29 MenuItem4: TMenuItem; 30 MenuItem5: TMenuItem; 31 MenuItemFullScreen: TMenuItem; 30 32 MenuItemMovesHistory: TMenuItem; 31 33 MenuItemTools: TMenuItem; … … 47 49 procedure FormPaint(Sender: TObject); 48 50 procedure FormShow(Sender: TObject); 51 procedure MenuItemFullScreenClick(Sender: TObject); 49 52 procedure TimerDrawTimer(Sender: TObject); 50 53 procedure EraseBackground(DC: HDC); override; … … 56 59 MoveBuffer: array of TMoveDirection; 57 60 MoveBufferLock: TCriticalSection; 61 FullScreen: Boolean; 58 62 procedure AddToMoveBuffer(Direction: TMoveDirection); 59 63 procedure ProcessMoveBuffer; 64 procedure ToggleFullscreen; 60 65 public 61 66 MoveThread: TMoveThread; … … 87 92 88 93 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 94 const 95 KeyLeft = 37; 96 KeyUp = 38; 97 KeyRight = 39; 98 KeyDown = 40; 89 99 begin 90 100 if Core.Game.Running then begin 91 101 case Key of 92 37: AddToMoveBuffer(drLeft);93 38: AddToMoveBuffer(drUp);94 39: AddToMoveBuffer(drRight);95 40: AddToMoveBuffer(drDown);102 KeyLeft: AddToMoveBuffer(drLeft); 103 KeyUp: AddToMoveBuffer(drUp); 104 KeyRight: AddToMoveBuffer(drRight); 105 KeyDown: AddToMoveBuffer(drDown); 96 106 end; 97 107 //ProcessMoveBuffer; … … 184 194 Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext; 185 195 Core.PersistentForm1.Load(Self); 196 FullScreen := Core.PersistentForm1.FormFullScreen; 186 197 Core.ThemeManager1.UseTheme(Self); 187 198 UpdateInterface; … … 189 200 InitialTileCount then 190 201 Core.Game.New; 202 end; 203 204 procedure TFormMain.MenuItemFullScreenClick(Sender: TObject); 205 begin 206 ToggleFullscreen; 191 207 end; 192 208 … … 235 251 end; 236 252 253 procedure TFormMain.ToggleFullscreen; 254 begin 255 FullScreen := not FullScreen; 256 Core.PersistentForm1.SetFullScreen(FormMain.FullScreen); 257 UpdateInterface; 258 end; 259 237 260 procedure TFormMain.Redraw; 238 261 begin … … 245 268 ToolsVisible: Boolean; 246 269 begin 270 MenuItemFullScreen.Checked := FullScreen; 247 271 MenuItemMovesHistory.Visible := Core.Game.RecordHistory; 248 272 ToolsVisible := False; -
trunk/Forms/UFormNew.lfm
r49 r79 11 11 OnCreate = FormCreate 12 12 OnShow = FormShow 13 LCLVersion = '2.0. 2.0'13 LCLVersion = '2.0.10.0' 14 14 object Label1: TLabel 15 15 Left = 16 16 Height = 2 616 Height = 24 17 17 Top = 16 18 18 Width = 93 … … 74 74 Height = 30 75 75 Top = 88 76 Width = 2 1076 Width = 209 77 77 Caption = 'Record moves history' 78 78 TabOrder = 4 … … 80 80 object Label2: TLabel 81 81 Left = 16 82 Height = 2 682 Height = 24 83 83 Top = 125 84 84 Width = 75 … … 88 88 object ComboBoxSkin: TComboBox 89 89 Left = 173 90 Height = 3 890 Height = 37 91 91 Top = 120 92 92 Width = 262 -
trunk/Languages/Game2048.cs.po
r70 r79 5 5 "POT-Creation-Date: \n" 6 6 "PO-Revision-Date: \n" 7 "Last-Translator: \n"7 "Last-Translator: Chronos <robie@centrum.cz>\n" 8 8 "Language-Team: \n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 11 "Language: cs\n" 12 "X-Generator: Poedit 2. 2.4\n"12 "X-Generator: Poedit 2.4.1\n" 13 13 14 14 #: tcore.aabout.caption … … 103 103 msgstr "2048" 104 104 105 #: tformmain.menuitem5.caption 106 msgid "View" 107 msgstr "Zobrazení" 108 109 #: tformmain.menuitemfullscreen.caption 110 msgid "Full screen" 111 msgstr "Celá obrazovka" 112 105 113 #: tformmain.menuitemgame.caption 106 114 msgid "Game" … … 244 252 #: ugame.sskinbinary 245 253 msgid "Binary" 246 msgstr " "254 msgstr "Binární" 247 255 248 256 #: ugame.sskinlinear … … 255 263 256 264 #: ugame.sskinroman 257 #, fuzzy258 #| msgid "Roman numerals"259 265 msgid "Roman" 260 266 msgstr "Římské číslice" … … 267 273 msgid "Top score" 268 274 msgstr "Nejvyšší skóre" 269 -
trunk/Languages/Game2048.po
r70 r79 93 93 msgstr "" 94 94 95 #: tformmain.menuitem5.caption 96 msgid "View" 97 msgstr "" 98 99 #: tformmain.menuitemfullscreen.caption 100 msgid "Full screen" 101 msgstr "" 102 95 103 #: tformmain.menuitemgame.caption 96 104 msgid "Game" -
trunk/Packages/Common/UApplicationInfo.pas
r7 r79 6 6 7 7 uses 8 SysUtils, Classes, Forms, URegistry, Controls ;8 SysUtils, Classes, Forms, URegistry, Controls, Graphics; 9 9 10 10 type … … 15 15 private 16 16 FDescription: TCaption; 17 FIcon: TBitmap; 17 18 FIdentification: Byte; 18 19 FLicense: string; … … 33 34 public 34 35 constructor Create(AOwner: TComponent); override; 36 destructor Destroy; override; 35 37 property Version: string read GetVersion; 36 38 function GetRegistryContext: TRegistryContext; … … 52 54 property RegistryRoot: TRegistryRoot read FRegistryRoot write FRegistryRoot; 53 55 property License: string read FLicense write FLicense; 56 property Icon: TBitmap read FIcon write FIcon; 54 57 end; 55 58 … … 74 77 constructor TApplicationInfo.Create(AOwner: TComponent); 75 78 begin 76 inherited Create(AOwner);79 inherited; 77 80 FVersionMajor := 1; 78 81 FIdentification := 1; … … 80 83 FRegistryKey := '\Software\' + FAppName; 81 84 FRegistryRoot := rrKeyCurrentUser; 85 FIcon := TBitmap.Create; 86 end; 87 88 destructor TApplicationInfo.Destroy; 89 begin 90 FreeAndNil(FIcon); 91 inherited; 82 92 end; 83 93 -
trunk/Packages/Common/UMetaCanvas.pas
r69 r79 6 6 7 7 uses 8 Classes, SysUtils, Graphics, Contnrs, Types ;8 Classes, SysUtils, Graphics, Contnrs, Types, fgl; 9 9 10 10 type … … 17 17 procedure Zoom(Factor: Double); virtual; 18 18 procedure Move(Delta: TPoint); virtual; 19 end; 20 21 TCanvasObjects = class(TFPGObjectList<TCanvasObject>) 19 22 end; 20 23 … … 133 136 procedure DoLineTo(X, Y: Integer); override; 134 137 public 135 Objects: T ObjectList;138 Objects: TCanvasObjects; 136 139 procedure FillRect(const ARect: TRect); overload; override; 137 140 procedure FillRect(X1,Y1,X2,Y2: Integer); overload; … … 145 148 procedure Pie(EllipseX1, EllipseY1, EllipseX2, EllipseY2, 146 149 StartX, StartY, EndX, EndY: Integer); override; 147 procedure SetSize(Size: TPoint);148 150 procedure Reset; 149 151 procedure DrawTo(Canvas: TCanvas); … … 152 154 constructor Create; 153 155 destructor Destroy; override; 154 end; 156 property Size: TPoint read FSize write FSize; 157 end; 158 155 159 156 160 implementation … … 198 202 Pen.Free; 199 203 Brush.Free; 200 inherited Destroy;204 inherited; 201 205 end; 202 206 … … 228 232 destructor TCanvasStretchDraw.Destroy; 229 233 begin 230 inherited Destroy;234 inherited; 231 235 end; 232 236 … … 264 268 Pen.Free; 265 269 Brush.Free; 266 inherited Destroy;270 inherited; 267 271 end; 268 272 … … 304 308 Brush.Free; 305 309 Pen.Free; 306 inherited Destroy;310 inherited; 307 311 end; 308 312 … … 336 340 begin 337 341 Pen.Free; 338 inherited Destroy;342 inherited; 339 343 end; 340 344 … … 375 379 Pen.Free; 376 380 Brush.Free; 377 inherited Destroy;381 inherited; 378 382 end; 379 383 … … 408 412 Brush.Free; 409 413 Font.Free; 410 inherited Destroy;414 inherited; 411 415 end; 412 416 … … 618 622 end; 619 623 620 procedure TMetaCanvas.SetSize(Size: TPoint);621 begin622 FSize := Size;623 end;624 625 624 procedure TMetaCanvas.Reset; 626 625 begin … … 633 632 begin 634 633 for I := 0 to Objects.Count - 1 do 635 TCanvasObject(Objects[I]).Paint(Canvas);634 Objects[I].Paint(Canvas); 636 635 end; 637 636 … … 641 640 begin 642 641 for I := 0 to Objects.Count - 1 do 643 TCanvasObject(Objects[I]).Zoom(Factor);642 Objects[I].Zoom(Factor); 644 643 end; 645 644 … … 649 648 begin 650 649 for I := 0 to Objects.Count - 1 do 651 TCanvasObject(Objects[I]).Move(Delta);650 Objects[I].Move(Delta); 652 651 end; 653 652 … … 656 655 inherited; 657 656 FPenPos := Point(0, 0); 658 Objects := T ObjectList.Create;657 Objects := TCanvasObjects.Create; 659 658 end; 660 659 … … 662 661 begin 663 662 Objects.Free; 664 inherited Destroy;663 inherited; 665 664 end; 666 665 -
trunk/Packages/Common/UPersistentForm.pas
r7 r79 3 3 {$mode delphi} 4 4 5 // Date: 20 15-04-185 // Date: 2020-11-26 6 6 7 7 interface … … 9 9 uses 10 10 Classes, SysUtils, Forms, URegistry, LCLIntf, Registry, Controls, ComCtrls, 11 ExtCtrls ;11 ExtCtrls, LCLType; 12 12 13 13 type … … 26 26 FormRestoredSize: TRect; 27 27 FormWindowState: TWindowState; 28 FormFullScreen: Boolean; 28 29 Form: TForm; 29 30 procedure LoadFromRegistry(RegistryContext: TRegistryContext); … … 31 32 function CheckEntireVisible(Rect: TRect): TRect; 32 33 function CheckPartVisible(Rect: TRect; Part: Integer): TRect; 33 procedure Load(Form: TForm; DefaultMaximized: Boolean = False); 34 procedure Load(Form: TForm; DefaultMaximized: Boolean = False; 35 DefaultFullScreen: Boolean = False); 34 36 procedure Save(Form: TForm); 35 37 constructor Create(AOwner: TComponent); override; 38 procedure SetFullScreen(State: Boolean); 36 39 property RegistryContext: TRegistryContext read FRegistryContext 37 40 write FRegistryContext; … … 43 46 procedure Register; 44 47 48 45 49 implementation 46 47 50 48 51 procedure Register; … … 169 172 + FormRestoredSize.Top; 170 173 // Other state 171 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(wsNormal))); 174 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(FormWindowState))); 175 FormFullScreen := ReadBoolWithDefault('FullScreen', FormFullScreen); 172 176 finally 173 177 Free; … … 193 197 // Other state 194 198 WriteInteger('WindowState', Integer(FormWindowState)); 199 WriteBool('FullScreen', FormFullScreen); 195 200 finally 196 201 Free; … … 250 255 end; 251 256 252 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False); 257 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False; 258 DefaultFullScreen: Boolean = False); 253 259 begin 254 260 Self.Form := Form; … … 258 264 FormRestoredSize := Bounds((Screen.Width - Form.Width) div 2, 259 265 (Screen.Height - Form.Height) div 2, Form.Width, Form.Height); 266 FormWindowState := Form.WindowState; 267 FormFullScreen := DefaultFullScreen; 260 268 261 269 LoadFromRegistry(RegistryContext); … … 277 285 Form.BoundsRect := FormNormalSize; 278 286 end; 287 if FormFullScreen then SetFullScreen(True); 279 288 LoadControl(Form); 280 289 end; … … 284 293 Self.Form := Form; 285 294 FormNormalSize := Bounds(Form.Left, Form.Top, Form.Width, Form.Height); 286 FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth, 287 Form.RestoredHeight); 295 if not FormFullScreen then 296 FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth, 297 Form.RestoredHeight); 288 298 FormWindowState := Form.WindowState; 289 299 SaveToRegistry(RegistryContext); … … 300 310 end; 301 311 312 procedure TPersistentForm.SetFullScreen(State: Boolean); 313 begin 314 if State then begin 315 FormFullScreen := True; 316 FormNormalSize := Form.BoundsRect; 317 FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth, 318 Form.RestoredHeight); 319 FormWindowState := Form.WindowState; 320 ShowWindow(Form.Handle, SW_SHOWFULLSCREEN); 321 {$IFDEF WINDOWS} 322 Form.BorderStyle := bsNone; 323 {$ENDIF} 324 end else begin 325 FormFullScreen := False; 326 {$IFDEF WINDOWS} 327 Form.BorderStyle := bsSizeable; 328 {$ENDIF} 329 ShowWindow(Form.Handle, SW_SHOWNORMAL); 330 if FormWindowState = wsNormal then begin 331 Form.BoundsRect := FormNormalSize; 332 end else 333 if FormWindowState = wsMaximized then begin 334 Form.BoundsRect := FormRestoredSize; 335 Form.WindowState := wsMaximized; 336 end; 337 end; 338 end; 339 302 340 end. 303 341 -
trunk/UGame.pas
r73 r79 623 623 begin 624 624 MetaCanvas := TMetaCanvas.Create; 625 MetaCanvas.S etSize(Point(Canvas.Width, Canvas.Height));625 MetaCanvas.Size := Point(Canvas.Width, Canvas.Height); 626 626 627 627 TopBarHeight := ScaleY(24, 96);
Note:
See TracChangeset
for help on using the changeset viewer.