From c9342abbc9729c242aa2308f59763a0995c17354 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Thu, 21 Sep 2023 10:19:54 +0200 Subject: [PATCH] - Ja se pot seleccionar actors --- source/main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 36b7b67..faa4574 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -56,9 +56,10 @@ void game::init() game::setUpdateTicks(64); //actor::actor_t *hero = actor::create("HERO", {16,32,8}, {8,8,12}, "test.gif", {0,32,20,32}, {-6,38}); - actor::actor_t *hero = actor::create("HERO", {16,32,8}, {8,8,12}, "abad.gif", {0,0,20,35}, {-6,32}); - hero->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED; - actor::setDirty(hero, true); + + //actor::actor_t *hero = actor::create("HEROHEROHEROHER", {16,32,8}, {8,8,12}, "abad.gif", {0,0,20,35}, {-6,32}); + //hero->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED; + //actor::setDirty(hero, true); restart(); @@ -144,15 +145,23 @@ bool game::loop() btn("WDOORS:", 330, 200, room_walldoors, 0, 5); break; case 1: + draw::color(TEAL); + draw::rect(328, 38, 67, 94); + const int mx = input::mouseX(); + const int my = input::mouseY(); + const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3); + int line = 0; actor::actor_t *act = actor::getFirst(); while (act) { if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR) { if (act==actor::getSelected()) { draw::color(TEAL); - draw::fillrect(330, 40+line*8, 50, 8); + draw::fillrect(330, 40+line*9, 63, 9); + } else if ((mx>=330) && (mx<394) && (my>=40+line*9) && (my<40+9+line*9) && btnDown) { + actor::select(act); } - draw::print(act->name, 330, 40+line*8, WHITE, BLACK); + draw::print(act->name, 332, 42+line*9, WHITE, BLACK); line++; } act = act->next;