mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add support for exiting formspecs by doubleclicking outside
This commit is contained in:
parent
763a511ca5
commit
003634e049
4 changed files with 136 additions and 27 deletions
|
@ -143,7 +143,7 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
v2s32 geom;
|
||||
bool scale;
|
||||
};
|
||||
|
||||
|
||||
struct FieldSpec
|
||||
{
|
||||
FieldSpec()
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
m_current_inventory_location = current_inventory_location;
|
||||
regenerateGui(m_screensize_old);
|
||||
}
|
||||
|
||||
|
||||
// form_src is deleted by this GUIFormSpecMenu
|
||||
void setFormSource(IFormSource *form_src)
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
Remove and re-add (or reposition) stuff
|
||||
*/
|
||||
void regenerateGui(v2u32 screensize);
|
||||
|
||||
|
||||
ItemSpec getItemAtPos(v2s32 p) const;
|
||||
void drawList(const ListDrawSpec &s, int phase);
|
||||
void drawSelectedItem();
|
||||
|
@ -269,7 +269,7 @@ protected:
|
|||
v2s32 spacing;
|
||||
v2s32 imgsize;
|
||||
v2s32 offset;
|
||||
|
||||
|
||||
irr::IrrlichtDevice* m_device;
|
||||
InventoryManager *m_invmgr;
|
||||
IGameDef *m_gamedef;
|
||||
|
@ -290,7 +290,7 @@ protected:
|
|||
ItemSpec *m_selected_item;
|
||||
u32 m_selected_amount;
|
||||
bool m_selected_dragging;
|
||||
|
||||
|
||||
// WARNING: BLACK MAGIC
|
||||
// Used to guess and keep up with some special things the server can do.
|
||||
// If name is "", no guess exists.
|
||||
|
@ -366,6 +366,20 @@ private:
|
|||
void parseBox(parserData* data,std::string element);
|
||||
void parseBackgroundColor(parserData* data,std::string element);
|
||||
void parseListColors(parserData* data,std::string element);
|
||||
|
||||
/**
|
||||
* check if event is part of a double click
|
||||
* @param event event to evaluate
|
||||
* @return true/false if a doubleclick was detected
|
||||
*/
|
||||
bool DoubleClickDetection(const SEvent event);
|
||||
|
||||
struct clickpos
|
||||
{
|
||||
v2s32 pos;
|
||||
s32 time;
|
||||
};
|
||||
clickpos m_doubleclickdetect[2];
|
||||
};
|
||||
|
||||
class FormspecFormSource: public IFormSource
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue