forked from oerkki/voxelands
add background outlines to forge slots
This commit is contained in:
parent
c1ab6bff23
commit
fe3dec01c4
Binary file not shown.
After Width: | Height: | Size: 344 B |
Binary file not shown.
After Width: | Height: | Size: 619 B |
|
@ -3096,20 +3096,26 @@ bool ForgeNodeMetadata::receiveFields(std::string formname, std::map<std::string
|
|||
}
|
||||
std::string ForgeNodeMetadata::getDrawSpecString()
|
||||
{
|
||||
if (m_show_craft)
|
||||
return std::string("size[8,8]")+
|
||||
"list[current_name;craft;2,0;3,3;]"
|
||||
"list[current_name;craftresult;6,1;1,1;]"
|
||||
"button[3,3.2;3,1;enchant;Show Enchanting]"
|
||||
"list[current_player;main;0,3.8;8,1;0,8;]"
|
||||
"list[current_player;main;0,5;8,3;8,-1;]";
|
||||
return std::string("size[8,8]")+
|
||||
"list[current_name;mithril;1,1;1,1;]"
|
||||
"list[current_name;gem;3,1;1,1;]"
|
||||
"list[current_name;craftresult;6,1;1,1;]"
|
||||
"button[3,3.2;3,1;craft;Show Crafting]"
|
||||
"list[current_player;main;0,3.8;8,1;0,8;]"
|
||||
"list[current_player;main;0,5;8,3;8,-1;]";
|
||||
std::string spec("size[8,8]");
|
||||
if (m_show_craft) {
|
||||
spec += "list[current_name;craft;2,0;3,3;]";
|
||||
spec += "list[current_name;craftresult;6,1;1,1;]";
|
||||
spec += "button[3,3.2;3,1;enchant;";
|
||||
spec += gettext("Show Enchanting");
|
||||
spec += "]";
|
||||
}else{
|
||||
spec += "list[current_name;mithril;1,1;1,1;ingot_bg.png]";
|
||||
spec += "list[current_name;gem;3,1;1,1;gem_bg.png]";
|
||||
spec += "list[current_name;craftresult;6,1;1,1;]";
|
||||
spec += "button[3,3.2;3,1;craft;";
|
||||
spec += gettext("Show Crafting");
|
||||
spec += "]";
|
||||
}
|
||||
|
||||
spec += "list[current_player;main;0,3.8;8,1;0,8;]";
|
||||
spec += "list[current_player;main;0,5;8,3;8,-1;]";
|
||||
|
||||
return spec;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -176,10 +176,22 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
|||
int i_start = 0;
|
||||
int i_end = -1;
|
||||
std::string end = f.next("]");
|
||||
std::string bg = "";
|
||||
if (end != "") {
|
||||
Strfnd fend(end);
|
||||
i_start = mystoi(fend.next(","));
|
||||
i_end = mystoi(fend.next(";"));
|
||||
std::string s_start = fend.next(",");
|
||||
std::string s_end = fend.next(";");
|
||||
if (s_start != "") {
|
||||
if (s_end != "") {
|
||||
i_start = mystoi(s_start);
|
||||
i_end = mystoi(s_end);
|
||||
end = fend.end();
|
||||
}else{
|
||||
end = s_start;
|
||||
}
|
||||
}
|
||||
if (end != "")
|
||||
bg = end;
|
||||
}
|
||||
infostream<<"list inv="<<name<<", listname="<<listname
|
||||
<<", pos=("<<pos.X<<","<<pos.Y<<")"
|
||||
|
@ -187,7 +199,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
|||
<<std::endl;
|
||||
if(bp_set != 2)
|
||||
errorstream<<"WARNING: invalid use of list without a size[] element"<<std::endl;
|
||||
m_inventorylists.push_back(ListDrawSpec(loc, listname, pos, geom, i_start, i_end));
|
||||
m_inventorylists.push_back(ListDrawSpec(loc, listname, bg, pos, geom, i_start, i_end));
|
||||
}
|
||||
else if(type == "image")
|
||||
{
|
||||
|
@ -506,6 +518,10 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
|
|||
return;
|
||||
InventoryList *ilist = inv->getList(s.listname);
|
||||
|
||||
video::ITexture *bg_texture = NULL;
|
||||
if (s.background != "")
|
||||
bg_texture = driver->getTexture(getTexturePath(s.background).c_str());
|
||||
|
||||
core::rect<s32> imgrect(0,0,imgsize.X,imgsize.Y);
|
||||
|
||||
int end = s.i_end;
|
||||
|
@ -560,6 +576,9 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
|
|||
);
|
||||
}
|
||||
}
|
||||
}else if (bg_texture != NULL) {
|
||||
const video::SColor color(255,255,255,255);
|
||||
draw_image(driver, bg_texture, color, rect,NULL,&AbsoluteClippingRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
ListDrawSpec(
|
||||
const InventoryLocation &a_inventoryloc,
|
||||
const std::string &a_listname,
|
||||
const std::string &a_background,
|
||||
v2s32 a_pos,
|
||||
v2s32 a_geom,
|
||||
int i_s,
|
||||
|
@ -86,6 +87,7 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
):
|
||||
inventoryloc(a_inventoryloc),
|
||||
listname(a_listname),
|
||||
background(a_background),
|
||||
pos(a_pos),
|
||||
geom(a_geom),
|
||||
i_start(i_s),
|
||||
|
@ -95,6 +97,7 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
|
||||
InventoryLocation inventoryloc;
|
||||
std::string listname;
|
||||
std::string background;
|
||||
v2s32 pos;
|
||||
v2s32 geom;
|
||||
int i_start;
|
||||
|
|
Loading…
Reference in New Issue