diff --git a/Display.cpp b/Display.cpp index e9acf23..3596edb 100644 --- a/Display.cpp +++ b/Display.cpp @@ -6,13 +6,11 @@ #include #include "Display.h" +#include "Point.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; @@ -23,7 +21,18 @@ void Display::show() } window.clear(); - window.draw(shape); + 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 pts) +{ + m_points = pts; } \ No newline at end of file diff --git a/Display.h b/Display.h index 761bafc..9ab88ca 100644 --- a/Display.h +++ b/Display.h @@ -1,13 +1,17 @@ #pragma once +class Point; + #define WIDTH 800 #define HEIGHT 600 class Display { +private: + std::vector m_points; + public: void show(); - // TODO: - // setData for used stuff... current triangle, all points, ladida... + void setData (std::vector); }; \ No newline at end of file diff --git a/main.cpp b/main.cpp index a0d1ded..a0efeff 100644 --- a/main.cpp +++ b/main.cpp @@ -9,6 +9,17 @@ #include "Point.h" // TODO: check if there is a usable SFML or c++ class #include "Timing.h" +// TODOs: +// - use SFML vec2 instead of Point class +// - calc min and max points for x, y +// *) just a loop and save/override points -> maybe in Data Block? +// *) std::minmax_element for x, y -> not saving just temp draw +// https://en.cppreference.com/w/cpp/algorithm/minmax_element +// - actual algorithm :p +// - architecture: +// # vis in own thread, calls "lib" functions? +// # seperate implementation for vis and perf? + int main (int argc, char **argv) { // read program arguments @@ -65,6 +76,7 @@ int main (int argc, char **argv) } } + // TODO: need sort here? for (Point& pt : points) { std::cout << "pt: " << pt.x() << ", " << pt.y() << std::endl; @@ -72,7 +84,9 @@ int main (int argc, char **argv) if (vis) { + // TODO: use data as ctor argument? pointer? Display display; + display.setData(points); display.show(); }