summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..509f691
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,39 @@
+#include<SFML/Graphics.hpp>
+#include<cstdio>
+
+#include "graphics/animation.h"
+#include "entity.h"
+
+class Unit: public Entity{
+ public:
+ Graphics::Animation animation;
+
+ Unit(){
+ animation = Graphics::Animation("angle1.png", 6, 60);
+ };
+ ~Unit(){};
+};
+
+int main()
+{
+ sf::RenderWindow renderWindow(sf::VideoMode(640, 480), "Demo Game");
+
+ sf::Event event;
+ sf::Clock clock;
+ Unit unit;
+
+ renderWindow.setFramerateLimit(60);
+
+ while (renderWindow.isOpen()){
+ int dt = clock.getElapsedTime().asMilliseconds();
+ clock.restart();
+ while (renderWindow.pollEvent(event)){
+ if (event.type == sf::Event::EventType::Closed)
+ renderWindow.close();
+ }
+
+ renderWindow.clear();
+ renderWindow.draw(unit.animation.next(dt));
+ renderWindow.display();
+ }
+}