- Ja se pot seleccionar actors

This commit is contained in:
2023-09-21 10:19:54 +02:00
parent 2f1ae09676
commit c9342abbc9

View File

@@ -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;