88 lines
1.3 KiB
C++
88 lines
1.3 KiB
C++
#ifndef CORE_H
|
|
#define CORE_H
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
#include <SFML/Graphics/Color.hpp>
|
|
#include <SFML/Graphics/Text.hpp>
|
|
#include <string>
|
|
|
|
enum class Side { left, right, none };
|
|
|
|
struct Vector2 {
|
|
float x;
|
|
float y;
|
|
};
|
|
|
|
struct AspectRatio {
|
|
int x;
|
|
int y;
|
|
};
|
|
|
|
struct TextData {
|
|
std::string content;
|
|
int size;
|
|
sf::Color color;
|
|
sf::Font *font;
|
|
};
|
|
|
|
|
|
|
|
struct Text {
|
|
sf::Font font;
|
|
sf::Text text;
|
|
Vector2 position;
|
|
|
|
void set_color(sf::Color color);
|
|
|
|
void set_font(std::string path);
|
|
|
|
void set_string(std::string str);
|
|
|
|
void set_size(int size);
|
|
|
|
void set_position(Vector2 pos);
|
|
|
|
void set_origin(Vector2 origin);
|
|
|
|
sf::FloatRect get_rect();
|
|
};
|
|
|
|
struct Entity {
|
|
sf::Texture texture;
|
|
sf::Sprite sprite;
|
|
Vector2 position;
|
|
|
|
void set_texture(std::string texture);
|
|
|
|
void set_position(Vector2 pos);
|
|
|
|
void set_origin(Vector2 origin);
|
|
|
|
Vector2 get_position();
|
|
|
|
void set_rotation(int angle);
|
|
};
|
|
|
|
struct Player : public Entity {
|
|
Side side = Side::left;
|
|
};
|
|
|
|
struct Actor : public Entity {
|
|
bool active = false;
|
|
float speed = 0.0f;
|
|
};
|
|
|
|
struct Log : public Actor {
|
|
float speed_x = 1000;
|
|
float speed_y = -1500;
|
|
};
|
|
|
|
void update_branches(int seed);
|
|
|
|
void draw(sf::RenderWindow *window, Entity *entity);
|
|
|
|
void draw(sf::RenderWindow *window, Text *text);
|
|
|
|
|
|
#endif // CORE_H
|