bugs and perfomance cleanup.

This commit is contained in:
2026-05-21 21:56:36 +01:00
parent 582b2fcd9e
commit 872d878ddc
6 changed files with 149 additions and 10 deletions
+4 -2
View File
@@ -65,6 +65,7 @@ static mrb_value params_set(mrb_state *mrb, mrb_value self) {
app::EText *element = (app::EText *)app::element_pool[id];
element->params[mrb_sym2name(mrb, key)] = mrb_str_to_cstr(mrb, mrb_obj_as_string(mrb, value));
element->reload_text();
return mrb_nil_value();
}
@@ -509,7 +510,7 @@ static mrb_value element_text_inspect(mrb_state *mrb, mrb_value self) {
static mrb_value element_text_to_s(mrb_state *mrb, mrb_value self) {
uint64_t id = get_id_ElementText(mrb, self);
app::EText *element = (app::EText *)app::element_pool[id];
std::string localized_text = Localization::get(Ruby::mrb, element->key, element->params);
std::string localized_text = Localization::get(element->key, element->params);
return mrb_str_new_cstr(mrb, localized_text.c_str());
}
@@ -1173,6 +1174,7 @@ static mrb_value ElementImage_init(mrb_state *mrb, mrb_value self) {
}
uint64_t id = get_id_Animation(mrb, animation_val);
animation_pool.use(id);
app::EImage *element = new app::EImage(id);
element->position = {x, y};
@@ -1572,7 +1574,7 @@ static mrb_value scene_elements_at(mrb_state *mrb, mrb_value self) {
mrb_value position_val;
mrb_get_args(mrb, "o", &position_val);
float x, y;
float x = 0, y = 0;
HASH_FLOAT(position_val, x, x);
HASH_FLOAT(position_val, y, y);
Vec2<float> position = {x, y};
-2
View File
@@ -20,8 +20,6 @@
out = mrb_float(v); \
else if (mrb_fixnum_p(v)) \
out = (float)mrb_fixnum(v); \
else \
out = 0; \
} while (0)
#define HASH_BOOL(h, key, out) \