quickhull/Display.h

46 lines
1.1 KiB
C
Raw Permalink Normal View History

2020-11-18 18:01:57 +01:00
#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>
2020-11-18 18:01:57 +01:00
#include "Line.h"
2020-11-27 03:09:50 +01:00
#define OFFSET 10.f
2020-11-18 18:01:57 +01:00
#define WIDTH 800
#define HEIGHT 600
class Display
{
2020-11-19 09:46:02 +01:00
private:
int m_stepSize;
bool m_useAkl;
sf::Font m_font;
sf::Text m_textStatus;
2020-11-27 03:09:50 +01:00
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;
2020-11-30 20:11:16 +01:00
//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
2020-11-27 03:09:50 +01:00
unsigned int m_step = 0;
void setCurrentLine();
void update();
2020-11-27 03:09:50 +01:00
void render(sf::RenderWindow &);
2020-11-19 09:46:02 +01:00
2020-11-18 18:01:57 +01:00
public:
Display(const std::vector<Point> &, int stepSize = 0, bool akl = false);
2020-11-18 18:01:57 +01:00
void show();
};
#endif // DISPLAY_H