- btn_small de tamany configurable

- Nova distribució, mes pareguda a un propertygrid (ongoing)
This commit is contained in:
2024-06-11 14:21:23 +02:00
parent f96305b0a4
commit 60cccf8a7c

View File

@@ -139,6 +139,20 @@ const bool btn_small(const int x, const int y, int &var, int min, int max)
return false;
}
const bool btn_small(const int x, const int y, int &var, int min, int max, int width)
{
char buffer[100];
int result=0;
result=ui::spin(SDL_itoa(var, buffer, 10), x, y, width, 11);
if (result)
{
var=SDL_max(min, SDL_min(max, var+result));
return true;
}
return false;
}
void btn_check(const int x, const int y, const char* label, uint8_t &flags, const uint8_t value)
{
int result=0;
@@ -392,6 +406,11 @@ bool game::loop()
draw::setViewport(420, 0, 100, 240);
draw::color(WHITE);
draw::fillrect(0, 0, 100, 240);
draw::color(LIGHT+WHITE);
draw::fillrect(2, 2, 96, 236);
draw::color(PAPER);
draw::rect(2, 2, 96, 236);
draw::setViewport(420, 2, 100, 238);
bool changed = false;
@@ -401,27 +420,61 @@ switch (section)
break;
case SECTION_ROOM:
line = 0;
//changed |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
//changed |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
ui::label("ROOM DIMENSIONS", 2, line, 96, 11, GRAY); line+=10;
changed |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
changed |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
ui::label("WIDTH", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWidth(), 0, 3, 50);
line += 10;
ui::label("HEIGHT", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refHeight(), 0, 3, 50);
line += 10;
draw::print("DOORS:", 10, 80, 15, 0);
changed |= btn_small(32, 80, room::editor::refDoor(XN), -1, 5);
changed |= btn_small(49, 80, room::editor::refDoor(YP), -1, 5);
changed |= btn_small(66, 80, room::editor::refDoor(XP), -1, 5);
changed |= btn_small(83, 80, room::editor::refDoor(YN), -1, 5);
ui::label("DOOR HEIGHTS", 2, line, 96, 11, GRAY); line+=10;
changed |= btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
ui::label("XN", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refDoor(XN), -1, 5);
line += 10;
ui::label("YP", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refDoor(YP), -1, 5);
line += 10;
ui::label("XP", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refDoor(XP), -1, 5);
line += 10;
ui::label("YN", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refDoor(YN), -1, 5);
line += 10;
ui::label("TEXTURES", 2, line, 96, 11, GRAY); line+=10;
ui::label("COLOR", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
line += 10;
ui::label("FLOOR", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refFloorTex(), 0, 5);
line += 10;
ui::label("WALL", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refWallTex(), 0, 5);
line += 10;
ui::label("DOOR", 2, line, 64, 11);
changed |= btn_small(64, line, room::editor::refDoorTex(), 0, 4);
line += 10;
ui::label("UNDER DOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWallDoorTex(), 0, 5, 50);
/*changed |= btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
changed |= btn("FLOOR:", 10, 155, room::editor::refFloorTex(), 0, 5);
changed |= btn("WALLS:", 10, 170, room::editor::refWallTex(), 0, 5);
changed |= btn("DOORS:", 10, 185, room::editor::refDoorTex(), 0, 4);
changed |= btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);
changed |= btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);*/
if (changed) room::update();
break;
case SECTION_ACTOR:
changed = false;
changed = false;
act = actor::getSelected();
if (act)
{
@@ -491,6 +544,9 @@ switch (section)
break;
};
draw::color(PAPER);
draw::rect(2, 0, 96, 236);
/*
break;
}