implementation of main menu based uppon formspecs More...
#include <guiEngine.h>
Classes | |
struct | clouddata |
internam data required for drawing clouds More... | |
Public Member Functions | |
GUIEngine (JoystickController *joystick, gui::IGUIElement *parent, IMenuManager *menumgr, MainMenuData *data, bool &kill) | |
default constructor More... | |
virtual | ~GUIEngine () |
default destructor More... | |
MainMenuScripting * | getScriptIface () |
return MainMenuScripting interface More... | |
std::string | getScriptDir () |
return dir of current menuscript More... | |
unsigned int | queueAsync (const std::string &serialized_fct, const std::string &serialized_params) |
pass async callback to scriptengine More... | |
Private Member Functions | |
bool | loadMainMenuScript () |
find and run the main menu script More... | |
void | run () |
run main menu loop More... | |
void | updateTopLeftTextSize () |
update size of topleftext element More... | |
void | setFormspecPrepend (const std::string &fs) |
void | drawBackground (video::IVideoDriver *driver) |
draw background layer More... | |
void | drawOverlay (video::IVideoDriver *driver) |
draw overlay layer More... | |
void | drawHeader (video::IVideoDriver *driver) |
draw header layer More... | |
void | drawFooter (video::IVideoDriver *driver) |
draw footer layer More... | |
bool | setTexture (texture_layer layer, const std::string &texturepath, bool tile_image, unsigned int minsize) |
load a texture for a specified layer More... | |
void | setTopleftText (const std::string &text) |
specify text to appear as top left string More... | |
void | cloudInit () |
initialize cloud subsystem More... | |
void | cloudPreProcess () |
do preprocessing for cloud subsystem More... | |
void | cloudPostProcess (u32 frametime_min, IrrlichtDevice *device) |
do postprocessing for cloud subsystem More... | |
s32 | playSound (const SimpleSoundSpec &spec, bool looped) |
start playing a sound and return handle More... | |
void | stopSound (s32 handle) |
stop playing a sound started with playSound() More... | |
Static Private Member Functions | |
static bool | downloadFile (const std::string &url, const std::string &target) |
download a file using curl More... | |
Private Attributes | |
gui::IGUIElement * | m_parent = nullptr |
parent gui element More... | |
IMenuManager * | m_menumanager = nullptr |
manager to add menus to More... | |
scene::ISceneManager * | m_smgr = nullptr |
scene manager to add scene elements to More... | |
MainMenuData * | m_data = nullptr |
pointer to data beeing transfered back to main game handling More... | |
ISimpleTextureSource * | m_texture_source = nullptr |
pointer to texture source More... | |
ISoundManager * | m_sound_manager = nullptr |
pointer to soundmanager More... | |
FormspecFormSource * | m_formspecgui = nullptr |
representation of form source to be used in mainmenu formspec More... | |
TextDestGuiEngine * | m_buttonhandler = nullptr |
formspec input receiver More... | |
GUIFormSpecMenu * | m_menu = nullptr |
the formspec menu More... | |
bool & | m_kill |
reference to kill variable managed by SIGINT handler More... | |
bool | m_startgame = false |
variable used to abort menu and return back to main game handling More... | |
MainMenuScripting * | m_script = nullptr |
scripting interface More... | |
std::string | m_scriptdir = "" |
script basefolder More... | |
image_definition | m_textures [TEX_LAYER_MAX] |
array containing pointers to current specified texture layers More... | |
irr::gui::IGUIStaticText * | m_irr_toplefttext = nullptr |
pointer to gui element shown at topleft corner More... | |
EnrichedString | m_toplefttext |
and text that is in it More... | |
bool | m_clouds_enabled = true |
is drawing of clouds enabled atm More... | |
clouddata | m_cloud |
data used to draw clouds More... | |
Friends | |
class | ModApiMainMenu |
grant ModApiMainMenu access to private members More... | |
class | ModApiSound |
implementation of main menu based uppon formspecs
GUIEngine::GUIEngine | ( | JoystickController * | joystick, |
gui::IGUIElement * | parent, | ||
IMenuManager * | menumgr, | ||
MainMenuData * | data, | ||
bool & | kill | ||
) |
default constructor
dev | device to draw at |
parent | parent gui element |
menumgr | manager to add menus to |
smgr | scene manager to add scene elements to |
data | struct to transfer data to main game handling |
References GUIFormSpecMenu::allowClose(), EnrichedString::c_str(), createOpenALSoundManager(), dummySoundManager, MainMenuDataForScript::errormessage, errorstream, g_fontengine, g_settings, g_sound_manager_singleton, RenderingEngine::get_gui_env(), RenderingEngine::get_video_driver(), Settings::getBool(), FontEngine::getTextHeight(), FontEngine::getTextWidth(), infostream, loadMainMenuScript(), GUIFormSpecMenu::lockSize(), m_buttonhandler, m_data, m_formspecgui, m_irr_toplefttext, m_menu, m_menumanager, m_parent, m_script, m_sound_manager, m_texture_source, m_textures, m_toplefttext, GUIModalMenu::quitMenu(), run(), MainMenuData::script_data, ScriptApiMainMenu::setMainMenuData(), and BaseException::what().
|
virtual |
default destructor
References GUIEngine::clouddata::clouds, dummySoundManager, RenderingEngine::get_video_driver(), infostream, m_cloud, m_irr_toplefttext, m_script, m_sound_manager, m_texture_source, and m_textures.
|
private |
initialize cloud subsystem
References GUIEngine::clouddata::camera, GUIEngine::clouddata::clouds, RenderingEngine::get_timer_time(), GUIEngine::clouddata::lasttime, m_cloud, m_smgr, Clouds::setHeight(), and Clouds::update().
Referenced by run().
|
private |
do postprocessing for cloud subsystem
References RenderingEngine::get_timer_time(), GUIEngine::clouddata::lasttime, and m_cloud.
Referenced by run().
|
private |
do preprocessing for cloud subsystem
References GUIEngine::clouddata::clouds, GUIEngine::clouddata::dtime, RenderingEngine::get_timer_time(), GUIEngine::clouddata::lasttime, m_cloud, m_smgr, Clouds::render(), and Clouds::step().
Referenced by run().
|
staticprivate |
download a file using curl
url | url to download |
target | file to store to |
References HTTPFetchRequest::caller, HTTPFetchResult::data, fs::DeleteSingleFileOrEmptyDirectory(), g_settings, Settings::getS32(), httpfetch_sync(), HTTPFETCH_SYNC, HTTPFetchResult::succeeded, HTTPFetchRequest::timeout, and HTTPFetchRequest::url.
Referenced by ModApiMainMenu::l_download_file().
|
private |
draw background layer
driver | to use for drawing |
References draw2DImageFilterScaled(), m_textures, image_definition::minsize, MYMAX, TEX_LAYER_BACKGROUND, and image_definition::texture.
Referenced by run().
|
private |
draw footer layer
driver | to use for drawing |
References draw2DImageFilterScaled(), m_textures, TEX_LAYER_FOOTER, and image_definition::texture.
Referenced by run().
|
private |
draw header layer
driver | to use for drawing |
References draw2DImageFilterScaled(), m_textures, TEX_LAYER_HEADER, and image_definition::texture.
Referenced by run().
|
private |
draw overlay layer
driver | to use for drawing |
References draw2DImageFilterScaled(), m_textures, TEX_LAYER_OVERLAY, and image_definition::texture.
Referenced by run().
|
inline |
return dir of current menuscript
References m_scriptdir.
Referenced by ModApiMainMenu::l_get_mainmenu_path().
|
inline |
return MainMenuScripting interface
References m_script.
Referenced by TextDestGuiEngine::gotText().
|
private |
find and run the main menu script
References DIR_DELIM, errorstream, g_settings, Settings::get(), ScriptApiBase::loadScript(), m_script, m_scriptdir, porting::path_share, and BaseException::what().
Referenced by GUIEngine().
|
private |
start playing a sound and return handle
References m_sound_manager, and ISoundManager::playSound().
Referenced by ModApiSound::l_sound_play().
unsigned int GUIEngine::queueAsync | ( | const std::string & | serialized_fct, |
const std::string & | serialized_params | ||
) |
pass async callback to scriptengine
References m_script, and MainMenuScripting::queueAsync().
Referenced by ModApiMainMenu::l_do_async_callback().
|
private |
run main menu loop
References cloudInit(), cloudPostProcess(), cloudPreProcess(), drawBackground(), drawFooter(), drawHeader(), drawOverlay(), g_fontengine, g_settings, RenderingEngine::get_gui_env(), RenderingEngine::get_raw_device(), RenderingEngine::get_video_driver(), Settings::getBool(), Settings::getFloat(), FontEngine::getTextHeight(), Settings::getU16(), m_clouds_enabled, m_kill, m_menu, m_script, m_startgame, RenderingEngine::run(), Settings::setU16(), sleep_ms, MainMenuScripting::step(), and updateTopLeftTextSize().
Referenced by GUIEngine().
|
private |
References m_menu, and GUIFormSpecMenu::setFormspecPrepend().
Referenced by ModApiMainMenu::l_set_formspec_prepend().
|
private |
load a texture for a specified layer
layer | draw layer to specify texture |
texturepath | full path of texture to load |
References RenderingEngine::get_video_driver(), m_textures, image_definition::minsize, fs::PathExists(), image_definition::texture, and image_definition::tile.
Referenced by ModApiMainMenu::l_set_background().
|
private |
specify text to appear as top left string
text | to set |
References m_toplefttext, translate_string(), updateTopLeftTextSize(), and utf8_to_wide().
Referenced by ModApiMainMenu::l_set_topleft_text().
|
private |
stop playing a sound started with playSound()
References m_sound_manager, and ISoundManager::stopSound().
Referenced by ModApiSound::l_sound_stop().
|
private |
update size of topleftext element
References EnrichedString::c_str(), g_fontengine, RenderingEngine::get_gui_env(), FontEngine::getTextHeight(), FontEngine::getTextWidth(), m_irr_toplefttext, and m_toplefttext.
Referenced by run(), and setTopleftText().
|
friend |
grant ModApiMainMenu access to private members
|
friend |
|
private |
formspec input receiver
Referenced by GUIEngine(), and ModApiMainMenu::l_show_path_select_dialog().
|
private |
data used to draw clouds
Referenced by ~GUIEngine(), cloudInit(), cloudPostProcess(), and cloudPreProcess().
|
private |
is drawing of clouds enabled atm
Referenced by ModApiMainMenu::l_set_clouds(), and run().
|
private |
pointer to data beeing transfered back to main game handling
Referenced by GUIEngine(), and ModApiMainMenu::l_start().
|
private |
representation of form source to be used in mainmenu formspec
Referenced by GUIEngine(), and ModApiMainMenu::l_update_formspec().
|
private |
pointer to gui element shown at topleft corner
Referenced by GUIEngine(), ~GUIEngine(), and updateTopLeftTextSize().
|
private |
reference to kill variable managed by SIGINT handler
Referenced by ModApiMainMenu::l_close(), and run().
|
private |
the formspec menu
Referenced by GUIEngine(), ModApiMainMenu::l_get_table_index(), run(), and setFormspecPrepend().
|
private |
manager to add menus to
Referenced by GUIEngine(), ModApiMainMenu::l_show_keys_menu(), and ModApiMainMenu::l_show_path_select_dialog().
|
private |
parent gui element
Referenced by GUIEngine(), ModApiMainMenu::l_show_keys_menu(), and ModApiMainMenu::l_show_path_select_dialog().
|
private |
scripting interface
Referenced by GUIEngine(), ~GUIEngine(), getScriptIface(), loadMainMenuScript(), queueAsync(), and run().
|
private |
script basefolder
Referenced by getScriptDir(), and loadMainMenuScript().
|
private |
scene manager to add scene elements to
Referenced by cloudInit(), and cloudPreProcess().
|
private |
pointer to soundmanager
Referenced by GUIEngine(), ~GUIEngine(), playSound(), and stopSound().
|
private |
variable used to abort menu and return back to main game handling
Referenced by ModApiMainMenu::l_set_formspec_prepend(), ModApiMainMenu::l_start(), ModApiMainMenu::l_update_formspec(), and run().
|
private |
pointer to texture source
Referenced by GUIEngine(), ~GUIEngine(), and ModApiMainMenu::l_show_keys_menu().
|
private |
array containing pointers to current specified texture layers
Referenced by GUIEngine(), ~GUIEngine(), drawBackground(), drawFooter(), drawHeader(), drawOverlay(), and setTexture().
|
private |
and text that is in it
Referenced by GUIEngine(), setTopleftText(), and updateTopLeftTextSize().