- Timestamp:
- Mar 1, 2014, 11:18:26 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 lib 4 4 xtactics.res 5 xtactics.dbg
-
- Property svn:ignore
-
trunk/UFormMain.lfm
r9 r20 26 26 OnMouseWheelUp = PaintBox1MouseWheelUp 27 27 OnPaint = PaintBox1Paint 28 OnResize = PaintBox1Resize 28 29 end 29 30 object MainMenu1: TMainMenu … … 67 68 object AGameEnd: TAction 68 69 Caption = 'End' 70 OnExecute = AGameEndExecute 69 71 ShortCut = 16454 70 72 end … … 76 78 object AGameRestart: TAction 77 79 Caption = 'Restart' 80 OnExecute = AGameRestartExecute 78 81 ShortCut = 16466 79 82 end -
trunk/UFormMain.pas
r19 r20 34 34 Timer1: TTimer; 35 35 procedure AExitExecute(Sender: TObject); 36 procedure AGameEndExecute(Sender: TObject); 36 37 procedure AGameEndTurnExecute(Sender: TObject); 37 38 procedure AGameNewExecute(Sender: TObject); 39 procedure AGameRestartExecute(Sender: TObject); 38 40 procedure FormCreate(Sender: TObject); 39 41 procedure FormDestroy(Sender: TObject); … … 52 54 procedure PaintBox1Paint(Sender: TObject); 53 55 procedure EraseBackground(DC: HDC); override; 56 procedure PaintBox1Resize(Sender: TObject); 54 57 procedure Timer1Timer(Sender: TObject); 55 58 private … … 79 82 procedure TFormMain.PaintBox1Paint(Sender: TObject); 80 83 begin 84 if Game.Running then 81 85 with Game.CurrentPlayer do begin 82 86 View := Bounds(View.Left, View.Top, PaintBox1.Width, … … 88 92 procedure TFormMain.EraseBackground(DC: HDC); 89 93 begin 94 end; 95 96 procedure TFormMain.PaintBox1Resize(Sender: TObject); 97 begin 98 if Assigned(Game.CurrentPlayer) then 99 with Game.CurrentPlayer do 100 View := Bounds(View.Left + (View.Right - View.Left) div 2 - PaintBox1.Width div 2, 101 View.Top + (View.Bottom - View.Top) div 2 - PaintBox1.Height div 2, 102 PaintBox1.Width, PaintBox1.Height); 103 Redraw; 90 104 end; 91 105 … … 134 148 end; 135 149 150 procedure TFormMain.AGameEndExecute(Sender: TObject); 151 begin 152 Game.Running := False; 153 Redraw; 154 end; 155 136 156 procedure TFormMain.AGameEndTurnExecute(Sender: TObject); 137 157 begin … … 150 170 FormNew.Save(Game); 151 171 Game.New; 172 Game.Running := True; 152 173 Redraw; 153 174 end; 175 end; 176 177 procedure TFormMain.AGameRestartExecute(Sender: TObject); 178 begin 179 Game.New; 180 Game.Running := True; 181 Redraw; 154 182 end; 155 183 -
trunk/UGame.pas
r19 r20 112 112 FOnMove: TMoveEvent; 113 113 FOnWin: TWinEvent; 114 FRunning: Boolean; 114 115 procedure MoveAll(Player: TPlayer); 115 116 procedure SetMove(CellFrom, CellTo: TCell); 117 procedure SetRunning(AValue: Boolean); 116 118 public 117 119 Players: TPlayers; … … 121 123 Moves: TObjectList; // TList<TMove> 122 124 TurnCounter: Integer; 123 Running: Boolean; 125 124 126 procedure ComputePlayerStats; 125 127 procedure NextTurn; … … 127 129 destructor Destroy; override; 128 130 procedure New; 131 property Running: Boolean read FRunning write SetRunning; 129 132 published 130 133 property OnMove: TMoveEvent read FOnMove write FOnMove; … … 343 346 end; 344 347 348 procedure TGame.SetRunning(AValue: Boolean); 349 begin 350 if FRunning = AValue then Exit; 351 if AValue then begin 352 if Players.Count < 2 then raise Exception.Create('You need at least two players'); 353 FRunning := AValue; 354 end else FRunning := AValue; 355 end; 356 345 357 procedure TGame.ComputePlayerStats; 346 358 var … … 454 466 end; 455 467 CurrentPlayer := TPlayer(Players[0]); 456 Running := True;457 468 end; 458 469 -
trunk/xtactics.lpi
r15 r20 12 12 </General> 13 13 <i18n> 14 <EnableI18N LFM="False"/> 14 <EnableI18N Value="True"/> 15 <OutDir Value="Languages"/> 15 16 </i18n> 16 17 <VersionInfo> 17 18 <StringTable ProductVersion=""/> 18 19 </VersionInfo> 19 <BuildModes Count="1"> 20 <Item1 Name="Default" Default="True"/> 20 <BuildModes Count="2"> 21 <Item1 Name="Debug" Default="True"/> 22 <Item2 Name="Release"> 23 <CompilerOptions> 24 <Version Value="11"/> 25 <Target> 26 <Filename Value="xtactics"/> 27 </Target> 28 <SearchPaths> 29 <IncludeFiles Value="$(ProjOutDir)"/> 30 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 31 </SearchPaths> 32 <Parsing> 33 <SyntaxOptions> 34 <SyntaxMode Value="Delphi"/> 35 <CStyleOperator Value="False"/> 36 <AllowLabel Value="False"/> 37 <CPPInline Value="False"/> 38 </SyntaxOptions> 39 </Parsing> 40 <CodeGeneration> 41 <SmartLinkUnit Value="True"/> 42 <Optimizations> 43 <OptimizationLevel Value="3"/> 44 </Optimizations> 45 </CodeGeneration> 46 <Linking> 47 <Debugging> 48 <GenerateDebugInfo Value="False"/> 49 </Debugging> 50 <LinkSmart Value="True"/> 51 <Options> 52 <Win32> 53 <GraphicApplication Value="True"/> 54 </Win32> 55 </Options> 56 </Linking> 57 <Other> 58 <CompilerMessages> 59 <MsgFileName Value=""/> 60 </CompilerMessages> 61 <CompilerPath Value="$(CompPath)"/> 62 </Other> 63 </CompilerOptions> 64 </Item2> 21 65 </BuildModes> 22 66 <PublishOptions> … … 82 126 <SyntaxOptions> 83 127 <SyntaxMode Value="Delphi"/> 128 <IncludeAssertionCode Value="True"/> 84 129 </SyntaxOptions> 85 130 </Parsing> 131 <CodeGeneration> 132 <Checks> 133 <IOChecks Value="True"/> 134 <RangeChecks Value="True"/> 135 <OverflowChecks Value="True"/> 136 <StackChecks Value="True"/> 137 </Checks> 138 <VerifyObjMethodCallValidity Value="True"/> 139 </CodeGeneration> 86 140 <Linking> 141 <Debugging> 142 <UseHeaptrc Value="True"/> 143 <UseExternalDbgSyms Value="True"/> 144 </Debugging> 87 145 <Options> 88 146 <Win32>
Note:
See TracChangeset
for help on using the changeset viewer.