Separate drawing out to view.cpp

This commit is contained in:
2023-03-30 23:49:36 +01:00
parent dbb69dd80e
commit b9470696f6
3 changed files with 43 additions and 17 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <SFML/Graphics.hpp>
#include "view.h"
static sf::Uint32 style = sf::Style::Titlebar;
static sf::RenderWindow window(sf::VideoMode(1600, 900), "SFML works!", style);
static sf::CircleShape shape(450.f);
int view_init()
{
shape.setFillColor(sf::Color::Green);
return 1;
}
int view_update()
{
if (!window.isOpen()) return 0;
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
return 0;
}
}
window.clear();
window.draw(shape);
window.display();
return 1;
}