aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_steam/init.lua
Commit message (Expand)AuthorAge
* [BREAKING] Use client-side translations instead of intllib; add zh_CN transla...ywang2020-07-19
* Use a standard wagon inventory formspecBlockhead2020-03-18
* Merge branch 'mt5-fixes'orwell962020-01-04
|\
| * Move attachment positions down 1 nodeorwell962019-12-05
* | Remove fullbright (H#140)orwell962019-12-18
|/
* Fix steam engine sound playing forever (H#121)ywang2019-11-27
* Change get_inventory_formspec API - add invname parameterorwell962018-12-10
* lower steel returnThomas Rudin2018-09-28
* Fix box wagonsorwell962018-06-14
* Fix bugs found while testingorwell962018-06-14
* Move driving_ctrl_access property to seat grouporwell962018-01-09
* steam locomotive: Add sounds and improve texturesmbb2017-12-23
* Implement sound api and some soundsorwell962017-12-06
* Change name of update_animation functionorwell962017-11-29
* Remove zip release files, move mod to root, exclude assets from Makefile (#92)rubenwardy2017-09-20
* Restructure mod directoryorwell962017-01-04
* remove train type concept and calculate train's capabilities based on used wa...orwell962016-12-22
* Turning mod into a modpack and separating the trains from the core modorwell962016-12-20
) = 0; }; /* Remember to drop() the menu after creating, so that it can remove itself when it wants to. */ class GUIModalMenu : public gui::IGUIElement { public: GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id, IMenuManager *menumgr): IGUIElement(gui::EGUIET_ELEMENT, env, parent, id, core::rect<s32>(0,0,100,100)) { //m_force_regenerate_gui = false; m_menumgr = menumgr; m_allow_focus_removal = false; m_screensize_old = v2u32(0,0); setVisible(true); Environment->setFocus(this); m_menumgr->createdMenu(this); } virtual ~GUIModalMenu() { m_menumgr->deletingMenu(this); } void allowFocusRemoval(bool allow) { m_allow_focus_removal = allow; } bool canTakeFocus(gui::IGUIElement *e) { return (e && (e == this || isMyChild(e))) || m_allow_focus_removal; } void draw() { if(!IsVisible) return; video::IVideoDriver* driver = Environment->getVideoDriver(); v2u32 screensize = driver->getScreenSize(); if(screensize != m_screensize_old /*|| m_force_regenerate_gui*/) { m_screensize_old = screensize; regenerateGui(screensize); //m_force_regenerate_gui = false; } drawMenu(); } /* This should be called when the menu wants to quit. WARNING: THIS DEALLOCATES THE MENU FROM MEMORY. Return immediately if you call this from the menu itself. */ void quitMenu() { allowFocusRemoval(true); // This removes Environment's grab on us Environment->removeFocus(this); this->remove(); } void removeChildren() { const core::list<gui::IGUIElement*> &children = getChildren(); core::list<gui::IGUIElement*> children_copy; for(core::list<gui::IGUIElement*>::ConstIterator i = children.begin(); i != children.end(); i++) { children_copy.push_back(*i); } for(core::list<gui::IGUIElement*>::Iterator i = children_copy.begin(); i != children_copy.end(); i++) { (*i)->remove(); } } virtual void regenerateGui(v2u32 screensize) = 0; virtual void drawMenu() = 0; virtual bool OnEvent(const SEvent& event) { return false; }; protected: //bool m_force_regenerate_gui; v2u32 m_screensize_old; private: IMenuManager *m_menumgr; // This might be necessary to expose to the implementation if it // wants to launch other menus bool m_allow_focus_removal; }; #endif