Description:
Add draw time counter.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r3:38799b4d7ed7 -

@@ -8,6 +8,7
8 8 using System.IO;
9 9 using SpriteFontPlus;
10 10 using isometricparkfna;
11 using System.Diagnostics;
11 12
12 13 struct Entity
13 14 {
@@ -63,6 +64,7
63 64 int frameRate = 0;
64 65 int frameCounter = 0;
65 66 TimeSpan elapsedTime = TimeSpan.Zero;
67 TimeSpan drawTime = TimeSpan.Zero;
66 68
67 69 private const int width = 1280;
68 70 private const int height = 640;
@@ -85,8 +87,8
85 87
86 88 //new tile stuff
87 89 TileMap myMap = new TileMap();
88 int squaresAcross = 25;
89 int squaresDown = 25;
90 int squaresAcross = 250;
91 int squaresDown = 250;
90 92 int baseOffsetX = -14;
91 93 int baseOffsetY = -14;
92 94
@@ -283,6 +285,9
283 285 frameCounter = 0;
284 286 }
285 287
288
289
290
286 291 base.Update(gameTime);
287 292
288 293
@@ -316,15 +321,11
316 321
317 322
318 323
319
324 Stopwatch stopWatch = new Stopwatch();
325 stopWatch.Start();
320 326 GraphicsDevice.Clear(Color.CornflowerBlue);
321 327 batch.Begin();
322 328
323 Line.drawLine(batch, new Vector2(0, 1), new Vector2(1, 50), Color.Black);
324 Line.drawLine(batch, new Vector2(0, 50), new Vector2(1, 100), Color.White);
325 Line.drawLine(batch, new Vector2(500, 500), new Vector2(500, 1000), Color.White);
326
327
328 329 //New tile stuff
329 330 Vector2 firstSquare = new Vector2(Camera.Location.X / 32,
330 331 Camera.Location.Y / 32);
@@ -337,7 +338,6
337 338 int offsetX = (int)squareOffset.X;
338 339 int offsetY = (int)squareOffset.Y;
339 340
340
341 341 for (int y = 0; y < this.squaresDown; y++)
342 342 {
343 343 int rowOffset = 0;
@@ -356,8 +356,8
356 356 Color.White);
357 357 }
358 358 }
359
359 360
360
361 361
362 362 //Gridlines
363 363 //Lines going down and to the right:
@@ -408,7 +408,12
408 408
409 409 batch.DrawString(font, fps, new Vector2(33, 33), Color.Black);
410 410 batch.DrawString(font, fps, new Vector2(32, 32), Color.White);
411 batch.DrawString(font, this.drawTime.TotalMilliseconds.ToString(), new Vector2(120, 33), Color.Black);
412 batch.DrawString(font, this.drawTime.TotalMilliseconds.ToString(), new Vector2(119, 32), Color.White);
413
411 414 batch.End();
415 stopWatch.Stop();
416 this.drawTime = stopWatch.Elapsed;
412 417
413 418 base.Draw(gameTime);
414 419 }
@@ -73,5 +73,8
73 73 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
74 74 </None>
75 75 </ItemGroup>
76 <ItemGroup>
77 <Reference Include="System" />
78 </ItemGroup>
76 79 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
77 80 </Project>
You need to be logged in to leave comments. Login now