added TODO list; drawing points
This commit is contained in:
parent
e16e3d588e
commit
cde73ff4c1
17
Display.cpp
17
Display.cpp
@ -6,13 +6,11 @@
|
||||
#include <iostream>
|
||||
|
||||
#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<Point> pts)
|
||||
{
|
||||
m_points = pts;
|
||||
}
|
@ -1,13 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
class Point;
|
||||
|
||||
#define WIDTH 800
|
||||
#define HEIGHT 600
|
||||
|
||||
class Display
|
||||
{
|
||||
private:
|
||||
std::vector<Point> m_points;
|
||||
|
||||
public:
|
||||
void show();
|
||||
|
||||
// TODO:
|
||||
// setData for used stuff... current triangle, all points, ladida...
|
||||
void setData (std::vector<Point>);
|
||||
};
|
14
main.cpp
14
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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user