forked from oerkki/voxelands
add a slight gap in player inventory between the wield row and everything else
This commit is contained in:
parent
dbb0cd81b0
commit
526672a259
|
@ -201,7 +201,8 @@ public:
|
|||
if (m_show_appearance) {
|
||||
return
|
||||
std::string("size[8,9]"
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
"list[current_player;main;0,4.9;8,1;0,8;]"
|
||||
"list[current_player;main;0,6;8,3;8,-1;]"
|
||||
"button[0.5,3;3,1;show_craft;")+gettext("Show Crafting")+"]"
|
||||
"label[1,2;"+gettext("Clothes")+"]"
|
||||
"label[4.9,-0.1;"+gettext("Hat/Helmet")+"]"
|
||||
|
@ -221,7 +222,8 @@ public:
|
|||
}
|
||||
return
|
||||
std::string("size[8,9]"
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
"list[current_player;main;0,4.8;8,1;0,8;]"
|
||||
"list[current_player;main;0,6;8,3;8,-1;]"
|
||||
"label[1,1.7;")+gettext("Drop to Ground")+"]"
|
||||
"list[current_player;discard;1.2,2;1,1;]"
|
||||
"button[0.5,3.5;3,1;show_appearance;"+gettext("Change Clothing")+"]"
|
||||
|
|
|
@ -221,14 +221,21 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
|||
v2s32 geom;
|
||||
geom.X = mystoi(f.next(","));
|
||||
geom.Y = mystoi(f.next(";"));
|
||||
int i_start = 0;
|
||||
int i_end = -1;
|
||||
std::string end = f.next("]");
|
||||
if (end != "") {
|
||||
Strfnd fend(end);
|
||||
i_start = mystoi(fend.next(","));
|
||||
i_end = mystoi(fend.next(";"));
|
||||
}
|
||||
infostream<<"list inv="<<name<<", listname="<<listname
|
||||
<<", pos=("<<pos.X<<","<<pos.Y<<")"
|
||||
<<", geom=("<<geom.X<<","<<geom.Y<<")"
|
||||
<<std::endl;
|
||||
f.next("]");
|
||||
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));
|
||||
m_inventorylists.push_back(ListDrawSpec(loc, listname, pos, geom, i_start, i_end));
|
||||
}
|
||||
else if(type == "image")
|
||||
{
|
||||
|
@ -548,9 +555,13 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
|
|||
|
||||
core::rect<s32> imgrect(0,0,imgsize.X,imgsize.Y);
|
||||
|
||||
for (s32 i=0; i<s.geom.X*s.geom.Y; i++) {
|
||||
s32 x = (i%s.geom.X) * spacing.X;
|
||||
s32 y = (i/s.geom.X) * spacing.Y;
|
||||
int end = s.i_end;
|
||||
if (end < 0)
|
||||
end = s.i_start+(s.geom.X*s.geom.Y);
|
||||
|
||||
for (s32 i=s.i_start; i<end; i++) {
|
||||
s32 x = ((i-s.i_start)%s.geom.X) * spacing.X;
|
||||
s32 y = ((i-s.i_start)/s.geom.X) * spacing.Y;
|
||||
v2s32 p(x,y);
|
||||
core::rect<s32> rect = imgrect + s.pos + p;
|
||||
InventoryItem *item = NULL;
|
||||
|
|
|
@ -82,13 +82,20 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
ListDrawSpec()
|
||||
{
|
||||
}
|
||||
ListDrawSpec(const InventoryLocation &a_inventoryloc,
|
||||
const std::string &a_listname,
|
||||
v2s32 a_pos, v2s32 a_geom):
|
||||
ListDrawSpec(
|
||||
const InventoryLocation &a_inventoryloc,
|
||||
const std::string &a_listname,
|
||||
v2s32 a_pos,
|
||||
v2s32 a_geom,
|
||||
int i_s,
|
||||
int i_e
|
||||
):
|
||||
inventoryloc(a_inventoryloc),
|
||||
listname(a_listname),
|
||||
pos(a_pos),
|
||||
geom(a_geom)
|
||||
geom(a_geom),
|
||||
i_start(i_s),
|
||||
i_end(i_e)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -96,6 +103,8 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
std::string listname;
|
||||
v2s32 pos;
|
||||
v2s32 geom;
|
||||
int i_start;
|
||||
int i_end;
|
||||
};
|
||||
|
||||
struct ImageDrawSpec
|
||||
|
|
Loading…
Reference in New Issue