Skip to content

Commit 4930281

Browse files
committed
fix snippet code
1 parent 2c1d3b7 commit 4930281

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

articles/tutorials/building_2d_games/05_game_components/snippets/framespersecondcounter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public FramesPerSecondCounter(Game game) : base(game)
3333
/// Updates the FPS calculation based on elapsed game time.
3434
/// </summary>
3535
/// <param name="gameTime">A snapshot of the game's timing values.</param>
36-
public override Update(GameTime gameTime)
36+
public override void Update(GameTime gameTime)
3737
{
3838
_elapsedTime += gameTime.ElapsedGameTime;
3939

@@ -48,7 +48,7 @@ public override Update(GameTime gameTime)
4848
/// <summary>
4949
/// Increments the frame counter. Should be called once per frame during the game's Draw method.
5050
/// </summary>
51-
public override Draw(GameTime gameTime)
51+
public override void Draw(GameTime gameTime)
5252
{
5353
// Increment the frame counter only during draw.
5454
_frameCounter++;

articles/tutorials/building_2d_games/05_game_components/snippets/game1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public Game1()
1717
IsMouseVisible = true;
1818

1919
// Create a new FramesPerSecondCounter.
20-
FramesPerSecondCounter fpsCounter = new FramesPerSecondCounter();
20+
FramesPerSecondCounter fpsCounter = new FramesPerSecondCounter(this);
2121

2222
// Add it to the game's component collection
2323
Components.Add(fpsCounter);

0 commit comments

Comments
 (0)