- [NEW] Ajustat el color del propertygrid

- [NEW] Seccions en el propertygrid
- [NEW] JA es mostren les propietats bàsiques de les habitacions
This commit is contained in:
2025-11-18 22:49:30 +01:00
parent 57f9ed32e3
commit a0a7a78061
3 changed files with 47 additions and 14 deletions

View File

@@ -122,10 +122,25 @@ bool loop()
tilemap::start();
tilemap::draw();
char tmp[256];
propertygrid::start();
propertygrid::stringProperty("Peiv", "Teib");
propertygrid::stringProperty("Peiv", "Teib");
if (treeview::getSelected(0) > -1) {
if (treeview::getSelected(2) == -1) {
propertygrid::sectionProperty("ROOM:");
propertygrid::stringProperty("NAME", room["room"]["name"].get_value<std::string>());
propertygrid::stringProperty("BGCOLOR", room["room"]["bgColor"].get_value<std::string>());
propertygrid::stringProperty("BORDER", room["room"]["border"].get_value<std::string>());
propertygrid::stringProperty("TILESET", room["room"]["tileSetFile"].get_value<std::string>());
propertygrid::stringProperty("ITEMCOL1", room["room"]["itemColor1"].get_value<std::string>());
propertygrid::stringProperty("ITEMCOL2", room["room"]["itemColor2"].get_value<std::string>());
propertygrid::stringProperty("CONVEYOR", SDL_itoa(room["room"]["autoSurface"].get_value<int>(), tmp, 10));
propertygrid::sectionProperty("CONNECTIONS:");
propertygrid::stringProperty("UP", room["room"]["connections"]["up"].is_null()?"null":room["room"]["connections"]["up"].get_value<std::string>()+": "+rooms[room["room"]["connections"]["up"].get_value<std::string>()]);
propertygrid::stringProperty("DOWN", room["room"]["connections"]["down"].is_null()?"null":room["room"]["connections"]["down"].get_value<std::string>()+": "+rooms[room["room"]["connections"]["down"].get_value<std::string>()]);
propertygrid::stringProperty("LEFT", room["room"]["connections"]["left"].is_null()?"null":room["room"]["connections"]["left"].get_value<std::string>()+": "+rooms[room["room"]["connections"]["left"].get_value<std::string>()]);
propertygrid::stringProperty("RIGHT", room["room"]["connections"]["right"].is_null()?"null":room["room"]["connections"]["right"].get_value<std::string>()+": "+rooms[room["room"]["connections"]["right"].get_value<std::string>()]);
}
}
propertygrid::end();
/*x1 += 6; x2 = x1 + font::len("FILE")+6;

View File

@@ -8,22 +8,24 @@ namespace propertygrid
int width = 200;
int scroll = 0;
int line = 0;
int y = 0;
int element = 0;
int max_elements = 0;
void start()
{
y = 48;
const SDL_Point win_size = draw::getWindowSize();
draw::setClip(win_size.x-propertygrid::width,48,propertygrid::width, win_size.y-48);
draw::setClip(win_size.x-propertygrid::width,y,propertygrid::width, win_size.y-y);
draw::setColor(0xff181818);
draw::fillrect(win_size.x-propertygrid::width,48,propertygrid::width, win_size.y-48);
draw::fillrect(win_size.x-propertygrid::width,y,propertygrid::width, win_size.y-y);
//current[0] = current[1] = current[2] =
line = element = 0;
max_elements = (win_size.y-48) / 24;
max_elements = (win_size.y-y) / 24;
int mx = input::mouseX();
int my = input::mouseY();
if (mx>=win_size.x-propertygrid::width && my>=48 && mx<win_size.x && my<draw::getWindowSize().y) {
if (mx>=win_size.x-propertygrid::width && my>=y && mx<win_size.x && my<draw::getWindowSize().y) {
scroll -= input::mouseWheel();
if (scroll < 0) scroll = 0;
}
@@ -33,18 +35,33 @@ namespace propertygrid
{
const SDL_Point win_size = draw::getWindowSize();
const int x = win_size.x-propertygrid::width;
const int y = 48+line*24;
draw::setClip(x,y,propertygrid::width, 24);
draw::setColor(0xffffffff);
draw::fillrect(x,y,propertygrid::width, 24);
draw::setColor(0xffa0a0a0);
draw::line(x,71+line*24,win_size.x, y+23);
draw::line(x+propertygrid::width/2,y,x+propertygrid::width/2, y+23);
font::print(label.c_str(), x+8, y+9, 0xff000000);
//draw::setColor(0xffffffff);
//draw::fillrect(x,y,propertygrid::width, 24);
draw::setColor(0xff000000);
draw::line(x,y+23,win_size.x, y+23);
draw::line(x+propertygrid::width/3,y,x+propertygrid::width/3, y+23);
font::print(label.c_str(), x+8, y+9);
font::print(value.c_str(), x+8+propertygrid::width/3, y+9);
line++;
y+=24;
return "";
}
void sectionProperty(std::string label)
{
const SDL_Point win_size = draw::getWindowSize();
const int x = win_size.x-propertygrid::width;
draw::setClip(x,y,propertygrid::width, 16);
draw::setColor(0xff3c3c3c);
draw::fillrect(x,y,propertygrid::width, 16);
draw::setColor(0xff000000);
draw::line(x,y+15,win_size.x, y+15);
font::print(label.c_str(), x+8, y+5, 0xffeeeeee);
line++;
y+=16;
}
void end()
{
draw::resetClip();

View File

@@ -5,5 +5,6 @@ namespace propertygrid
{
void start();
std::string stringProperty(std::string label, std::string value);
void sectionProperty(std::string label);
void end();
}