Remove element script and allow images to be pixel updated for similar behaviour

This commit is contained in:
2026-06-05 11:00:15 +01:00
parent e7418fde08
commit 419e95ac89
9 changed files with 177 additions and 518 deletions
+3 -19
View File
@@ -32,15 +32,6 @@ struct Text {
}
};
struct Scripted {
SDL_Texture *texture;
Vec2<float> size;
~Scripted() {
SDL_DestroyTexture(texture);
}
};
// Image pool
inline Pool<Image> image_pool;
@@ -50,9 +41,6 @@ inline Pool<Font> font_pool;
// Text pool
inline Pool<Text> text_pool;
// Scripted pool
inline Pool<Scripted> scripted_pool;
struct Event {
enum Type {
NONE,
@@ -111,7 +99,9 @@ public:
// Rendering functions
uint64_t load_image(const char *path, bool pixel_art);
uint64_t create_image(Vec2<float> size, bool pixel_art);
Vec2<float> get_image_size(uint64_t image_id);
bool update_image(uint64_t image_id, Rect content_rect, const char *new_content, uint32_t length);
uint64_t load_font(const char *path, int font_size, bool bold, bool italic, bool underline, bool pixel_art);
@@ -119,11 +109,6 @@ public:
uint64_t create_text(uint64_t font_id, const char *text, uint32_t length, Color color);
Vec2<float> get_text_size(uint64_t text_id);
uint64_t create_scripted(Vec2<float> size, bool pixel_art);
Vec2<float> get_scripted_size(uint64_t scripted_id);
bool update_scripted(uint64_t scripted_id, Rect content_rect, const char *new_content, uint32_t length);
bool write(uint64_t text_id, Vec2<float> position, float z, float angle, Vec2<float> pivot, Vec2<float> scale, float alpha);
bool draw(uint64_t image_id, Vec2<float> position, float z, float angle, Vec2<float> pivot, Vec2<float> scale, float alpha);
@@ -166,8 +151,7 @@ private:
enum Type {
DRAW_IMAGE,
DRAW_TEXT,
DRAW_RECT,
DRAW_SCRIPTED
DRAW_RECT
} type;
float z;