quickhull/Display.h

46 lines
1.1 KiB
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 <list>
#include "Line.h"
#define OFFSET 10.f
#define WIDTH 800
#define HEIGHT 600
class Display
{
private:
int m_stepSize;
bool m_useAkl;
sf::Font m_font;
sf::Text m_textStatus;
std::vector<sf::CircleShape> m_points;
std::vector<sf::Text> m_labels;
std::vector<sf::CircleShape> m_hullPoints;
std::vector<Line> m_lines;
//std::list<Line> m_lines;
//Line *m_curLine = nullptr; // get any value if the underlying vector gets resized and moved in memory -> thus, use list
Line m_curLine; // -> either make a copy
int m_curLineIdx = -1; // or just use index
unsigned int m_step = 0;
void setCurrentLine();
void update();
void render(sf::RenderWindow &);
public:
Display(const std::vector<Point> &, int stepSize = 0, bool akl = false);
void show();
};
#endif // DISPLAY_H