- Ara es poden reordenar els templates i les categories

This commit is contained in:
2024-09-20 09:21:26 +02:00
parent 16914932ec
commit 81b9791144
3 changed files with 59 additions and 1 deletions

View File

@@ -105,6 +105,22 @@ namespace modules
if (input::keyPressed(SDL_SCANCODE_X) && (hovered_actor < actors.size())) strcpy(actor_cut, actors[hovered_actor].name);
if (input::keyPressed(SDL_SCANCODE_W) && (hovered_actor < actors.size()) && actor_cut[0]!=0)
{
actor::actor_t *act = actor::templates::getByName(actor_cut);
actor::actor_t *other = actor::templates::getByName(actors[hovered_actor].name);
actor::actor_t temp; // = actor::createEmptyActor();
if (act && other)
{
actor::templates::copy(&temp, other); temp.surface = other->surface;
actor::templates::copy(other, act); other->surface = act->surface;
actor::templates::copy(act, &temp); act->surface = temp.surface;
actor::templates::save();
}
actor_cut[0] = 0;
}
for (auto actor : actors)
{
draw::swapcol(1, strcmp(actor.name, actor_cut)==0 ? BLUE : TEAL);
@@ -137,7 +153,16 @@ namespace modules
edit_mode = EDITING_CATEGORY_NAME;
init_text_edit();
} else {
current_category = (input::mouseX()-11)/40;
int clicked_category = (input::mouseX()-11)/40;
if (clicked_category<categories.size())
{
if (input::keyDown(SDL_SCANCODE_LCTRL))
{
actor::templates::swapCategories(current_category, clicked_category);
actor::templates::save();
}
current_category = clicked_category;
}
}
}
}