Changeset 465 for branches/highdpi/Brain.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Brain.pas
r464 r465 1 unit UBrain; 2 3 {$mode delphi} 1 unit Brain; 4 2 5 3 interface 6 4 7 5 uses 8 UDpiControls, Classes, SysUtils, fgl, Graphics, Protocol, LazFileUtils, dynlibs; 6 UDpiControls, Classes, SysUtils, Generics.Collections, Graphics, Protocol, LazFileUtils, 7 dynlibs, Types; 9 8 10 9 const … … 35 34 Picture: TDpiBitmap; 36 35 Beginner: Boolean; 36 procedure LoadPicture; 37 37 procedure LoadFromFile(AIFileName: string); 38 38 constructor Create; … … 42 42 { TBrains } 43 43 44 TBrains = class(T FPGObjectList<TBrain>)44 TBrains = class(TObjectList<TBrain>) 45 45 function AddNew: TBrain; 46 46 function GetKindCount(Kind: TBrainType): Integer; 47 47 procedure GetByKind(Kind: TBrainType; Brains: TBrains); 48 48 function GetBeginner: TBrain; 49 procedure LoadPictures; 49 50 end; 50 51 … … 53 54 54 55 uses 55 ScreenTools ;56 ScreenTools, Directories; 56 57 57 58 { TBrain } 59 60 procedure TBrain.LoadPicture; 61 var 62 TextSize: TSize; 63 begin 64 if not LoadGraphicFile(Picture, GetAiDir + DirectorySeparator + 65 FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin 66 with Picture.Canvas do begin 67 Brush.Color := $904830; 68 FillRect(Rect(0, 0, 64, 64)); 69 Font.Assign(UniFont[ftTiny]); 70 Font.Style := []; 71 Font.Color := $5FDBFF; 72 TextSize := TextExtent(FileName); 73 TextOut(32 - TextSize.Width div 2, 32 - TextSize.Height div 2, FileName); 74 end; 75 end; 76 end; 58 77 59 78 procedure TBrain.LoadFromFile(AIFileName: string); … … 106 125 DLLName := BasePath + DirectorySeparator + Value 107 126 {$ENDIF}{$ENDIF} 108 {$IFDEF LINUX}{$IFDEF CPU32} 109 else if Key = '#PATH_LINUX32' then 110 DLLName := BasePath + DirectorySeparator + Value 111 {$ENDIF}{$ENDIF} 112 {$IFDEF LINUX}{$IFDEF CPU64} 113 else if Key = '#PATH_LINUX64' then 127 {$IFDEF UNIX}{$IFDEF CPUI386} 128 else if Key = '#PATH_LINUX_I386' then 129 DLLName := BasePath + DirectorySeparator + Value 130 {$ENDIF}{$ENDIF} 131 {$IFDEF UNIX}{$IFDEF CPUAMD64} 132 else if Key = '#PATH_LINUX_AMD64' then 133 DLLName := BasePath + DirectorySeparator + Value 134 {$ENDIF}{$ENDIF} 135 {$IFDEF UNIX}{$IFDEF CPUARM} 136 else if Key = '#PATH_LINUX_ARM32' then 137 DLLName := BasePath + DirectorySeparator + Value 138 {$ENDIF}{$ENDIF} 139 {$IFDEF UNIX}{$IFDEF CPUAARCH64} 140 else if Key = '#PATH_LINUX_ARM64' then 114 141 DLLName := BasePath + DirectorySeparator + Value 115 142 {$ENDIF}{$ENDIF} … … 177 204 end; 178 205 206 procedure TBrains.LoadPictures; 207 var 208 I: Integer; 209 begin 210 for I := 0 to Count - 1 do 211 with Items[I] do LoadPicture; 212 end; 213 179 214 end. 180 215 216 217
Note:
See TracChangeset
for help on using the changeset viewer.