Add ruby bindings for internal structures, allow better controlled localization

This commit is contained in:
2026-05-06 22:01:48 +01:00
parent 3894b90398
commit 65109cc3c4
8 changed files with 1047 additions and 114 deletions
+6 -7
View File
@@ -83,8 +83,6 @@ struct Event {
struct Animation {
std::vector<uint64_t> frames;
float frame_rate;
bool loop;
int reference_count = 0;
~Animation() {
for (uint64_t frame_id : frames)
@@ -104,20 +102,20 @@ public:
~Window();
// Rendering functions
uint64_t load_image(const char *path, float alpha = 1.0f, bool pixel_art = false);
uint64_t load_image(const char *path, bool pixel_art);
Vec2<float> get_image_size(uint64_t image_id);
uint64_t load_font(const char *path, int font_size, bool bold = false, bool italic = false, bool underline = false, bool pixel_art = false);
uint64_t load_font(const char *path, int font_size, bool bold, bool italic, bool underline, bool pixel_art);
// text is copied internally, so it can be free'd by the caller after the text is created.
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);
bool write(uint64_t text_id, Vec2<float> position, float z, float angle = 0.0f, Vec2<float> scale = {1.0f, 1.0f});
bool write(uint64_t text_id, Vec2<float> position, float z, float angle, Vec2<float> scale, float alpha);
bool draw(uint64_t image_id, Vec2<float> position, float z, float angle = 0.0f, Vec2<float> scale = {1.0f, 1.0f});
bool draw(uint64_t image_id, Vec2<float> position, float z, float angle, Vec2<float> scale, float alpha);
bool draw_rect(Rect rect, Color color, float z, float angle = 0.0f);
bool draw_rect(Rect rect, Color color, float z, float angle, Vec2<float> scale, float alpha);
void render(); // the rest of the calls only build the instruction list, this actually renders everything added to the screen (following z order)
@@ -170,6 +168,7 @@ private:
float z;
float angle;
Vec2<float> scale;
float alpha;
union {
struct {