-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
38 lines (28 loc) · 774 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include "include/Core/Application.hpp"
int main()
{
Shock::Core::Application app ;
try
{
sf::Clock deltaClock ;
sf::Time lastUpdate = sf::Time::Zero ;
while ( app.isRunning() )
{
sf::Time timePerFrame = sf::seconds( 1.f / app.getMaxFps() ) ;
lastUpdate += deltaClock.restart() ;
while ( lastUpdate > timePerFrame )
{
lastUpdate -= timePerFrame ;
app.processInput() ;
app.update( timePerFrame ) ;
app.render() ;
}
}
}
catch( std::exception& e )
{
std::cout << "Exception when running application: " << e.what() << std::endl ;
}
return 0 ;
}