quickhull/Display.cpp

38 lines
884 B
C++

// 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"
#include "Point.h"
void Display::show()
{
sf::RenderWindow window(sf::VideoMode(WIDTH, HEIGHT), "SFML works!");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
for (auto &pt : m_points)
{
sf::CircleShape shape(10.f);
shape.setPosition(pt.x(), pt.y());
shape.setFillColor(sf::Color::Green);
window.draw(shape);
}
window.display();
}
}
void Display::setData(std::vector<Point> pts)
{
m_points = pts;
}