-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
45 lines (40 loc) · 1.4 KB
/
Main.cpp
File metadata and controls
45 lines (40 loc) · 1.4 KB
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
39
40
41
42
43
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include "GameplayManager.hpp"
using namespace StrategyGoo;
void PrintRect( sf::IntRect rect )
{
std::cout << rect.left << ", " << rect.top <<
", " << rect.width << ", " << rect.height << "\n";
}
int main( int argc, char** args )
{
sf::RenderWindow window( sf::VideoMode( 1024, 768 ), "sf::RenderWindow" );
entt::registry registry;
GameplayManager manager{ registry };
manager.CreateEntity< Squaddie >( BoardPosition( 1, 1 ) ).RefrenceSprite().SetCurrentDirection( Direction::SOUTH );
manager.CreateEntity< Squaddie >( BoardPosition( 4, 1 ) ).RefrenceSprite().SetCurrentDirection( Direction::NORTH );
manager.CreateEntity< Squaddie >( BoardPosition( 1, 3 ) ).RefrenceSprite().SetCurrentDirection( Direction::WEST );
Goo& goo = manager.CreateEntity< Goo >( BoardPosition( 8, 8 ) );
Goo::GooComponent& splot = goo.AddGoo( BoardPosition( 8, 9 ) );
goo.AddGoo( BoardPosition( 8, 10 ) );
sf::Clock frameRateController;
float frameRate = 1.f / 60.f;
sf::View camera = window.getDefaultView();
// camera.move( )
while( window.isOpen() )
{
sf::Event event;
while( window.pollEvent( event ) ) {
if( event.type == sf::Event::Closed )
window.close();
}
manager.Update( window );
if( frameRateController.getElapsedTime().asSeconds() >= frameRate ) {
frameRateController.restart();
manager.Render( window );
}
}
return 0;
}