diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-06-03 16:03:19 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-06-03 22:31:02 +0300 |
commit | 7bf446f671541f38d6dc89d207ee6effd3564483 (patch) | |
tree | 054438a63b10393f921d155cdfd99d5172967638 /src/guiInventoryMenu.h | |
parent | e4bc76f55cb3314a6e6cbd47e5dedd1923ad5328 (diff) | |
download | minetest-7bf446f671541f38d6dc89d207ee6effd3564483.tar.gz minetest-7bf446f671541f38d6dc89d207ee6effd3564483.tar.bz2 minetest-7bf446f671541f38d6dc89d207ee6effd3564483.zip |
Reshape inventory menu code
Diffstat (limited to 'src/guiInventoryMenu.h')
-rw-r--r-- | src/guiInventoryMenu.h | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/src/guiInventoryMenu.h b/src/guiInventoryMenu.h index ed8df88fc..4660ab2bf 100644 --- a/src/guiInventoryMenu.h +++ b/src/guiInventoryMenu.h @@ -84,49 +84,20 @@ class GUIInventoryMenu : public GUIModalMenu v2s32 geom; }; public: - struct DrawSpec - { - DrawSpec() - { - } - DrawSpec(const std::string &a_type, - const InventoryLocation &a_name, - const std::string &a_subname, - v2s32 a_pos, - v2s32 a_geom) - { - type = a_type; - name = a_name; - subname = a_subname; - pos = a_pos; - geom = a_geom; - } - - std::string type; - InventoryLocation name; - std::string subname; - v2s32 pos; - v2s32 geom; - }; - - // See .cpp for format - static v2s16 makeDrawSpecArrayFromString( - core::array<GUIInventoryMenu::DrawSpec> &draw_spec, - const std::string &data, - const InventoryLocation ¤t_location); - GUIInventoryMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, - v2s16 menu_size, InventoryManager *invmgr, IGameDef *gamedef ); ~GUIInventoryMenu(); - void setDrawSpec(core::array<DrawSpec> &init_draw_spec) + void setFormSpec(const std::string &formspec_string, + InventoryLocation current_inventory_location) { - m_init_draw_spec = init_draw_spec; + m_formspec_string = formspec_string; + m_current_inventory_location = current_inventory_location; + regenerateGui(m_screensize_old); } void removeChildren(); @@ -149,8 +120,6 @@ protected: return padding + AbsoluteRect.UpperLeftCorner; } - v2s16 m_menu_size; - v2s32 padding; v2s32 spacing; v2s32 imgsize; @@ -158,7 +127,8 @@ protected: InventoryManager *m_invmgr; IGameDef *m_gamedef; - core::array<DrawSpec> m_init_draw_spec; + std::string m_formspec_string; + InventoryLocation m_current_inventory_location; core::array<ListDrawSpec> m_draw_spec; ItemSpec *m_selected_item; |