Fix major incorrect usage of mrb class definitions causing segfaults
This commit is contained in:
+11
-1
@@ -14,6 +14,11 @@ struct Font {
|
||||
bool pixel_art;
|
||||
};
|
||||
|
||||
struct Text {
|
||||
SDL_Texture *texture;
|
||||
Vec2<float> size;
|
||||
};
|
||||
|
||||
struct Event {
|
||||
enum Type {
|
||||
NONE,
|
||||
@@ -57,8 +62,11 @@ struct Animation {
|
||||
std::vector<int> frames;
|
||||
float frame_rate;
|
||||
bool loop;
|
||||
int reference_count = 0;
|
||||
};
|
||||
|
||||
inline Pool<Animation> animation_pool;
|
||||
|
||||
struct Window {
|
||||
public:
|
||||
// title can be free'd by the caller after the window is created, as it's copied internally.
|
||||
@@ -70,10 +78,12 @@ public:
|
||||
|
||||
// Rendering functions
|
||||
int load_image(const char *path, float alpha = 1.0f, bool pixel_art = false);
|
||||
void use_image(int image_id);
|
||||
void unload_image(int image_id);
|
||||
Vec2<float> get_image_size(int image_id);
|
||||
|
||||
int load_font(const char *path, int font_size, bool bold = false, bool italic = false, bool underline = false, bool pixel_art = false);
|
||||
void use_font(int font_id);
|
||||
void unload_font(int font_id);
|
||||
|
||||
// text is copied internally, so it can be free'd by the caller after the text is created.
|
||||
@@ -135,7 +145,7 @@ private:
|
||||
Pool<Font> font_pool;
|
||||
|
||||
// Text pool
|
||||
Pool<SDL_Texture *> text_pool;
|
||||
Pool<Text> text_pool;
|
||||
|
||||
struct RenderInstruction {
|
||||
enum Type {
|
||||
|
||||
Reference in New Issue
Block a user