48 lines
974 B
C++
48 lines
974 B
C++
#pragma once
|
|
#include <raylib.h>
|
|
#include <iostream>
|
|
#include "Morault_Player.h"
|
|
#include <vector>
|
|
namespace Morault {
|
|
namespace UI {
|
|
|
|
typedef enum {
|
|
BL, // bottom left
|
|
BR, // bottom right
|
|
TL, // top left
|
|
TR, // top right
|
|
CN // center
|
|
} Anchor;
|
|
class CanvasElement {
|
|
public:
|
|
int posx, posy;
|
|
Anchor anchor;
|
|
virtual void Draw(Morault::Gameplay::Player player) = 0;
|
|
};
|
|
class Image : public CanvasElement {
|
|
public:
|
|
int posx, posy;
|
|
Anchor anchor;
|
|
std::string src;
|
|
float scale;
|
|
void Draw(Morault::Gameplay::Player player);
|
|
};
|
|
class Text : public CanvasElement {
|
|
public:
|
|
int posx, posy;
|
|
Anchor anchor;
|
|
std::string text;
|
|
int size;
|
|
Color color;
|
|
void Draw(Morault::Gameplay::Player player);
|
|
};
|
|
class Canvas {
|
|
std::vector<std::shared_ptr<CanvasElement>> elements;
|
|
public:
|
|
Canvas();
|
|
Canvas(std::string canvasfile);
|
|
void DrawCanvas(Morault::Gameplay::Player player);
|
|
~Canvas();
|
|
};
|
|
}
|
|
} |