moved Rendering to Display class

This commit is contained in:
incredibleLeitman 2020-11-18 18:01:57 +01:00
parent a0db48c85f
commit 34bca9a567
2 changed files with 42 additions and 0 deletions

29
Display.cpp Normal file
View File

@ -0,0 +1,29 @@
// make sure sfml is installed:
// linux - sudo apt-get install libsfml-dev
// windows - manual dl from https://www.sfml-dev.org/download.php
#include <SFML/Graphics.hpp>
#include <iostream>
#include "Display.h"
void Display::show()
{
sf::RenderWindow window(sf::VideoMode(WIDTH, HEIGHT), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
}

13
Display.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#define WIDTH 800
#define HEIGHT 600
class Display
{
public:
void show();
// TODO:
// setData for used stuff... current triangle, all points, ladida...
};