Changeset 178 for branches/highdpi/Start.pas
- Timestamp:
- Jun 23, 2019, 3:15:29 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Start.pas
r170 r178 7 7 GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Math, 8 8 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls, 9 Menus, Registry, DrawDlg, fgl, Protocol ;9 Menus, Registry, DrawDlg, fgl, Protocol, UDpiControls; 10 10 11 11 const … … 56 56 Down1Btn: TButtonC; 57 57 Up1Btn: TButtonC; 58 List: T ListBox;58 List: TDpiListBox; 59 59 RenameBtn: TButtonB; 60 60 DeleteBtn: TButtonB; … … 72 72 procedure FormShow(Sender: TObject); 73 73 procedure FormHide(Sender: TObject); 74 procedure FormClose(Sender: TObject; var Action: TCloseAction);75 74 procedure FormCreate(Sender: TObject); 76 75 procedure FormDestroy(Sender: TObject); 77 76 procedure BrainClick(Sender: TObject); 78 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);79 77 procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 80 78 Shift: TShiftState; x, y: integer); 81 procedure FormMouseUp(Sender: TObject; Button: TMouseButton;82 Shift: TShiftState; x, y: integer);83 procedure FormMouseMove(Sender: TObject; Shift: TShiftState; x, y: integer);84 79 procedure Up1BtnClick(Sender: TObject); 85 80 procedure Down1BtnClick(Sender: TObject); 81 procedure FormClose(Sender: TObject; var Action: TCloseAction); 86 82 procedure ListClick(Sender: TObject); 87 83 procedure RenameBtnClick(Sender: TObject); … … 92 88 procedure Down2BtnClick(Sender: TObject); 93 89 procedure QuitBtnClick(Sender: TObject); 90 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 94 91 procedure CustomizeBtnClick(Sender: TObject); 95 92 procedure AutoDiffUpBtnClick(Sender: TObject); 96 93 procedure AutoDiffDownBtnClick(Sender: TObject); 94 procedure FormMouseUp(Sender: TObject; Button: TMouseButton; 95 Shift: TShiftState; x, y: integer); 96 procedure FormMouseMove(Sender: TObject; Shift: TShiftState; x, y: integer); 97 97 procedure AutoEnemyUpBtnClick(Sender: TObject); 98 98 procedure AutoEnemyDownBtnClick(Sender: TObject); 99 99 procedure ReplayBtnClick(Sender: TObject); 100 100 public 101 EmptyPicture: T Bitmap;101 EmptyPicture: TDpiBitmap; 102 102 procedure UpdateFormerGames; 103 103 procedure UpdateMaps; … … 127 127 MapFileName: string; 128 128 FormerGames, Maps: TStringList; 129 LogoBuffer, Mini: T Bitmap; { game world sample preview }129 LogoBuffer, Mini: TDpiBitmap; { game world sample preview } 130 130 MiniColors: array [0 .. 11, 0 .. 1] of TColor; 131 131 // BookDate: string; … … 155 155 156 156 uses 157 Directories, Direct, ScreenTools, Inp, Back, Locale , PixelPointer;157 Directories, Direct, ScreenTools, Inp, Back, Locale; 158 158 159 159 {$R *.lfm} … … 290 290 PlayerSlots.Count := nPlOffered; 291 291 for i := 0 to PlayerSlots.Count - 1 do 292 with PlayerSlots[i]do begin292 with TPlayerSlot(PlayerSlots[i]) do begin 293 293 DiffUpBtn := TButtonC.Create(self); 294 294 DiffUpBtn.Graphic := GrExt[HGrSystem].Data; … … 324 324 CustomizeBtn.ButtonIndex := 2; 325 325 326 Brains[0].Picture := T Bitmap.Create;326 Brains[0].Picture := TDpiBitmap.Create; 327 327 Brains[0].Picture.SetSize(64, 64); 328 328 BitBlt(Brains[0].Picture.Canvas.Handle, 0, 0, 64, 64, 329 329 GrExt[HGrSystem2].Data.Canvas.Handle, 1, 111, SRCCOPY); 330 Brains[1].Picture := T Bitmap.Create;330 Brains[1].Picture := TDpiBitmap.Create; 331 331 Brains[1].Picture.SetSize(64, 64); 332 332 BitBlt(Brains[1].Picture.Canvas.Handle, 0, 0, 64, 64, 333 333 GrExt[HGrSystem2].Data.Canvas.Handle, 66, 111, SRCCOPY); 334 Brains[2].Picture := T Bitmap.Create;334 Brains[2].Picture := TDpiBitmap.Create; 335 335 Brains[2].Picture.SetSize(64, 64); 336 336 BitBlt(Brains[2].Picture.Canvas.Handle, 0, 0, 64, 64, 337 337 GrExt[HGrSystem2].Data.Canvas.Handle, 131, 111, SRCCOPY); 338 Brains[3].Picture := T Bitmap.Create;338 Brains[3].Picture := TDpiBitmap.Create; 339 339 Brains[3].Picture.SetSize(64, 64); 340 340 BitBlt(Brains[3].Picture.Canvas.Handle, 0, 0, 64, 64, … … 346 346 with AIBrains[I] do 347 347 begin 348 AIBrains[i].Picture := T Bitmap.Create;348 AIBrains[i].Picture := TDpiBitmap.Create; 349 349 if not LoadGraphicFile(AIBrains[i].Picture, HomeDir + 'AI' + DirectorySeparator + 350 350 FileName + DirectorySeparator + FileName + '.png', gfNoError) then begin … … 363 363 AIBrains.Free; 364 364 365 EmptyPicture := T Bitmap.Create;365 EmptyPicture := TDpiBitmap.Create; 366 366 EmptyPicture.PixelFormat := pf24bit; 367 367 EmptyPicture.SetSize(64, 64); 368 368 EmptyPicture.Canvas.FillRect(0, 0, EmptyPicture.Width, EmptyPicture.Height); 369 LogoBuffer := T Bitmap.Create;369 LogoBuffer := TDpiBitmap.Create; 370 370 LogoBuffer.PixelFormat := pf24bit; 371 371 LogoBuffer.SetSize(wBuffer, 56); 372 372 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height); 373 373 374 Mini := T Bitmap.Create;374 Mini := TDpiBitmap.Create; 375 375 for x := 0 to 11 do 376 376 for y := 0 to 1 do … … 926 926 begin // load 927 927 FileName := List.Items[List.ItemIndex]; 928 if LoadGame( GetSavedDir+ DirectorySeparator, FileName + CevoExt, LoadTurn, false)928 if LoadGame(DataDir + 'Saved' + DirectorySeparator, FileName + CevoExt, LoadTurn, false) 929 929 then 930 930 UnlistBackupFile(FileName) … … 1010 1010 end; 1011 1011 1012 StartNewGame( GetSavedDir+ DirectorySeparator, FileName + CevoExt, MapFileName,1012 StartNewGame(DataDir + 'Saved' + DirectorySeparator, FileName + CevoExt, MapFileName, 1013 1013 lxpre[WorldSize], lypre[WorldSize], StartLandMass, MaxTurn); 1014 1014 UnlistBackupFile(FileName); … … 1145 1145 pgLoad: 1146 1146 begin 1147 AssignFile(LogFile, GetSavedDir+ DirectorySeparator + List.Items[List.ItemIndex]1147 AssignFile(LogFile, DataDir + 'Saved' + DirectorySeparator + List.Items[List.ItemIndex] 1148 1148 + CevoExt); 1149 1149 try … … 1198 1198 if Page = pgEditMap then 1199 1199 MapFileName := List.Items[List.ItemIndex] + CevoMapExt; 1200 if LoadGraphicFile(Mini, GetMapsDir+ DirectorySeparator + Copy(MapFileName, 1,1200 if LoadGraphicFile(Mini, DataDir + 'Maps' + DirectorySeparator + Copy(MapFileName, 1, 1201 1201 Length(MapFileName) - 9) + '.png', gfNoError) then 1202 1202 begin … … 1215 1215 end; 1216 1216 1217 AssignFile(MapFile, GetMapsDir+ DirectorySeparator + MapFileName);1217 AssignFile(MapFile, DataDir + 'Maps' + DirectorySeparator + MapFileName); 1218 1218 try 1219 1219 Reset(MapFile, 4); … … 1395 1395 begin 1396 1396 FormerGames.Clear; 1397 if FindFirst( GetSavedDir+ DirectorySeparator + '*' + CevoExt, $21, F) = 0 then1397 if FindFirst(DataDir + 'Saved' + DirectorySeparator + '*' + CevoExt, $21, F) = 0 then 1398 1398 repeat 1399 1399 I := FormerGames.Count; … … 1415 1415 begin 1416 1416 Maps.Clear; 1417 if FindFirst( GetMapsDir+ DirectorySeparator + '*' + CevoMapExt, $21, f) = 0 then1417 if FindFirst(DataDir + 'Maps' + DirectorySeparator + '*' + CevoMapExt, $21, f) = 0 then 1418 1418 repeat 1419 1419 Maps.Add(Copy(f.Name, 1, Length(f.Name) - 9)); … … 1790 1790 end; 1791 1791 if Page = pgLoad then 1792 AssignFile(f, GetSavedDir+ DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)1792 AssignFile(f, DataDir + 'Saved' + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1793 1793 else 1794 AssignFile(f, GetMapsDir+ DirectorySeparator + List.Items[List.ItemIndex] +1794 AssignFile(f, DataDir + 'Maps'+ DirectorySeparator + List.Items[List.ItemIndex] + 1795 1795 CevoMapExt); 1796 1796 ok := true; 1797 1797 try 1798 1798 if Page = pgLoad then 1799 Rename(f, GetSavedDir+ DirectorySeparator + NewName + CevoExt)1799 Rename(f, DataDir + 'Saved'+ DirectorySeparator + NewName + CevoExt) 1800 1800 else 1801 Rename(f, GetMapsDir+ DirectorySeparator + NewName + CevoMapExt);1801 Rename(f, DataDir + 'Maps'+ DirectorySeparator + NewName + CevoMapExt); 1802 1802 except 1803 1803 // Play('INVALID'); … … 1806 1806 if Page <> pgLoad then 1807 1807 try // rename map picture 1808 AssignFile(f, GetMapsDir+ DirectorySeparator + List.Items[List.ItemIndex]1808 AssignFile(f, DataDir + 'Maps'+ DirectorySeparator + List.Items[List.ItemIndex] 1809 1809 + '.png'); 1810 Rename(f, GetMapsDir+ DirectorySeparator + NewName + '.png');1810 Rename(f, DataDir + 'Maps'+ DirectorySeparator + NewName + '.png'); 1811 1811 except 1812 1812 end; … … 1842 1842 begin 1843 1843 if Page = pgLoad then 1844 AssignFile(f, GetSavedDir+ DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)1844 AssignFile(f, DataDir + 'Saved' + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1845 1845 else 1846 AssignFile(f, GetMapsDir+ DirectorySeparator + List.Items[List.ItemIndex] +1846 AssignFile(f, DataDir + 'Maps' + DirectorySeparator + List.Items[List.ItemIndex] + 1847 1847 CevoMapExt); 1848 1848 Erase(f); … … 2036 2036 procedure TStartDlg.ReplayBtnClick(Sender: TObject); 2037 2037 begin 2038 LoadGame( GetSavedDir+ DirectorySeparator, List.Items[List.ItemIndex] + CevoExt,2038 LoadGame(DataDir + 'Saved' + DirectorySeparator, List.Items[List.ItemIndex] + CevoExt, 2039 2039 LastTurn, True); 2040 2040 SlotAvailable := -1;
Note:
See TracChangeset
for help on using the changeset viewer.