- Ja mostra el panel de propietats que toca segons el que està seleccionat.

This commit is contained in:
2024-06-10 21:56:32 +02:00
parent 042dd3c505
commit c71ee1bbb5

View File

@@ -320,27 +320,6 @@ bool game::loop()
draw::color(WHITE); draw::color(WHITE);
draw::fillrect(0, 0, 100, 240); draw::fillrect(0, 0, 100, 240);
/*
bool change = false;
change |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
change |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
draw::print("DOORS:", 10, 80, 15, 0);
change |= btn_small(32, 80, room::editor::refDoor(XN), -1, 5);
change |= btn_small(49, 80, room::editor::refDoor(YP), -1, 5);
change |= btn_small(66, 80, room::editor::refDoor(XP), -1, 5);
change |= btn_small(83, 80, room::editor::refDoor(YN), -1, 5);
btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
btn("FLOOR:", 10, 155, room::editor::refFloorTex(), 0, 5);
btn("WALLS:", 10, 170, room::editor::refWallTex(), 0, 5);
btn("DOORS:", 10, 185, room::editor::refDoorTex(), 0, 4);
btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);
if (change) room::update();
*/
draw::color(LIGHT+WHITE); draw::color(LIGHT+WHITE);
draw::fillrect(2, 2, 96, 236); draw::fillrect(2, 2, 96, 236);
draw::color(PAPER); draw::color(PAPER);
@@ -406,103 +385,104 @@ bool game::loop()
break; break;
case 1: case 1:
*/ */
draw::setViewport(420, 0, 100, 240); draw::setViewport(420, 0, 100, 240);
draw::color(WHITE); draw::color(WHITE);
draw::fillrect(0, 0, 100, 240); draw::fillrect(0, 0, 100, 240);
draw::setViewport(420, 2, 100, 238); bool room_changed = false;
draw::color(LIGHT+WHITE); switch (section)
draw::fillrect(2, 0, 96, 100); {
draw::color(PAPER); case SECTION_GENERAL:
draw::rect(2, 0, 96, 100); break;
/* case SECTION_ROOM:
const int mx = draw::getLocalX(input::mouseX());
const int my = draw::getLocalY(input::mouseY());
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
int line = 0; room_changed |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
act = actor::getFirst(); room_changed |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
while (act) {
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR) { draw::print("DOORS:", 10, 80, 15, 0);
if (act==actor::getSelected()) { room_changed |= btn_small(32, 80, room::editor::refDoor(XN), -1, 5);
draw::color(LIGHT+BLUE); room_changed |= btn_small(49, 80, room::editor::refDoor(YP), -1, 5);
draw::fillrect(4, 2+line*9, 92, 9); room_changed |= btn_small(66, 80, room::editor::refDoor(XP), -1, 5);
} room_changed |= btn_small(83, 80, room::editor::refDoor(YN), -1, 5);
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
actor::select(act); room_changed |= btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
//section=1; room_changed |= btn("FLOOR:", 10, 155, room::editor::refFloorTex(), 0, 5);
} room_changed |= btn("WALLS:", 10, 170, room::editor::refWallTex(), 0, 5);
draw::print(act->name, 6, 4+line*9, LIGHT+WHITE, BLACK); room_changed |= btn("DOORS:", 10, 185, room::editor::refDoorTex(), 0, 4);
line++; room_changed |= btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);
}
act = act->next; if (room_changed) room::update();
break;
case SECTION_ACTOR:
act = actor::getSelected();
if (act)
{
//draw::setViewport(420, 90, 100, 150);
btn_txt("NAME:", 2, 0, act->name);
if (btn_opt2("BMP:", 2, 10, act->bmp, gifs)) {
draw::freeSurface(act->surface);
act->surface = draw::loadSurface(act->bmp);
} }
*/ //draw::print("RECT:", 2, 64, PAPER, 0);
act = actor::getSelected(); ui::label("RECT", 2, 20, 32, 11);
if (act) btn_small(33, 20, act->bmp_rect.x, 0, 512);
{ btn_small(49, 20, act->bmp_rect.y, 0, 512);
draw::setViewport(420, 90, 100, 150); btn_small(65, 20, act->bmp_rect.w, 0, 512);
btn_small(81, 20, act->bmp_rect.h, 0, 512);
btn_txt("NAME:", 2, 0, act->name); ui::label("OFFSET", 2, 30, 32, 11);
if (btn_opt2("BMP:", 2, 10, act->bmp, gifs)) { btn_small(65, 30, act->bmp_offset.x, -32, 64);
draw::freeSurface(act->surface); btn_small(81, 30, act->bmp_offset.y, -32, 64);
act->surface = draw::loadSurface(act->bmp);
}
//draw::print("RECT:", 2, 64, PAPER, 0);
ui::label("RECT", 2, 20, 32, 11);
btn_small(33, 20, act->bmp_rect.x, 0, 512);
btn_small(49, 20, act->bmp_rect.y, 0, 512);
btn_small(65, 20, act->bmp_rect.w, 0, 512);
btn_small(81, 20, act->bmp_rect.h, 0, 512);
ui::label("OFFSET", 2, 30, 32, 11); ui::label("POS", 2, 42, 32, 11);
btn_small(65, 30, act->bmp_offset.x, -32, 64); btn_small(49, 42, act->pos.x, 0, 512);
btn_small(81, 30, act->bmp_offset.y, -32, 64); btn_small(65, 42, act->pos.y, 0, 512);
btn_small(81, 42, act->pos.z, 0, 512);
ui::label("POS", 2, 42, 32, 11); ui::label("SIZE", 2, 52, 32, 11);
btn_small(49, 42, act->pos.x, 0, 512); btn_small(49, 52, act->size.x, 0, 512);
btn_small(65, 42, act->pos.y, 0, 512); btn_small(65, 52, act->size.y, 0, 512);
btn_small(81, 42, act->pos.z, 0, 512); btn_small(81, 52, act->size.z, 0, 512);
ui::label("SIZE", 2, 52, 32, 11); btn_check(2, 64, "HERO", act->flags, FLAG_HERO);
btn_small(49, 52, act->size.x, 0, 512); btn_check(26, 64, "PUSH", act->flags, FLAG_PUSHABLE);
btn_small(65, 52, act->size.y, 0, 512); btn_check(50, 64, "REAC", act->flags, FLAG_REACTIVE);
btn_small(81, 52, act->size.z, 0, 512); btn_check(74, 64, "MOVI", act->flags, FLAG_MOVING);
btn_check(2, 74, "ANIM", act->flags, FLAG_ANIMATED);
btn_check(26, 74, "ORIE", act->flags, FLAG_ORIENTABLE);
btn_check(50, 74, "DEAD", act->flags, FLAG_DEADLY);
btn_check(74, 74, "GRAV", act->flags, FLAG_GRAVITY);
btn_check(2, 64, "HERO", act->flags, FLAG_HERO); btn_opt("ORIENT", 2, 86, act->orient, {PUSH_NONE, PUSH_XP, PUSH_XN, PUSH_YP, PUSH_YN, PUSH_ZP, PUSH_ZN}, {"NONE", "XP", "XN", "YP", "YN", "ZP", "ZN"});
btn_check(26, 64, "PUSH", act->flags, FLAG_PUSHABLE); btn_opt("MOVEMNT", 2, 96, act->movement, {MOV_NONE, MOV_X, MOV_Y, MOV_Z, MOV_CW, MOV_CCW, MOV_RAND, MOV_HUNT}, {"NONE", "X", "Y", "Z", "CW", "CCW", "RAND", "HUNT"});
btn_check(50, 64, "REAC", act->flags, FLAG_REACTIVE); btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"});
btn_check(74, 64, "MOVI", act->flags, FLAG_MOVING);
btn_check(2, 74, "ANIM", act->flags, FLAG_ANIMATED);
btn_check(26, 74, "ORIE", act->flags, FLAG_ORIENTABLE);
btn_check(50, 74, "DEAD", act->flags, FLAG_DEADLY);
btn_check(74, 74, "GRAV", act->flags, FLAG_GRAVITY);
btn_opt("ORIENT", 2, 86, act->orient, {PUSH_NONE, PUSH_XP, PUSH_XN, PUSH_YP, PUSH_YN, PUSH_ZP, PUSH_ZN}, {"NONE", "XP", "XN", "YP", "YN", "ZP", "ZN"}); //draw::print("ANIM SPEED:", 2, 156, 15, 0);
btn_opt("MOVEMNT", 2, 96, act->movement, {MOV_NONE, MOV_X, MOV_Y, MOV_Z, MOV_CW, MOV_CCW, MOV_RAND, MOV_HUNT}, {"NONE", "X", "Y", "Z", "CW", "CCW", "RAND", "HUNT"}); ui::label("ANMSPED", 2, 116, 32, 11);
btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"}); btn_small(81, 116, act->anim_wait, 0, 10);
//draw::print("ANIM SPEED:", 2, 156, 15, 0); ui::label("RMASK", 2, 128, 24, 11);
ui::label("ANMSPED", 2, 116, 32, 11); btn_check(24+2, 128, "XP", act->react_mask, PUSH_XP);
btn_small(81, 116, act->anim_wait, 0, 10); btn_check(24+14, 128, "XN", act->react_mask, PUSH_XN);
btn_check(24+26, 128, "YP", act->react_mask, PUSH_YP);
btn_check(24+38, 128, "YN", act->react_mask, PUSH_YN);
btn_check(24+50, 128, "ZP", act->react_mask, PUSH_ZP);
btn_check(24+62, 128, "ZN", act->react_mask, PUSH_ZN);
ui::label("RMASK", 2, 128, 24, 11); ui::label("RPUSH", 2, 140, 24, 11);
btn_check(24+2, 128, "XP", act->react_mask, PUSH_XP); btn_check(24+2, 140, "XP", act->react_push, PUSH_XP);
btn_check(24+14, 128, "XN", act->react_mask, PUSH_XN); btn_check(24+14, 140, "XN", act->react_push, PUSH_XN);
btn_check(24+26, 128, "YP", act->react_mask, PUSH_YP); btn_check(24+26, 140, "YP", act->react_push, PUSH_YP);
btn_check(24+38, 128, "YN", act->react_mask, PUSH_YN); btn_check(24+38, 140, "YN", act->react_push, PUSH_YN);
btn_check(24+50, 128, "ZP", act->react_mask, PUSH_ZP); btn_check(24+50, 140, "ZP", act->react_push, PUSH_ZP);
btn_check(24+62, 128, "ZN", act->react_mask, PUSH_ZN); btn_check(24+62, 140, "ZN", act->react_push, PUSH_ZN);
}
ui::label("RPUSH", 2, 140, 24, 11); break;
btn_check(24+2, 140, "XP", act->react_push, PUSH_XP); };
btn_check(24+14, 140, "XN", act->react_push, PUSH_XN);
btn_check(24+26, 140, "YP", act->react_push, PUSH_YP);
btn_check(24+38, 140, "YN", act->react_push, PUSH_YN);
btn_check(24+50, 140, "ZP", act->react_push, PUSH_ZP);
btn_check(24+62, 140, "ZN", act->react_push, PUSH_ZN);
/* /*
break; break;
@@ -538,7 +518,6 @@ bool game::loop()
} }
break; break;
*/ */
}
draw::render(); draw::render();