Changeset 6


Ignore:
Timestamp:
Feb 9, 2014, 9:53:30 PM (11 years ago)
Author:
chronos
Message:
  • Added: New game parameters form.
  • Added: Preparaton for cell mouse selection.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.lfm

    r5 r6  
    3737        Action = AGameEnd
    3838      end
     39      object MenuItem7: TMenuItem
     40        Action = AGameRestart
     41      end
    3942      object MenuItem4: TMenuItem
    4043        Action = AGameEndTurn
     
    6568      Caption = 'End turn'
    6669    end
     70    object AGameRestart: TAction
     71      Caption = 'Restart'
     72    end
    6773  end
    6874end
  • trunk/UFormMain.pas

    r5 r6  
    1717
    1818  TFormMain = class(TForm)
     19    AGameRestart: TAction;
    1920    AGameEndTurn: TAction;
    2021    AGameEnd: TAction;
     
    2930    MenuItem5: TMenuItem;
    3031    MenuItem6: TMenuItem;
     32    MenuItem7: TMenuItem;
    3133    PaintBox1: TPaintBox;
    3234    procedure AExitExecute(Sender: TObject);
     
    6163implementation
    6264
     65uses
     66  UFormNew;
     67
    6368{$R *.lfm}
    6469
     
    8691procedure TFormMain.AGameNewExecute(Sender: TObject);
    8792begin
    88   Game.New;
    89   PaintBox1.Repaint;
     93  FormNew.Load(Game);
     94  if FormNew.ShowModal = mrOk then begin
     95    FormNew.Save(Game);
     96    Game.New;
     97    PaintBox1.Repaint;
     98  end;
    9099end;
    91100
     
    103112  Shift: TShiftState; X, Y: Integer);
    104113begin
    105   StartMousePoint := Point(X, Y);
    106   StartViewPoint := Point(TPlayer(Game.Players[0]).View.Left, TPlayer(Game.Players[0]).View.Top);
    107   MoveActive := True;
     114  if Button = mbLeft then begin
     115    StartMousePoint := Point(X, Y);
     116    StartViewPoint := Point(TPlayer(Game.Players[0]).View.Left, TPlayer(Game.Players[0]).View.Top);
     117    MoveActive := True;
     118  end;
    108119end;
    109120
     
    121132      TPlayer(Game.Players[0]).View.Right - TPlayer(Game.Players[0]).View.Left,
    122133      TPlayer(Game.Players[0]).View.Bottom - TPlayer(Game.Players[0]).View.Top);
     134    TPlayer(Game.Players[0]).SelectCell(Point(X, Y));
    123135    PaintBox1.Repaint;
    124136  end;
    125   Caption := IntToStr(TPlayer(Game.Players[0]).View.Right - TPlayer(Game.Players[0]).View.Left);
    126137end;
    127138
  • trunk/UGame.pas

    r5 r6  
    4646    Color: TColor;
    4747    ViewZoom: Double;
     48    SelectedCell: TPoint;
     49    procedure SelectCell(Pos: TPoint);
    4850    procedure Paint(PaintBox: TPaintBox);
    4951    constructor Create;
     
    5557    Players: TObjectList;
    5658    Map: TMap;
     59    VoidEnabled: Boolean;
    5760    constructor Create;
    5861    destructor Destroy; override;
     
    7881
    7982{ TPlayer }
     83
     84procedure TPlayer.SelectCell(Pos: TPoint);
     85begin
     86
     87end;
    8088
    8189procedure TPlayer.Paint(PaintBox: TPaintBox);
     
    128136  for X := 0 to Length(Map.Cells[0]) - 1 do
    129137  with Map.Cells[Y, X] do begin
    130     if Random(2) = 0 then Terrain := ttVoid
     138    if VoidEnabled and (Random(2) = 0) then Terrain := ttVoid
    131139      else Terrain := ttNormal;
    132140    Power := Random(4);
  • trunk/xtactics.lpi

    r3 r6  
    3333      </Item1>
    3434    </RequiredPackages>
    35     <Units Count="3">
     35    <Units Count="4">
    3636      <Unit0>
    3737        <Filename Value="xtactics.lpr"/>
     
    5252        <UnitName Value="UGame"/>
    5353      </Unit2>
     54      <Unit3>
     55        <Filename Value="UFormNew.pas"/>
     56        <IsPartOfProject Value="True"/>
     57        <ComponentName Value="FormNew"/>
     58        <ResourceBaseClass Value="Form"/>
     59        <UnitName Value="UFormNew"/>
     60      </Unit3>
    5461    </Units>
    5562  </ProjectOptions>
  • trunk/xtactics.lpr

    r2 r6  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UGame
     10  Forms, UFormMain, UGame, UFormNew
    1111  { you can add units after this };
    1212
     
    1717  Application.Initialize;
    1818  Application.CreateForm(TFormMain, FormMain);
     19  Application.CreateForm(TFormNew, FormNew);
    1920  Application.Run;
    2021end.
Note: See TracChangeset for help on using the changeset viewer.