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