vita_de Posted July 4, 2013 Share Posted July 4, 2013 Sorry for the stupid question, please give me some advice. I need to simulate the situation of dropping items from inventory to the game environment. By what event can we define this action? thanks in advance Link to comment
ivan.cuevas Posted July 4, 2013 Share Posted July 4, 2013 Hi, I think the place_node function in editor_controls.h will give you some idea about how to drop a node in game environment. Link to comment
vita_de Posted July 31, 2013 Author Share Posted July 31, 2013 Thank you very much. We've implemented the object drag'n'drop from cell to cell. We've an issue with the drag'n'drop of unused items from the inventory to the ground. Now we're using a silly workaround: int checkFocusGui() { Widget wd; int mX = engine.app.getMouseX(); int mY = engine.app.getMouseY(); for (int i=0; i<engine.gui.getNumChilds(); i++ ) { wd = engine.gui.getChild(i); if (wd.isHidden() == 1) continue; if (wd.getScreenPositionX()<mX && mX<(wd.getScreenPositionX()+wd.getWidth()) && wd.getScreenPositionY()<mY && mY<(wd.getScreenPositionY()+wd.getHeight())) return i; } return -1; } though this function is cumbersome, it has helped to solve many other problems in the game, such as scrolling lists, hot keys, etc. I use this method so far. Thanks =) Link to comment
Recommended Posts