Changeset 4


Ignore:
Timestamp:
Feb 8, 2014, 11:35:27 PM (11 years ago)
Author:
chronos
Message:
  • Added: Main menu with game control actions.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.lfm

    r3 r4  
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 621
     7  ClientHeight = 595
    88  ClientWidth = 775
     9  Menu = MainMenu1
    910  OnCreate = FormCreate
    1011  OnDestroy = FormDestroy
     
    1314  object PaintBox1: TPaintBox
    1415    Left = 0
    15     Height = 621
     16    Height = 595
    1617    Top = 0
    1718    Width = 775
     
    2324    OnPaint = PaintBox1Paint
    2425  end
     26  object MainMenu1: TMainMenu
     27    left = 72
     28    top = 48
     29    object MenuItem1: TMenuItem
     30      Caption = 'Game'
     31      object MenuItem2: TMenuItem
     32        Action = AGameNew
     33      end
     34      object MenuItem3: TMenuItem
     35        Action = AGameEnd
     36      end
     37      object MenuItem4: TMenuItem
     38        Action = AGameEndTurn
     39      end
     40      object MenuItem5: TMenuItem
     41        Caption = '-'
     42      end
     43      object MenuItem6: TMenuItem
     44        Action = AExit
     45      end
     46    end
     47  end
     48  object ActionList1: TActionList
     49    left = 223
     50    top = 49
     51    object AGameNew: TAction
     52      Caption = 'New'
     53      OnExecute = AGameNewExecute
     54    end
     55    object AExit: TAction
     56      Caption = 'Exit'
     57      OnExecute = AExitExecute
     58    end
     59    object AGameEnd: TAction
     60      Caption = 'End'
     61    end
     62    object AGameEndTurn: TAction
     63      Caption = 'End turn'
     64    end
     65  end
    2566end
  • trunk/UFormMain.pas

    r3 r4  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   UGame, LCLType;
     9  UGame, LCLType, Menus, ActnList;
    1010
    1111type
     
    1414
    1515  TFormMain = class(TForm)
     16    AGameEndTurn: TAction;
     17    AGameEnd: TAction;
     18    AExit: TAction;
     19    AGameNew: TAction;
     20    ActionList1: TActionList;
     21    MainMenu1: TMainMenu;
     22    MenuItem1: TMenuItem;
     23    MenuItem2: TMenuItem;
     24    MenuItem3: TMenuItem;
     25    MenuItem4: TMenuItem;
     26    MenuItem5: TMenuItem;
     27    MenuItem6: TMenuItem;
    1628    PaintBox1: TPaintBox;
     29    procedure AExitExecute(Sender: TObject);
     30    procedure AGameNewExecute(Sender: TObject);
    1731    procedure FormCreate(Sender: TObject);
    1832    procedure FormDestroy(Sender: TObject);
     
    5670begin
    5771  Game := TGame.Create;
     72end;
     73
     74procedure TFormMain.AExitExecute(Sender: TObject);
     75begin
     76  Application.Terminate;
     77end;
     78
     79procedure TFormMain.AGameNewExecute(Sender: TObject);
     80begin
     81  Game.New;
     82  PaintBox1.Repaint;
    5883end;
    5984
  • trunk/UGame.pas

    r3 r4  
    3434    procedure Paint(Canvas: TCanvas; Rect: TRect);
    3535    constructor Create;
     36    destructor Destroy; override;
    3637    procedure Init(Size: TPoint);
    3738  end;
     
    200201end;
    201202
     203destructor TMap.Destroy;
     204begin
     205  Init(0, 0);
     206  inherited Destroy;
     207end;
     208
    202209procedure TMap.Init(Size: TPoint);
    203210var
Note: See TracChangeset for help on using the changeset viewer.