Changeset 83 for trunk/Engine.pas
- Timestamp:
- May 17, 2024, 4:52:24 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Engine.pas
r80 r83 207 207 FBitmap: TBitmap; 208 208 FBitmapLock: TCriticalSection; 209 FOnClose: TNotifyEvent; 209 210 FOnGameEnd: TNotifyEvent; 210 211 FRedrawPending: Boolean; … … 232 233 procedure DrawMap; 233 234 procedure SetState(AValue: TGameState); 235 procedure ShowMenuItem(Key, Text: string; X, Y: Integer; Canvas: TCanvas); 234 236 function TextOutWordWrap(Canvas: TCanvas; X, Y: Integer; Text: string; Width: Integer): Integer; 235 237 public … … 264 266 property State: TGameState read FState write SetState; 265 267 property OnGameEnd: TNotifyEvent read FOnGameEnd write FOnGameEnd; 268 property OnClose: TNotifyEvent read FOnClose write FOnClose; 266 269 end; 267 270 … … 1611 1614 end; 1612 1615 1616 procedure TEngine.ShowMenuItem(Key, Text: string; X, Y: Integer; Canvas: TCanvas); 1617 begin 1618 Canvas.TextOut(X, Y, '<' + Key + '>'); 1619 Canvas.TextOut(X + 140, Y, Text); 1620 end; 1621 1613 1622 procedure TEngine.DrawMenu; 1614 1623 var … … 1644 1653 Font.Color := clPurple; 1645 1654 Font.Size := 20; 1646 Text := '<F1> ' + SStartGame; 1647 TextOut((MenuWidth - TextWidth(Text)) div 2, Bitmap.Height div 10 * 4, Text); 1648 Text := '<F2> ' + SInstructions; 1649 TextOut((MenuWidth - TextWidth(Text)) div 2, Bitmap.Height div 10 * 4 + 40, Text); 1650 Text := '<F3> ' + SInformation; 1651 TextOut((MenuWidth - TextWidth(Text)) div 2, Bitmap.Height div 10 * 4 + 80, Text); 1652 Text := '<Alt+F4> ' + SExit; 1653 TextOut((MenuWidth - TextWidth(Text)) div 2, Bitmap.Height div 10 * 4 + 120, Text); 1655 1656 ShowMenuItem('F1', SStartGame, MenuWidth div 2 - 180, Bitmap.Height div 10 * 4, Bitmap.Canvas); 1657 ShowMenuItem('F2', SInstructions, MenuWidth div 2 - 180, Bitmap.Height div 10 * 4 + 40, Bitmap.Canvas); 1658 ShowMenuItem('F3', SInformation, MenuWidth div 2 - 180, Bitmap.Height div 10 * 4 + 80, Bitmap.Canvas); 1659 ShowMenuItem('F10', SExit, MenuWidth div 2 - 180, Bitmap.Height div 10 * 4 + 120, Bitmap.Canvas); 1654 1660 1655 1661 Font.Color := clDarkGreen; … … 1947 1953 KeyF3 = 114; 1948 1954 KeyF4 = 115; 1955 KeyF10 = 121; 1949 1956 KeyEsc = 27; 1950 1957 var … … 1963 1970 if Key = KeyF3 then begin 1964 1971 State := gsInformation; 1972 end else 1973 if Key = KeyF10 then begin 1974 if Assigned(FOnClose) then FOnClose(Self); 1965 1975 end; 1966 1976 end else
Note:
See TracChangeset
for help on using the changeset viewer.