- Terballant en la llista de actors

This commit is contained in:
2023-09-20 18:59:07 +02:00
parent 47aa1c0e78
commit ea10524b10

View File

@@ -61,6 +61,8 @@ void game::init()
actor::setDirty(hero, true); actor::setDirty(hero, true);
restart(); restart();
actor::select(actor::find("BOX"));
} }
int sx=1, sy=0; int sx=1, sy=0;
@@ -89,7 +91,7 @@ void btn(const char* label, const int x, const int y, int &var, int min, int max
char buffer[100]; char buffer[100];
int result=0; int result=0;
draw::print(label, x, y+3, 15, 0); draw::print(label, x, y+3, 15, 0);
result=ui::button(SDL_itoa(var, buffer, 10), x+50, y, 28, 11); result=ui::button(SDL_itoa(var, buffer, 10), x+50, y, 28, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE);
if (result) if (result)
{ {
var=SDL_max(min, SDL_min(max, var-(result-2))); var=SDL_max(min, SDL_min(max, var-(result-2)));
@@ -97,6 +99,8 @@ void btn(const char* label, const int x, const int y, int &var, int min, int max
} }
} }
int section = 0;
bool game::loop() bool game::loop()
{ {
actor::update(actor::getFirst()); actor::update(actor::getFirst());
@@ -114,18 +118,43 @@ bool game::loop()
print(0,40,input::mouseBtn(2)?1:0); print(0,40,input::mouseBtn(2)?1:0);
print(0,50,input::mouseBtn(3)?1:0); print(0,50,input::mouseBtn(3)?1:0);
btn("ROOM WIDTH:", 330, 10, room_w, 0, 3); if (section==0) {
btn("ROOM HEIGHT:", 330, 25, room_h, 0, 3); draw::print("ROOM", 334, 13, YELLOW, LIGHT+BLACK);
if (ui::button("ACTORS", 365, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=1;
} else {
if (ui::button("ROOM", 330, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=0;
draw::print("ACTORS", 369, 13, YELLOW, BLACK);
}
btn("DOOR XP:", 330, 50, room_xp, -1, 5); switch (section) {
btn("DOOR XN:", 330, 65, room_xn, -1, 5); case 0:
btn("DOOR YP:", 330, 80, room_yp, -1, 5); btn("ROOM WIDTH:", 330, 40, room_w, 0, 3);
btn("DOOR YN:", 330, 95, room_yn, -1, 5); btn("ROOM HEIGHT:", 330, 55, room_h, 0, 3);
btn("COLOR:", 330, 110, room_color, 5, 11);
btn("FLOOR:", 330, 125, room_floor, 0, 5); btn("DOOR XP:", 330, 80, room_xp, -1, 5);
btn("WALLS:", 330, 140, room_walls, 0, 5); btn("DOOR XN:", 330, 95, room_xn, -1, 5);
btn("DOORS:", 330, 155, room_doors, 0, 4); btn("DOOR YP:", 330, 110, room_yp, -1, 5);
btn("WDOORS:", 330, 170, room_walldoors, 0, 5); btn("DOOR YN:", 330, 125, room_yn, -1, 5);
btn("COLOR:", 330, 140, room_color, 5, 11);
btn("FLOOR:", 330, 155, room_floor, 0, 5);
btn("WALLS:", 330, 170, room_walls, 0, 5);
btn("DOORS:", 330, 185, room_doors, 0, 4);
btn("WDOORS:", 330, 200, room_walldoors, 0, 5);
break;
case 1:
int line = 0;
actor::actor_t *act = actor::getFirst();
while (act) {
if (act==actor::getSelected()) {
draw::color(TEAL);
draw::fillrect(330, 40+line*8, 50, 8);
}
draw::print(act->name, 330, 40+line*8, WHITE, BLACK);
line++;
act = act->next;
}
break;
}
draw::render(); draw::render();