Triangles/src/state.hpp

46 lines
930 B
C++
Raw Normal View History

2020-07-21 11:34:39 +00:00
#ifndef TRIANGLES_STATE_HPP
#define TRIANGLES_STATE_HPP
#include <bitset>
2020-07-21 11:44:10 +00:00
#include <vector>
2020-07-21 11:34:39 +00:00
#include <SFML/System.hpp>
2020-07-21 11:44:10 +00:00
#include <SFML/Graphics.hpp>
2020-07-21 11:34:39 +00:00
namespace Tri {
2020-07-22 06:19:37 +00:00
class State {
public:
State(int argc, char **argv);
~State();
2020-07-21 11:34:39 +00:00
/*
* 0 - display help
2020-07-22 06:19:37 +00:00
* 1 - is running
2020-07-21 11:34:39 +00:00
*/
2020-07-22 06:19:37 +00:00
private:
typedef std::bitset<64> BitsetType;
BitsetType flags;
unsigned int width;
unsigned int height;
2020-07-21 11:34:39 +00:00
const sf::Time dt;
sf::RenderWindow window;
2020-07-21 11:44:10 +00:00
std::vector<sf::ConvexShape> tris;
sf::ConvexShape currentTri;
enum CurrentState { NONE, FIRST, SECOND, THIRD } currentTri_state;
sf::Event event;
2020-07-22 06:19:37 +00:00
public:
void handle_events();
2020-07-21 11:34:39 +00:00
void update();
void draw();
2020-07-22 06:19:37 +00:00
unsigned int get_width();
unsigned int get_height();
const BitsetType get_flags() const;
2020-07-21 11:34:39 +00:00
};
}
#endif