mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 14:12:24 +01:00
Use irr_ptr for Game::gui_chat_console
This commit is contained in:
parent
37b374cb92
commit
17c041a65c
@ -890,7 +890,7 @@ private:
|
|||||||
QuicktuneShortcutter *quicktune = nullptr;
|
QuicktuneShortcutter *quicktune = nullptr;
|
||||||
|
|
||||||
std::unique_ptr<GameUI> m_game_ui;
|
std::unique_ptr<GameUI> m_game_ui;
|
||||||
GUIChatConsole *gui_chat_console = nullptr; // Free using ->Drop()
|
irr_ptr<GUIChatConsole> gui_chat_console;
|
||||||
MapDrawControl *draw_control = nullptr;
|
MapDrawControl *draw_control = nullptr;
|
||||||
Camera *camera = nullptr;
|
Camera *camera = nullptr;
|
||||||
irr_ptr<Clouds> clouds;
|
irr_ptr<Clouds> clouds;
|
||||||
@ -1265,8 +1265,7 @@ void Game::shutdown()
|
|||||||
|
|
||||||
clouds.reset();
|
clouds.reset();
|
||||||
|
|
||||||
if (gui_chat_console)
|
gui_chat_console.reset();
|
||||||
gui_chat_console->drop();
|
|
||||||
|
|
||||||
if (sky)
|
if (sky)
|
||||||
sky->drop();
|
sky->drop();
|
||||||
@ -1581,7 +1580,7 @@ bool Game::initGui()
|
|||||||
chat_backend->applySettings();
|
chat_backend->applySettings();
|
||||||
|
|
||||||
// Chat backend and console
|
// Chat backend and console
|
||||||
gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
|
gui_chat_console = make_irr<GUIChatConsole>(guienv, guienv->getRootGUIElement(),
|
||||||
-1, chat_backend, client, &g_menumgr);
|
-1, chat_backend, client, &g_menumgr);
|
||||||
|
|
||||||
if (g_settings->getBool("touch_controls")) {
|
if (g_settings->getBool("touch_controls")) {
|
||||||
@ -2037,7 +2036,7 @@ void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
|
|||||||
void Game::processUserInput(f32 dtime)
|
void Game::processUserInput(f32 dtime)
|
||||||
{
|
{
|
||||||
// Reset input if window not active or some menu is active
|
// Reset input if window not active or some menu is active
|
||||||
if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console)) {
|
if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console.get())) {
|
||||||
if (m_game_focused) {
|
if (m_game_focused) {
|
||||||
m_game_focused = false;
|
m_game_focused = false;
|
||||||
infostream << "Game lost focus" << std::endl;
|
infostream << "Game lost focus" << std::endl;
|
||||||
@ -2060,7 +2059,7 @@ void Game::processUserInput(f32 dtime)
|
|||||||
m_game_focused = true;
|
m_game_focused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen()) {
|
if (!guienv->hasFocus(gui_chat_console.get()) && gui_chat_console->isOpen()) {
|
||||||
gui_chat_console->closeConsoleAtOnce();
|
gui_chat_console->closeConsoleAtOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4217,7 +4216,8 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
|
|||||||
updateShadows();
|
updateShadows();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_game_ui->update(*stats, client, draw_control, cam, runData.pointed_old, gui_chat_console, dtime);
|
m_game_ui->update(*stats, client, draw_control, cam, runData.pointed_old,
|
||||||
|
gui_chat_console.get(), dtime);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
make sure menu is on top
|
make sure menu is on top
|
||||||
|
Loading…
Reference in New Issue
Block a user