-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "player.hpp" | ||
|
||
namespace ui { | ||
|
||
player::player(sf::RenderWindow& window) : m_time(0), m_window(window) { | ||
// nothing | ||
} | ||
|
||
void player::update(int dt) { | ||
m_time += dt * 3; | ||
} | ||
|
||
void player::render() { | ||
// nothing | ||
} | ||
|
||
int player::get_time() const { | ||
return m_time; | ||
} | ||
|
||
void player::set_time(int t) { | ||
m_time = t; | ||
} | ||
|
||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
|
||
#include <SFML/Graphics/RenderWindow.hpp> | ||
|
||
namespace ui { | ||
|
||
class player { | ||
int m_time = 0; // milliseconds | ||
sf::RenderWindow& m_window; | ||
|
||
public: | ||
explicit player(sf::RenderWindow& window); | ||
|
||
void update(int dt); | ||
|
||
void render(); | ||
|
||
int get_time() const; | ||
|
||
void set_time(int t); | ||
}; | ||
|
||
} // namespace ui |