mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-10 19:32:10 +00:00
refacto: remove get_gui_env & draw_load_screen from RenderingEngine singleton
This commit is contained in:
parent
a93712458b
commit
48d5abd5be
11 changed files with 38 additions and 46 deletions
|
@ -1731,7 +1731,7 @@ typedef struct TextureUpdateArgs {
|
|||
ITextureSource *tsrc;
|
||||
} TextureUpdateArgs;
|
||||
|
||||
void texture_update_progress(void *args, u32 progress, u32 max_progress)
|
||||
void Client::showUpdateProgressTexture(void *args, u32 progress, u32 max_progress)
|
||||
{
|
||||
TextureUpdateArgs* targs = (TextureUpdateArgs*) args;
|
||||
u16 cur_percent = ceil(progress / (double) max_progress * 100.);
|
||||
|
@ -1750,7 +1750,7 @@ void texture_update_progress(void *args, u32 progress, u32 max_progress)
|
|||
targs->last_time_ms = time_ms;
|
||||
std::basic_stringstream<wchar_t> strm;
|
||||
strm << targs->text_base << " " << targs->last_percent << "%...";
|
||||
RenderingEngine::draw_load_screen(strm.str(), targs->guienv, targs->tsrc, 0,
|
||||
m_rendering_engine->draw_load_screen(strm.str(), targs->guienv, targs->tsrc, 0,
|
||||
72 + (u16) ((18. / 100.) * (double) targs->last_percent), true);
|
||||
}
|
||||
}
|
||||
|
@ -1804,7 +1804,7 @@ void Client::afterContentReceived()
|
|||
tu_args.last_percent = 0;
|
||||
tu_args.text_base = wgettext("Initializing nodes");
|
||||
tu_args.tsrc = m_tsrc;
|
||||
m_nodedef->updateTextures(this, texture_update_progress, &tu_args);
|
||||
m_nodedef->updateTextures(this, &tu_args);
|
||||
delete[] tu_args.text_base;
|
||||
|
||||
// Start mesh update thread after setting up content definitions
|
||||
|
|
|
@ -347,6 +347,7 @@ public:
|
|||
float mediaReceiveProgress();
|
||||
|
||||
void afterContentReceived();
|
||||
void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress);
|
||||
|
||||
float getRTT();
|
||||
float getCurRate();
|
||||
|
|
|
@ -2047,8 +2047,8 @@ void Game::openInventory()
|
|||
|| !client->getScript()->on_inventory_open(fs_src->m_client->getInventory(inventoryloc))) {
|
||||
TextDest *txt_dst = new TextDestPlayerInventory(client);
|
||||
auto *&formspec = m_game_ui->updateFormspec("");
|
||||
GUIFormSpecMenu::create(formspec, client, &input->joystick, fs_src,
|
||||
txt_dst, client->getFormspecPrepend(), sound);
|
||||
GUIFormSpecMenu::create(formspec, client, m_rendering_engine->get_gui_env(),
|
||||
&input->joystick, fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
|
||||
formspec->setFormSpec(fs_src->getForm(), inventoryloc);
|
||||
}
|
||||
|
@ -2626,8 +2626,8 @@ void Game::handleClientEvent_ShowFormSpec(ClientEvent *event, CameraOrientation
|
|||
new TextDestPlayerInventory(client, *(event->show_formspec.formname));
|
||||
|
||||
auto *&formspec = m_game_ui->updateFormspec(*(event->show_formspec.formname));
|
||||
GUIFormSpecMenu::create(formspec, client, &input->joystick,
|
||||
fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
GUIFormSpecMenu::create(formspec, client, m_rendering_engine->get_gui_env(),
|
||||
&input->joystick, fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
}
|
||||
|
||||
delete event->show_formspec.formspec;
|
||||
|
@ -2639,8 +2639,8 @@ void Game::handleClientEvent_ShowLocalFormSpec(ClientEvent *event, CameraOrienta
|
|||
FormspecFormSource *fs_src = new FormspecFormSource(*event->show_formspec.formspec);
|
||||
LocalFormspecHandler *txt_dst =
|
||||
new LocalFormspecHandler(*event->show_formspec.formname, client);
|
||||
GUIFormSpecMenu::create(m_game_ui->getFormspecGUI(), client, &input->joystick,
|
||||
fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
GUIFormSpecMenu::create(m_game_ui->getFormspecGUI(), client, m_rendering_engine->get_gui_env(),
|
||||
&input->joystick, fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
|
||||
delete event->show_formspec.formspec;
|
||||
delete event->show_formspec.formname;
|
||||
|
@ -3332,8 +3332,8 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
|
|||
TextDest *txt_dst = new TextDestNodeMetadata(nodepos, client);
|
||||
|
||||
auto *&formspec = m_game_ui->updateFormspec("");
|
||||
GUIFormSpecMenu::create(formspec, client, &input->joystick, fs_src,
|
||||
txt_dst, client->getFormspecPrepend(), sound);
|
||||
GUIFormSpecMenu::create(formspec, client, m_rendering_engine->get_gui_env(),
|
||||
&input->joystick, fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
|
||||
formspec->setFormSpec(meta->getString("formspec"), inventoryloc);
|
||||
return false;
|
||||
|
@ -4082,8 +4082,8 @@ void Game::showDeathFormspec()
|
|||
LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_DEATH_SCREEN", client);
|
||||
|
||||
auto *&formspec = m_game_ui->getFormspecGUI();
|
||||
GUIFormSpecMenu::create(formspec, client, &input->joystick,
|
||||
fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
GUIFormSpecMenu::create(formspec, client, m_rendering_engine->get_gui_env(),
|
||||
&input->joystick, fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
formspec->setFocus("btn_respawn");
|
||||
}
|
||||
|
||||
|
@ -4216,8 +4216,8 @@ void Game::showPauseMenu()
|
|||
LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU");
|
||||
|
||||
auto *&formspec = m_game_ui->getFormspecGUI();
|
||||
GUIFormSpecMenu::create(formspec, client, &input->joystick,
|
||||
fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
GUIFormSpecMenu::create(formspec, client, m_rendering_engine->get_gui_env(),
|
||||
&input->joystick, fs_src, txt_dst, client->getFormspecPrepend(), sound);
|
||||
formspec->setFocus("btn_continue");
|
||||
formspec->doPause = true;
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ bool RenderingEngine::setXorgWindowIconFromPath(const std::string &icon_file)
|
|||
Text will be removed when the screen is drawn the next time.
|
||||
Additionally, a progressbar can be drawn when percent is set between 0 and 100.
|
||||
*/
|
||||
void RenderingEngine::_draw_load_screen(const std::wstring &text,
|
||||
void RenderingEngine::draw_load_screen(const std::wstring &text,
|
||||
gui::IGUIEnvironment *guienv, ITextureSource *tsrc, float dtime,
|
||||
int percent, bool clouds)
|
||||
{
|
||||
|
|
|
@ -95,19 +95,14 @@ public:
|
|||
return m_device->getTimer()->getTime();
|
||||
}
|
||||
|
||||
static gui::IGUIEnvironment *get_gui_env()
|
||||
gui::IGUIEnvironment *get_gui_env()
|
||||
{
|
||||
sanity_check(s_singleton && s_singleton->m_device);
|
||||
return s_singleton->m_device->getGUIEnvironment();
|
||||
return m_device->getGUIEnvironment();
|
||||
}
|
||||
|
||||
inline static void draw_load_screen(const std::wstring &text,
|
||||
void draw_load_screen(const std::wstring &text,
|
||||
gui::IGUIEnvironment *guienv, ITextureSource *tsrc,
|
||||
float dtime = 0, int percent = 0, bool clouds = true)
|
||||
{
|
||||
s_singleton->_draw_load_screen(
|
||||
text, guienv, tsrc, dtime, percent, clouds);
|
||||
}
|
||||
float dtime = 0, int percent = 0, bool clouds = true);
|
||||
|
||||
void draw_menu_scene(gui::IGUIEnvironment *guienv, float dtime, bool clouds);
|
||||
void draw_scene(video::SColor skycolor, bool show_hud,
|
||||
|
@ -125,10 +120,6 @@ public:
|
|||
static std::vector<irr::video::E_DRIVER_TYPE> getSupportedVideoDrivers();
|
||||
|
||||
private:
|
||||
void _draw_load_screen(const std::wstring &text, gui::IGUIEnvironment *guienv,
|
||||
ITextureSource *tsrc, float dtime = 0, int percent = 0,
|
||||
bool clouds = true);
|
||||
|
||||
v2u32 _getWindowSize() const;
|
||||
|
||||
std::unique_ptr<RenderingCore> core;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue