Changeset 328
- Timestamp:
- Jul 19, 2024, 8:40:00 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.lfm
r317 r328 1315 1315 AppName = 'xTactics' 1316 1316 Description = 'A turn-based strategy game inspired by classic Risk board game. The game is highly configurable to allow to adjust battle field and game rules.' 1317 ReleaseDate = 4 45791318 RegistryKey = '\Software\ xTactics'1317 ReleaseDate = 45468 1318 RegistryKey = '\Software\Chronosoft\xTactics' 1319 1319 RegistryRoot = rrKeyCurrentUser 1320 1320 License = 'CC0' -
trunk/Core.pas
r327 r328 7 7 Game, ApplicationInfo, PersistentForm, ScaleDPI, Translator, DOM, 8 8 RegistryEx, LastOpenedList, Theme, Registry, Menus, FormCharts, FormMain, 9 FormClient, Player, GameServer, GameClient, Generics.Collections,10 ServerList, GameSystem, Graphics,&Unit;9 FormClient, Player, GameServer, GameClient, ServerList, GameSystem, Graphics, 10 &Unit; 11 11 12 12 type … … 486 486 487 487 procedure TCore.DataModuleCreate(Sender: TObject); 488 {$IFDEF Linux} 488 489 const 489 490 LinuxGameFilesDir = '/usr/share/xtactics'; 490 491 LinuxLanguagesDir = LinuxGameFilesDir + '/Languages'; 492 {$ENDIF} 491 493 begin 492 494 GameFilesDir := ''; … … 526 528 TFormEx.PersistentForm := PersistentForm1; 527 529 528 FormMain := TFormMain.Create(nil);530 Application.CreateForm(TFormMain, FormMain); 529 531 FormMain.Show; 530 532 end; … … 533 535 begin 534 536 FreeAndNil(ServerList); 535 if Assigned(FormMain.FormPlayersStats) then FreeAndNil(FormMain.FormPlayersStats);536 if Assigned(FormMain.FormUnitMoves) then FreeAndNil(FormMain.FormUnitMoves);537 if Assigned(FormMain.FormCharts) then FreeAndNil(FormMain.FormCharts);538 if Assigned(FormMain.FormKeyShortcuts) then FreeAndNil(FormMain.FormKeyShortcuts);539 537 FreeAndNil(FormClients); 540 538 FreeAndNil(StoredDimension); … … 544 542 FreeAndNil(GameSettings); 545 543 FreeAndNil(GameSystems); 546 FreeAndNil(FormMain);547 544 end; 548 545 -
trunk/Forms/FormMain.pas
r327 r328 98 98 FormUnitMoves: TFormUnitMoves; 99 99 FormCharts: TFormCharts; 100 FullScreen: Boolean;101 100 procedure LoadConfig(Config: TXmlConfig; Path: string); 102 101 procedure SaveConfig(Config: TXmlConfig; Path: string); … … 249 248 procedure TFormMain.FormDestroy(Sender: TObject); 250 249 begin 250 if Assigned(FormPlayersStats) then FreeAndNil(FormPlayersStats); 251 if Assigned(FormUnitMoves) then FreeAndNil(FormUnitMoves); 252 if Assigned(FormCharts) then FreeAndNil(FormCharts); 253 if Assigned(FormKeyShortcuts) then FreeAndNil(FormKeyShortcuts); 251 254 FreeAndNil(FormClient); 252 255 end; -
trunk/Packages/Common/Common.pas
r315 r328 53 53 function ComputerName: string; 54 54 procedure DeleteFiles(APath, AFileSpec: string); 55 function EndsWith(Text, What: string): Boolean; 55 56 function Explode(Separator: Char; Data: string): TStringArray; 56 57 procedure ExecuteProgram(Executable: string; Parameters: array of string); … … 87 88 procedure SearchFiles(AList: TStrings; Dir: string; 88 89 FilterMethod: TFilterMethod = nil; FileNameMethod: TFileNameMethod = nil); 90 procedure SortStrings(Strings: TStrings); 89 91 function SplitString(var Text: string; Count: Word): string; 90 92 function StripTags(const S: string): string; 93 function StartsWith(Text, What: string): Boolean; 91 94 function TryHexToInt(Data: string; out Value: Integer): Boolean; 92 95 function TryBinToInt(Data: string; out Value: Integer): Boolean; 93 procedure SortStrings(Strings: TStrings);94 96 95 97 96 98 implementation 99 100 function StartsWith(Text, What: string): Boolean; 101 begin 102 Result := Copy(Text, 1, Length(Text)) = What; 103 end; 104 105 function EndsWith(Text, What: string): Boolean; 106 begin 107 Result := Copy(Text, Length(Text) - Length(What) + 1, MaxInt) = What; 108 end; 97 109 98 110 function BinToInt(BinStr : string) : Int64; -
trunk/Packages/Common/FormEx.pas
r315 r328 13 13 private 14 14 FCounter: Integer; static; 15 FFirstShow: Boolean; 15 16 protected 16 17 procedure DoShow; override; … … 19 20 procedure DoDestroy; override; 20 21 public 22 FullScreen: Boolean; 21 23 PersistentForm: TPersistentForm; static; 22 24 ThemeManager: TThemeManager; static; … … 44 46 begin 45 47 inherited; 46 PersistentForm.Load(Self); 48 if not FFirstShow and (not (csDesigning in ComponentState)) then begin 49 FFirstShow := True; 50 PersistentForm.Load(Self); 51 FullScreen := PersistentForm.FormFullScreen; 52 end; 47 53 end; 48 54 … … 76 82 procedure TFormEx.DoClose(var CloseAction: TCloseAction); 77 83 begin 78 PersistentForm.Save(Self); 84 if (not (csDesigning in ComponentState)) then begin 85 PersistentForm.FormFullScreen := FullScreen; 86 PersistentForm.Save(Self); 87 end; 79 88 inherited; 80 89 end; -
trunk/Packages/Common/JobProgressView.pas
r317 r328 339 339 Caption := SPleaseWait + STerminate; 340 340 end; 341 341 342 342 343 { TJobProgressView } -
trunk/Packages/Common/PersistentForm.pas
r315 r328 16 16 FMinVisiblePart: Integer; 17 17 FRegistryContext: TRegistryContext; 18 FResizeEventOccured: Boolean; 18 19 procedure LoadControl(Control: TControl); 19 20 procedure SaveControl(Control: TControl); 21 procedure WindowStateChange(Sender: TObject); 20 22 public 21 23 FormRestoredSize: TRect; … … 301 303 302 304 procedure TPersistentForm.SetFullScreen(State: Boolean); 305 {$IFDEF UNIX} 306 var 307 OldHandler: TNotifyEvent; 308 var 309 I: Integer; 310 {$ENDIF} 303 311 begin 304 312 if State then begin … … 312 320 end; 313 321 FormWindowState := Form.WindowState; 314 Form.WindowState := wsMaximized;315 Form.WindowState := wsNormal;316 ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);317 322 {$IFDEF WINDOWS} 318 323 Form.BorderStyle := bsNone; 319 324 {$ENDIF} 325 Form.WindowState := wsFullscreen; 326 {$IFDEF UNIX} 327 // Workaround on Linux, WindowState is rewriten by WMSize event to wsNormal. 328 // We need for that even to occure 329 OldHandler := Form.OnWindowStateChange; 330 Form.OnWindowStateChange := WindowStateChange; 331 FResizeEventOccured := False; 332 for I := 0 to 10 do begin 333 if FResizeEventOccured then Break; 334 Application.ProcessMessages; 335 Sleep(1); 336 end; 337 Form.OnWindowStateChange := OldHandler; 338 {$ENDIF} 320 339 end else begin 321 340 FormFullScreen := False; 341 Form.WindowState := wsNormal; 322 342 {$IFDEF WINDOWS} 323 343 Form.BorderStyle := bsSizeable; 324 344 {$ENDIF} 325 ShowWindow(Form.Handle, SW_SHOWNORMAL);326 345 if FormWindowState = wsNormal then begin 327 346 Form.WindowState := wsNormal; … … 335 354 end; 336 355 356 procedure TPersistentForm.WindowStateChange(Sender: TObject); 357 begin 358 Form.WindowState := wsFullscreen; 359 FResizeEventOccured := True; 360 end; 361 337 362 end. -
trunk/xtactics.lpr
r317 r328 1 1 program xtactics; 2 3 {$mode objfpc}{$H+}4 2 5 3 uses … … 8 6 {$ENDIF} 9 7 Interfaces, // this includes the LCL widgetset 10 Forms, tachartlazaruspkg, Game, Core, Common, 11 TemplateGenerics 8 Forms, tachartlazaruspkg, Game, Core, Common, TemplateGenerics 12 9 { you can add units after this }, 13 10 SysUtils, FormMain, CoolStreaming;
Note:
See TracChangeset
for help on using the changeset viewer.