Changeset 310
- Timestamp:
- Aug 18, 2021, 4:02:44 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r304 r310 15 15 OnKeyUp = FormKeyUp 16 16 OnShow = FormShow 17 LCLVersion = '2.0.2.0' 18 WindowState = wsMaximized 17 LCLVersion = '2.0.12.0' 19 18 object ToolBar1: TToolBar 20 19 Left = 0 … … 46 45 end 47 46 object ToolButton5: TToolButton 48 Left = 17 347 Left = 171 49 48 Top = 2 50 49 Action = Core.ASettings 51 50 end 52 51 object ToolButton9: TToolButton 53 Left = 16 752 Left = 166 54 53 Height = 32 55 54 Top = 2 … … 57 56 end 58 57 object ToolButton11: TToolButton 59 Left = 10 358 Left = 102 60 59 Top = 2 61 60 Action = Core.AGameLoad 62 61 end 63 62 object ToolButton12: TToolButton 64 Left = 13 563 Left = 134 65 64 Top = 2 66 65 Action = Core.AGameSave 67 66 end 68 67 object ToolButton13: TToolButton 69 Left = 20 568 Left = 203 70 69 Top = 2 71 70 Action = Core.AExit … … 90 89 object MainMenu1: TMainMenu 91 90 Images = Core.ImageListSmall 92 left = 22493 top = 4891 Left = 224 92 Top = 48 94 93 object MenuItem1: TMenuItem 95 94 Caption = 'Game' … … 210 209 Interval = 20 211 210 OnTimer = Timer1Timer 212 left = 128213 top = 263211 Left = 128 212 Top = 263 214 213 end 215 214 object ActionList1: TActionList 216 215 Images = Core.ImageListSmall 217 left = 280218 top = 152216 Left = 280 217 Top = 152 219 218 object AToolBarBigIcons: TAction 220 219 Caption = 'Toolbar big icons' … … 239 238 end 240 239 object PopupMenuToolbar: TPopupMenu 241 left = 452242 top = 98240 Left = 452 241 Top = 98 243 242 object MenuItem18: TMenuItem 244 243 Action = AToolBarBigIcons -
trunk/Forms/UFormMain.pas
r273 r310 91 91 FormActivated: Boolean; 92 92 FormShown: Boolean; 93 FullScreen: Boolean; 93 94 procedure ApplicationStart(Ptr: IntPtr); 94 95 procedure UpdateClientForms; … … 284 285 AUnitShapeVisible.Checked := Core.UnitShapeVisible; 285 286 Core.ScaleDPI; 286 Core.PersistentForm.Load(Self, True); 287 Core.PersistentForm.Load(Self); 288 FullScreen := Core.PersistentForm.FormFullScreen; 287 289 Core.ThemeManager1.UseTheme(Self); 288 290 Core.Init; -
trunk/Install/snap/snapcraft.yaml
r309 r310 52 52 install -d -m 755 $ROOT/usr/bin 53 53 install -s -m 755 xtactics $ROOT/usr/bin/xtactics 54 install -d -m 755 $ROOT/usr/share/xtactics/languages 55 install -m 755 Languages/xtactics.po $ROOT/usr/share/xtactics/languages 56 install -m 755 Languages/xtactics.cs.po $ROOT/usr/share/xtactics/languages 54 install -d -m 755 $ROOT/usr/share/xtactics/Languages 55 install -m 755 Languages/xtactics.po $ROOT/usr/share/xtactics/Languages 56 install -m 755 Languages/xtactics.cs.po $ROOT/usr/share/xtactics/Languages 57 install -m 755 Languages/UFormAbout.po $ROOT/usr/share/xtactics/Languages 58 install -m 755 Languages/UFormAbout.cs.po $ROOT/usr/share/xtactics/Languages 57 59 install -d -m 755 $ROOT/usr/share/applications 58 60 install -m 755 Install/snap/local/xtactics.desktop $ROOT/usr/share/applications 59 61 install -d -m 755 $ROOT/usr/share/pixmaps 60 62 install -m 755 Images/64x64/xtactics.png $ROOT/usr/share/pixmaps 63 cp -r Systems $ROOT/usr/share/xtactics 64 install -d -m 755 $ROOT/usr/share/xtactics/Images 65 cp -r Images/Maps $ROOT/usr/share/xtactics/Images 61 66 stage: 62 67 #- etc … … 107 112 - desktop 108 113 - x11 109 - opengl110 114 111 115 layout: -
trunk/Packages/Common/UCommon.pas
r308 r310 40 40 {$ENDIF} 41 41 42 function IntToBin(Data: Int64; Count: Byte): string;42 function AddLeadingZeroes(const aNumber, Length : integer) : string; 43 43 function BinToInt(BinStr: string): Int64; 44 function TryHexToInt(Data: string; var Value: Integer): Boolean;45 function TryBinToInt(Data: string; var Value: Integer): Boolean;46 44 function BinToHexString(Source: AnsiString): string; 47 45 //function DelTree(DirName : string): Boolean; … … 49 47 function BCDToInt(Value: Byte): Byte; 50 48 function CompareByteArray(Data1, Data2: TArrayOfByte): Boolean; 49 procedure CopyStringArray(Dest: TStringArray; Source: array of string); 50 function CombinePaths(Path1, Path2: string): string; 51 function ComputerName: string; 52 procedure DeleteFiles(APath, AFileSpec: string); 53 procedure ExecuteProgram(Executable: string; Parameters: array of string); 54 procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog); 55 procedure FreeThenNil(var Obj); 56 function GetDirCount(Dir: string): Integer; 51 57 function GetUserName: string; 52 function LoggedOnUserNameEx(Format: TUserNameFormat): string;53 function SplitString(var Text: string; Count: Word): string;54 58 function GetBitCount(Variable: QWord; MaxIndex: Integer): Integer; 55 59 function GetBit(Variable: QWord; Index: Byte): Boolean; 60 function GetStringPart(var Text: string; Separator: string): string; 61 function GenerateNewName(OldName: string): string; 62 function GetFileFilterItemExt(Filter: string; Index: Integer): string; 63 function IntToBin(Data: Int64; Count: Byte): string; 64 function LastPos(const SubStr: String; const S: String): Integer; 65 function LoadFileToStr(const FileName: TFileName): AnsiString; 66 function LoggedOnUserNameEx(Format: TUserNameFormat): string; 67 function MergeArray(A, B: array of string): TArrayOfString; 68 function OccurenceOfChar(What: Char; Where: string): Integer; 69 procedure OpenWebPage(URL: string); 70 procedure OpenFileInShell(FileName: string); 71 function PosFromIndex(SubStr: string; Text: string; 72 StartIndex: Integer): Integer; 73 function PosFromIndexReverse(SubStr: string; Text: string; 74 StartIndex: Integer): Integer; 75 function RemoveQuotes(Text: string): string; 76 procedure SaveStringToFile(S, FileName: string); 56 77 procedure SetBit(var Variable: Int64; Index: Byte; State: Boolean); overload; 57 78 procedure SetBit(var Variable: QWord; Index: Byte; State: Boolean); overload; 58 79 procedure SetBit(var Variable: Cardinal; Index: Byte; State: Boolean); overload; 59 80 procedure SetBit(var Variable: Word; Index: Byte; State: Boolean); overload; 60 function AddLeadingZeroes(const aNumber, Length : integer) : string;61 function LastPos(const SubStr: String; const S: String): Integer;62 function GenerateNewName(OldName: string): string;63 function GetFileFilterItemExt(Filter: string; Index: Integer): string;64 procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog);65 procedure DeleteFiles(APath, AFileSpec: string);66 procedure OpenWebPage(URL: string);67 procedure OpenFileInShell(FileName: string);68 procedure ExecuteProgram(Executable: string; Parameters: array of string);69 procedure FreeThenNil(var Obj);70 function RemoveQuotes(Text: string): string;71 function ComputerName: string;72 function OccurenceOfChar(What: Char; Where: string): Integer;73 function GetDirCount(Dir: string): Integer;74 function MergeArray(A, B: array of string): TArrayOfString;75 function LoadFileToStr(const FileName: TFileName): AnsiString;76 procedure SaveStringToFile(S, FileName: string);77 81 procedure SearchFiles(AList: TStrings; Dir: string; 78 82 FilterMethod: TFilterMethod = nil; FileNameMethod: TFileNameMethod = nil); 79 function GetStringPart(var Text: string; Separator: string): string;83 function SplitString(var Text: string; Count: Word): string; 80 84 function StripTags(const S: string): string; 81 function PosFromIndex(SubStr: string; Text: string; 82 StartIndex: Integer): Integer; 83 function PosFromIndexReverse(SubStr: string; Text: string; 84 StartIndex: Integer): Integer; 85 procedure CopyStringArray(Dest: TStringArray; Source: array of string); 85 function TryHexToInt(Data: string; var Value: Integer): Boolean; 86 function TryBinToInt(Data: string; var Value: Integer): Boolean; 86 87 87 88 … … 669 670 end; 670 671 672 function CombinePaths(Path1, Path2: string): string; 673 begin 674 Result := Path1; 675 if Result <> '' then Result := Result + DirectorySeparator + Path2 676 else Result := Path2; 677 end; 678 671 679 672 680 initialization -
trunk/Packages/Common/UScaleDPI.pas
r308 r310 227 227 Temp[I] := TBitmap.Create; 228 228 Temp[I].SetSize(NewWidth, NewHeight); 229 {$IFDEF Linux} 230 Temp[I].PixelFormat := pf24bit; 231 {$ELSE} 229 232 Temp[I].PixelFormat := pf32bit; 233 {$ENDIF} 230 234 Temp[I].TransparentColor := TempBmp.TransparentColor; 231 235 //Temp[I].TransparentMode := TempBmp.TransparentMode; -
trunk/UCore.pas
r309 r310 10 10 URegistry, ULastOpenedList, UTheme, UAboutDialog, Registry, Menus, 11 11 UFormClient, UPlayer, UGameServer, UGameClient, fgl, UServerList, UGameSystem, 12 Graphics ;12 Graphics, UUnit; 13 13 14 14 type … … 75 75 FormNewTabIndex: Integer; 76 76 OldWindowState: TWindowState; 77 InFullScreenMode: Boolean; 77 FullScreen: Boolean; 78 GameFilesDir: string; 78 79 procedure LoadRecentExecute(Sender: TObject); 79 80 procedure StartNewGame; … … 90 91 procedure FormClientActions; 91 92 procedure LoadGameSystems; 93 procedure ToggleFullscreen; 92 94 public 93 95 Game: TGame; … … 130 132 131 133 uses 132 UFormMain, UFormNew, UFormSettings, UClientAI, UFormKeyShortcuts, 134 UFormMain, UFormNew, UFormSettings, UClientAI, UFormKeyShortcuts, UCommon, 133 135 UFormHelp, UFormCharts, UFormUnitMoves, UFormPlayersStats, UClientGUI; 134 136 … … 303 305 procedure TCore.AFullscreenExecute(Sender: TObject); 304 306 begin 305 if InFullScreenMode then begin 306 // Workaround: WindowState has sometimes wrong value under Linux. 307 // Try to switch fullscreen again before switching back. 308 if FormMain.WindowState <> wsFullScreen then begin 309 FormMain.WindowState := wsFullScreen; 310 end; 311 {$IFDEF WINDOWS} 312 FormMain.BorderStyle := bsSizeable; 313 {$ENDIF} 314 FormMain.WindowState := OldWindowState; 315 InFullScreenMode := False; 316 end else begin 317 OldWindowState := FormMain.WindowState; 318 {$IFDEF WINDOWS} 319 FormMain.BorderStyle := bsNone; 320 {$ENDIF} 321 FormMain.WindowState := wsFullScreen; 322 InFullScreenMode := True; 323 end; 307 ToggleFullscreen; 324 308 end; 325 309 … … 402 386 if FileExists(Game.FileName) then 403 387 Game.SaveToFile(Game.FileName) 404 else AGameSave .Execute;388 else AGameSaveAs.Execute; 405 389 end; 406 390 … … 476 460 procedure TCore.DataModuleCreate(Sender: TObject); 477 461 const 478 LinuxLanguagesDir = '/usr/share/xtactics/languages'; 479 begin 462 LinuxGameFilesDir = '/usr/share/xtactics'; 463 LinuxLanguagesDir = LinuxGameFilesDir + '/Languages'; 464 begin 465 GameFilesDir := ''; 480 466 {$IFDEF Linux} 467 // If installed in Linux system then use installation shared game directory for data files 468 if DirectoryExists(LinuxGameFilesDir) then 469 GameFilesDir := LinuxGameFilesDir; 481 470 // If installed in Linux system then use installation directory for po files 482 471 if not DirectoryExists(CoolTranslator1.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then … … 484 473 {$ENDIF} 485 474 486 475 GameSystems := TGameSystems.Create; 487 476 Server := TServer.Create; 488 477 LocalClients := TClients.Create; … … 494 483 Game.OnNewTurn := GameNewTurnExecute; 495 484 Game.OnPlayerChange := DoPlayerChange; 485 Game.MapImageFileName := CombinePaths(GameFilesDir, 'Images' + DirectorySeparator + 'Maps' + DirectorySeparator + 'WorldMap.png'); 496 486 Server.Game := Game; 497 487 LocalClients.Game := Game; … … 604 594 procedure TCore.LoadGameSystems; 605 595 var 606 NewItem: TGameSystem; 607 begin 608 if DirectoryExists('Systems') then begin 609 GameSystems.LoadFromDir('Systems'); 596 NewGameSystem: TGameSystem; 597 NewUnitKind: TUnitKind; 598 SystemsDir: string; 599 begin 600 if GameFilesDir <> '' then 601 SystemsDir := GameFilesDir + DirectorySeparator + 'Systems' 602 else SystemsDir := 'Systems'; 603 if DirectoryExists(SystemsDir) then begin 604 GameSystems.LoadFromDir(SystemsDir); 610 605 end else begin 611 NewItem := TGameSystem.Create; 612 NewItem.FileName := 'Custom'; 613 GameSystems.Add(NewItem); 606 // Create default game system if the directory with definitions was not found 607 NewGameSystem := TGameSystem.Create; 608 NewGameSystem.FileName := 'HexWars'; 609 NewUnitKind := TUnitKind.Create; 610 NewUnitKind.Name := 'Unit'; 611 NewGameSystem.UnitKinds.Add(NewUnitKind); 612 GameSystems.Add(NewGameSystem); 614 613 end; 615 614 if GameSystems.Count > 0 then begin … … 617 616 Game.GameSystem.Assign(GameSystems.First); 618 617 end; 618 end; 619 620 procedure TCore.ToggleFullscreen; 621 begin 622 FullScreen := not FullScreen; 623 PersistentForm.Form := FormMain; 624 PersistentForm.SetFullScreen(FullScreen); 625 UpdateInterface; 619 626 end; 620 627 -
trunk/UGame.pas
r304 r310 860 860 861 861 GeneratePlayers := True; 862 MapImageFileName := ' Images/Maps/WorldMap.png';862 MapImageFileName := ''; 863 863 Randomize; 864 864 StoredRandSeed := RandSeed;
Note:
See TracChangeset
for help on using the changeset viewer.