pushswap/visualizer/include/gui.h

40 lines
759 B
C
Raw Normal View History

2023-03-24 16:19:05 +01:00
#pragma once
#include "pushswap.h"
#include "queues.h"
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <list>
#include <string>
#include <vector>
class Gui {
private:
enum class STATE {Running, Reverse, Stopped};
Queues queues;
PushSwap pushswap;
std::vector<sf::RectangleShape> barsA;
std::vector<sf::RectangleShape> barsB;
int generateNumberSize;
std::string numbers;
int speed;
STATE state;
float scale;
void _updateControls();
void _drawBars();
void _animateQueue(sf::Clock &clock);
std::list<int> _generateValues(const unsigned int size);
void _updateBars();
sf::Color _rgb(const double ratio);
public:
sf::RenderWindow _window;
Gui();
~Gui();
void loop();
};