<<"Launching inventory"<<std::endl;
GUIFormSpecMenu *menu =
- new GUIFormSpecMenu(guienv, guiroot, -1,
+ new GUIFormSpecMenu(device, guiroot, -1,
&g_menumgr,
&client, gamedef);
/* Create menu */
GUIFormSpecMenu *menu =
- new GUIFormSpecMenu(guienv, guiroot, -1,
+ new GUIFormSpecMenu(device, guiroot, -1,
&g_menumgr,
&client, gamedef);
menu->setFormSpec(meta->getString("formspec"),
GUIFormSpecMenu
*/
-GUIFormSpecMenu::GUIFormSpecMenu(gui::IGUIEnvironment* env,
+GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr,
InventoryManager *invmgr,
IGameDef *gamedef
):
- GUIModalMenu(env, parent, id, menumgr),
+ GUIModalMenu(dev->getGUIEnvironment(), parent, id, menumgr),
+ m_device(dev),
m_invmgr(invmgr),
m_gamedef(gamedef),
m_form_src(NULL),
}
}
+ m_pointer = m_device->getCursorControl()->getPosition();
+
updateSelectedItem();
gui::IGUISkin* skin = Environment->getSkin();
return true;
}
}
- if(event.EventType==EET_MOUSE_INPUT_EVENT
- && event.MouseInput.Event == EMIE_MOUSE_MOVED)
- {
- // Mouse moved
- m_pointer = v2s32(event.MouseInput.X, event.MouseInput.Y);
- }
if(event.EventType==EET_MOUSE_INPUT_EVENT
&& event.MouseInput.Event != EMIE_MOUSE_MOVED)
{
// Mouse event other than movement
- v2s32 p(event.MouseInput.X, event.MouseInput.Y);
- m_pointer = p;
-
// Get selected item and hovered/clicked item (s)
updateSelectedItem();
- ItemSpec s = getItemAtPos(p);
+ ItemSpec s = getItemAtPos(m_pointer);
Inventory *inv_selected = NULL;
Inventory *inv_s = NULL;
};
public:
- GUIFormSpecMenu(gui::IGUIEnvironment* env,
+ GUIFormSpecMenu(irr::IrrlichtDevice* dev,
gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr,
InventoryManager *invmgr,
v2s32 spacing;
v2s32 imgsize;
+ irr::IrrlichtDevice* m_device;
InventoryManager *m_invmgr;
IGameDef *m_gamedef;