-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
9b309f9
commit 36e081e
Showing
8 changed files
with
68 additions
and
68 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
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 |
---|---|---|
@@ -1,53 +1,53 @@ | ||
/* | ||
** ShipWreck Engine v0.1, graphical library made to create games | ||
** Current file: Chronos.inl | ||
** Current file: Chrono.inl | ||
*/ | ||
|
||
inline sw::Chronos::Chronos(State state) : | ||
inline sw::Chrono::Chrono(State state) : | ||
m_isRunning(false) | ||
{ | ||
if (state == Lauch) { | ||
if (state == LAUNCH) { | ||
m_isRunning = true; | ||
start(); | ||
} | ||
} | ||
|
||
inline void sw::Chronos::start() | ||
inline void sw::Chrono::start() | ||
{ | ||
m_start = std::chrono::steady_clock::now(); | ||
m_end = m_start; | ||
m_tour = m_start; | ||
m_isRunning = true; | ||
} | ||
|
||
inline void sw::Chronos::stop() | ||
inline void sw::Chrono::stop() | ||
{ | ||
m_end = std::chrono::steady_clock::now(); | ||
m_isRunning = false; | ||
} | ||
|
||
inline void sw::Chronos::tour() | ||
inline void sw::Chrono::tour() | ||
{ | ||
m_tour = std::chrono::steady_clock::now(); | ||
} | ||
|
||
inline double sw::Chronos::getElapsedTime() const | ||
inline double sw::Chrono::getElapsedTime() const | ||
{ | ||
if (m_isRunning) | ||
m_end = std::chrono::steady_clock::now(); | ||
double step = (double)std::chrono::duration_cast<std::chrono::milliseconds>(m_end - m_tour).count(); | ||
return (step / 1000); | ||
} | ||
|
||
inline double sw::Chronos::getTotalTime() const | ||
inline double sw::Chrono::getTotalTime() const | ||
{ | ||
if (m_isRunning) | ||
m_end = std::chrono::steady_clock::now(); | ||
double step = (double)std::chrono::duration_cast<std::chrono::milliseconds>(m_end - m_start).count(); | ||
return (step / 1000); | ||
} | ||
|
||
inline bool sw::Chronos::isRunning() const | ||
inline bool sw::Chrono::isRunning() const | ||
{ | ||
return (m_isRunning); | ||
} |
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