quickhull/Display.h

48 lines
996 B
C++

#pragma once
#ifndef DISPLAY_H
// 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 "Line.h"
//class Point;
//class Line;
#define OFFSET 10.f
#define WIDTH 800
#define HEIGHT 600
class Display
{
private:
int m_stepSize;
sf::Font m_font;
sf::Text m_textStatus;
//std::vector<Point> m_points;
std::vector<sf::CircleShape> m_points;
std::vector<sf::Text> m_labels;
//sf::VertexArray m_points;
//sf::VertexArray m_labels;
//std::vector<sf::Vertex> m_hull;
sf::VertexArray m_hull;
sf::ConvexShape m_convex;
//std::map<Line, std::vector<Point> > m_pointsForLine;
std::vector<Line> m_lines;
Line *m_curLine = nullptr;
unsigned int m_step = 0;
void update();
void render(sf::RenderWindow &);
public:
Display(const std::vector<Point> &, int stepSize = 0);
void show();
};
#endif // DISPLAY_H