Changeset 76
- Timestamp:
- May 18, 2021, 10:25:20 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormImages.lfm
r41 r76 1 1 object FormImages: TFormImages 2 2 Left = 1198 3 Height = 3493 Height = 524 4 4 Top = 264 5 Width = 7025 Width = 1053 6 6 Caption = 'FormImages' 7 ClientHeight = 349 8 ClientWidth = 702 9 LCLVersion = '1.6.2.0' 7 ClientHeight = 524 8 ClientWidth = 1053 9 DesignTimePPI = 144 10 LCLVersion = '2.0.12.0' 10 11 object ImageLocomotive: TImage 11 Left = 3212 Height = 3413 Top = 3214 Width = 3212 Left = 48 13 Height = 51 14 Top = 48 15 Width = 48 15 16 Picture.Data = { 16 17 1754506F727461626C654E6574776F726B477261706869634E04000089504E47 … … 53 54 end 54 55 object ImagePassenger: TImage 55 Left = 3356 Height = 3257 Top = 6458 Width = 3256 Left = 50 57 Height = 48 58 Top = 96 59 Width = 48 59 60 Picture.Data = { 60 61 1754506F727461626C654E6574776F726B477261706869638C02000089504E47 … … 83 84 end 84 85 object ImageTunnel: TImage 85 Left = 3286 Height = 5187 Top = 1 0488 Width = 5686 Left = 48 87 Height = 76 88 Top = 156 89 Width = 84 89 90 Picture.Data = { 90 91 1754506F727461626C654E6574776F726B47726170686963E40E000089504E47 … … 211 212 end 212 213 object ImageScreenshot: TImage 213 Left = 33214 Height = 32215 Top = 168216 Width = 34214 Left = 50 215 Height = 48 216 Top = 252 217 Width = 51 217 218 Picture.Data = { 218 219 1754506F727461626C654E6574776F726B477261706869631C0E000089504E47 … … 332 333 } 333 334 end 335 object ImageLeftArrow: TImage 336 Left = 163 337 Height = 79 338 Top = 57 339 Width = 85 340 Picture.Data = { 341 1754506F727461626C654E6574776F726B477261706869630602000089504E47 342 0D0A1A0A0000000D49484452000001000000010008030000006BAC5854000000 343 21504C5445000000000000000000000000000000000000000000000000000000 344 0000000000006DD148C10000000A74524E530010304050809FBFCFEFF438B8CF 345 0000018A49444154789CEDDC8B718200144451893141FB2F386901F2165C724E 346 05EC1D67547EB71B000000000000000000000000F007CB63B3FBD9C73C69595F 347 5BADCBD9073DC87EFBEDB7DF7EFBEDB7DF7EFBEDB7DF7EFBEDB7DF7EFBEDB7DF 348 7EFBEDB7DF7EFBEDBF0EFBEDB7DF7EFBEDB7DF7EFBEDB7DF7EFBEDB7DF7EFBED 349 B7DF7EFBEDB7DF7EFBEDB7FF3A76EC7FADDF07FB78AFFDC7CB3D72DBB13F17A0 350 647F2C40CBFE54809AFDA1003DFB33018AF6470234ED4F04A8DA1F08D0B57F3E 351 40D9FEF1006DFBA703D4ED1F0ED0B77F3640E1FED1008DFB270354EE9F0CF075 352 F6965D7C02E6027416F02D3019A0B1805F82B301FA0AF837381DA0AD803342F3 353 01BA0A382B9C08D054C095A14C809E02AE0EA702B41408BE93BCA340F2A5EC15 354 05A26FA5DF51E0F9793F56F6AEB4FF7E9F9C020A28A080020A28A080020A28A0 355 80020A28A080020A28A080020A28A080020A28A080020A28A080020A28A08002 356 0A28A080020A28A080020A28A080020A28A080020A28F05BE0B159F409500000 357 00000000000000000000E0627E009B74DE3A9610647B0000000049454E44AE42 358 6082 359 } 360 Proportional = True 361 Stretch = True 362 end 334 363 end -
trunk/Forms/UFormImages.pas
r41 r76 13 13 14 14 TFormImages = class(TForm) 15 ImageLeftArrow: TImage; 15 16 ImageLocomotive: TImage; 16 17 ImagePassenger: TImage; -
trunk/Forms/UFormMain.lfm
r71 r76 15 15 OnKeyUp = FormKeyUp 16 16 OnShow = FormShow 17 LCLVersion = '2.0.1 0.0'17 LCLVersion = '2.0.12.0' 18 18 object PaintBox1: TPaintBox 19 19 Left = 0 -
trunk/Forms/UFormMain.pas
r69 r76 44 44 procedure LoadConfig; 45 45 procedure SaveConfig; 46 procedure LoadGraphicAssets; 47 procedure DarkModeChange(Sender: TObject); 46 48 public 47 49 FullScreen: Boolean; … … 59 61 60 62 uses 61 UFormImages ;63 UFormImages, UPixelPointer; 62 64 63 65 { TFormMain } … … 114 116 FullScreen := PersistentForm1.FormFullScreen; 115 117 Engine.InitMenus; 116 Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture); 117 Engine.ImageLocomotive.Picture.Assign(FormImages.ImageLocomotive.Picture); 118 Engine.OnDarkModeChange := DarkModeChange; 118 119 Engine.Map.Size := Point(PaintBox1.Width, PaintBox1.Height); 119 120 Engine.View.DestRect := Rect(0, 0, PaintBox1.Width, PaintBox1.Height); 120 121 Engine.MainMenu; 122 LoadGraphicAssets; 121 123 end; 122 124 end; … … 212 214 end; 213 215 216 procedure TFormMain.LoadGraphicAssets; 217 begin 218 Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture); 219 Engine.ImageLocomotive.Picture.Assign(FormImages.ImageLocomotive.Picture); 220 Engine.ButtonBack.Bitmap.Assign(FormImages.ImageLeftArrow.Picture.Bitmap); 221 if Engine.DarkMode then begin 222 BitmapInvert(Engine.ImagePassenger.Picture.Bitmap); 223 BitmapInvert(Engine.ImageLocomotive.Picture.Bitmap); 224 BitmapInvert(Engine.ButtonBack.Bitmap); 225 end; 226 end; 227 228 procedure TFormMain.DarkModeChange(Sender: TObject); 229 begin 230 LoadGraphicAssets; 231 end; 232 214 233 215 234 end. -
trunk/Languages/BigMetro.cs.po
r66 r76 11 11 "Language: cs\n" 12 12 "X-Generator: Poedit 2.4.1\n" 13 14 #: tformimages.caption 15 msgid "FormImages" 16 msgstr "" 13 17 14 18 #: tformmain.caption … … 108 112 msgid "Try again" 109 113 msgstr "Zkusit znovu" 114 -
trunk/Languages/BigMetro.po
r66 r76 1 1 msgid "" 2 2 msgstr "Content-Type: text/plain; charset=UTF-8" 3 4 #: tformimages.caption 5 msgid "FormImages" 6 msgstr "" 3 7 4 8 #: tformmain.caption -
trunk/Packages/Common/Common.lpk
r60 r76 40 40 <License Value="GNU/GPL"/> 41 41 <Version Minor="7"/> 42 <Files Count="2 6">42 <Files Count="27"> 43 43 <Item1> 44 44 <Filename Value="StopWatch.pas"/> … … 156 156 <UnitName Value="ULanguages"/> 157 157 </Item26> 158 <Item27> 159 <Filename Value="UPixelPointer.pas"/> 160 <UnitName Value="UPixelPointer"/> 161 </Item27> 158 162 </Files> 159 163 <i18n> -
trunk/Packages/Common/Common.pas
r60 r76 13 13 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 14 14 UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UMetaCanvas, 15 UGeometric, UTranslator, ULanguages, LazarusPackageIntf;15 UGeometric, UTranslator, ULanguages, UPixelPointer, LazarusPackageIntf; 16 16 17 17 implementation -
trunk/UEngine.pas
r73 r76 277 277 private 278 278 FDarkMode: Boolean; 279 FOnDarkModeChange: TNotifyEvent; 279 280 LastMousePos: TPoint; 280 281 LastFocusedStation: TMapStation; … … 292 293 MenuOptions: TMenu; 293 294 MenuGame: TMenu; 294 ButtonBack: TMenuItemButton;295 295 LastState: TGameState; 296 296 function GetServedDaysCount: Integer; … … 345 345 State: TGameState; 346 346 RedrawPending: Boolean; 347 ButtonBack: TMenuItemImage; 347 348 ImagePassenger: TImage; 348 349 ImageLocomotive: TImage; … … 365 366 property DarkMode: Boolean read FDarkMode write SetDarkMode; 366 367 property ServedDaysCount: Integer read GetServedDaysCount; 368 property OnDarkModeChange: TNotifyEvent read FOnDarkModeChange 369 write FOnDarkModeChange; 367 370 end; 368 371 … … 382 385 ImagePassengerName = 'Images/Passenger.png'; 383 386 ImageLocomotiveName = 'Images/Locomotive.png'; 387 ImageLeftArrowName = 'Images/Left arrow.png'; 384 388 TrainPassengerCount = 6; 385 389 StationMinDistance = 100; … … 403 407 404 408 uses 405 UGeometric, UFormMain, ULanguages ;409 UGeometric, UFormMain, ULanguages, UPixelPointer; 406 410 407 411 resourcestring … … 1667 1671 FDarkMode := AValue; 1668 1672 InitColors; 1673 if Assigned(FOnDarkModeChange) then FOnDarkModeChange(Self); 1669 1674 end; 1670 1675 … … 2643 2648 NewIndex: Integer; 2644 2649 begin 2645 if Button = mbLeft then begin 2646 if State <> gsMenu then begin 2650 if (Button = mbLeft) and (State <> gsMenu) then begin 2647 2651 MouseHold := True; 2648 2652 LastFocusedStation := nil; … … 2656 2660 // Select unused train 2657 2661 if (Distance(Position, Point(View.DestRect.Right div 2 - Length(LineColors) div 2 * LineColorsDist - 100, 2658 View.DestRect.Bottom - LineColorsDist)) < 30) and2662 View.DestRect.Bottom - LineColorsDist)) < 30) and 2659 2663 (Trains.GetUnusedCount > 0) then begin 2660 2664 SelectedTrain := Trains.GetUnusedTrain; 2661 2665 Exit; 2666 end; 2667 2668 // New track creation from selected station as start 2669 Station := GetStationOnPos(View.PointDestToSrc(Position)); 2670 if Assigned(Station) then begin 2671 if Assigned(SelectedLine) and (SelectedLine.LineStations.Count = 0) then NewLine := SelectedLine 2672 else NewLine := GetUnusedLine; 2673 if Assigned(NewLine) then begin 2674 NewLine.ConnectStation(Station, nil, nil); 2675 TrackStationDown := NewLine.Track.Points.Last; 2676 TrackStationUp := nil; 2677 LastFocusedStation := Station; 2678 SelectedLine := NewLine; 2679 Exit; 2680 end; 2662 2681 end; 2663 2682 … … 2686 2705 end; 2687 2706 if Assigned(Track) then Track.Free; 2688 2689 // New track creation from selected station as start2690 Station := GetStationOnPos(View.PointDestToSrc(Position));2691 if Assigned(Station) then begin2692 if Assigned(SelectedLine) and (SelectedLine.LineStations.Count = 0) then NewLine := SelectedLine2693 else NewLine := GetUnusedLine;2694 if Assigned(NewLine) then begin2695 NewLine.ConnectStation(Station, nil, nil);2696 TrackStationDown := NewLine.Track.Points.Last;2697 TrackStationUp := nil;2698 LastFocusedStation := Station;2699 end;2700 end;2701 end;2702 2707 end; 2703 2708 end; … … 2787 2792 constructor TEngine.Create; 2788 2793 begin 2789 ButtonBack := TMenuItemButton.Create; 2790 ButtonBack.Text := '🡸'; 2794 ButtonBack := TMenuItemImage.Create; 2791 2795 ButtonBack.OnClick := ButtonBackClick; 2792 2796 ButtonBack.BackgroundColor := clNone; 2797 ButtonBack.Bounds := Bounds(0, 0, ScaleX(80, 96), ScaleY(80, 96)); 2793 2798 MenuMain := TMenu.Create; 2794 2799 MenuOptions := TMenu.Create; -
trunk/UMenu.pas
r68 r76 25 25 procedure Paint(Canvas: TCanvas; P: TPoint); virtual; 26 26 function GetOutputText: string; virtual; 27 constructor Create; 27 constructor Create; virtual; 28 28 end; 29 29 … … 47 47 Index: Integer; 48 48 States: TStringList; 49 constructor Create; 49 constructor Create; override; 50 50 destructor Destroy; override; 51 51 procedure Paint(Canvas: TCanvas; P: TPoint); override; … … 62 62 procedure Paint(Canvas: TCanvas; P: TPoint); override; 63 63 property OnClick: TNotifyEvent read FOnClick write FOnClick; 64 end; 65 66 { TMenuItemImage } 67 68 TMenuItemImage = class(TMenuItem) 69 private 70 FOnClick: TNotifyEvent; 71 public 72 Bitmap: TBitmap; 73 procedure Paint(Canvas: TCanvas; P: TPoint); override; 74 property OnClick: TNotifyEvent read FOnClick write FOnClick; 75 constructor Create; override; 76 destructor Destroy; override; 64 77 end; 65 78 … … 105 118 implementation 106 119 120 { TMenuItemImage } 121 122 procedure TMenuItemImage.Paint(Canvas: TCanvas; P: TPoint); 123 begin 124 if Selected then Canvas.Brush.Color := BackgroundSelectedColor 125 else Canvas.Brush.Color := BackgroundColor; 126 if Canvas.Brush.Color = clNone then Canvas.Brush.Style := bsClear 127 else Canvas.Brush.Style := bsSolid; 128 Canvas.StretchDraw(Bounds, Bitmap); 129 end; 130 131 constructor TMenuItemImage.Create; 132 begin 133 inherited; 134 Bitmap := TBitmap.Create; 135 end; 136 137 destructor TMenuItemImage.Destroy; 138 begin 139 FreeAndNil(Bitmap); 140 inherited; 141 end; 142 107 143 { TMenuItemButton } 108 144 … … 155 191 constructor TMenuItemComboBox.Create; 156 192 begin 193 inherited; 157 194 States := TStringList.Create; 158 195 end; … … 160 197 destructor TMenuItemComboBox.Destroy; 161 198 begin 162 States.Free;199 FreeAndNil(States); 163 200 inherited; 164 201 end;
Note:
See TracChangeset
for help on using the changeset viewer.