Add in game screen resizing
This commit is contained in:
parent
d4cd6d6fc9
commit
81def6cb65
@ -116,8 +116,6 @@ private:
|
||||
/** List of all cameras. */
|
||||
static std::vector<Camera*> m_all_cameras;
|
||||
|
||||
void setupCamera();
|
||||
|
||||
protected:
|
||||
/** The camera scene node. */
|
||||
scene::ICameraSceneNode *m_camera;
|
||||
@ -230,6 +228,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returs the absolute position of the camera. */
|
||||
Vec3 getXYZ() { return Vec3(m_camera->getPosition()); }
|
||||
// ------------------------------------------------------------------------
|
||||
void setupCamera();
|
||||
}; // class Camera
|
||||
|
||||
#endif
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "graphics/per_camera_node.hpp"
|
||||
#include "graphics/referee.hpp"
|
||||
#include "graphics/render_target.hpp"
|
||||
#include "graphics/rtts.hpp"
|
||||
#include "graphics/shader.hpp"
|
||||
#include "graphics/shader_based_renderer.hpp"
|
||||
#include "graphics/shader_files_manager.hpp"
|
||||
@ -1994,8 +1995,7 @@ void IrrDriver::handleWindowResize()
|
||||
{
|
||||
// Don't update when dialog is opened
|
||||
if (GUIEngine::ModalDialog::isADialogActive() ||
|
||||
GUIEngine::ScreenKeyboard::isActive() ||
|
||||
StateManager::get()->getGameState() != GUIEngine::MENU)
|
||||
GUIEngine::ScreenKeyboard::isActive())
|
||||
return;
|
||||
|
||||
m_actual_screen_size = m_video_driver->getCurrentRenderTargetSize();
|
||||
@ -2333,12 +2333,25 @@ void IrrDriver::resetDebugModes()
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::resizeWindow()
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
// Reload fonts
|
||||
font_manager->getFont<BoldFace>()->init();
|
||||
font_manager->getFont<DigitFace>()->init();
|
||||
font_manager->getFont<RegularFace>()->init();
|
||||
// Reload GUIEngine
|
||||
GUIEngine::reloadForNewSize();
|
||||
if (World::getWorld())
|
||||
{
|
||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||
Camera::getCamera(i)->setupCamera();
|
||||
ShaderBasedRenderer* sbr = dynamic_cast<ShaderBasedRenderer*>(m_renderer);
|
||||
if (sbr)
|
||||
{
|
||||
delete sbr->getRTTs();
|
||||
// This will recreate the RTTs
|
||||
sbr->onLoadWorld();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_RECORDER
|
||||
ogrDestroy();
|
||||
@ -2360,4 +2373,5 @@ void IrrDriver::resizeWindow()
|
||||
"RecorderConfig is invalid, use the default one.");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -320,6 +320,17 @@ void AbstractStateManager::onResize()
|
||||
if (m_menu_stack.empty())
|
||||
return;
|
||||
|
||||
// In game resizing
|
||||
if (m_menu_stack[0].first == RACE_STATE_NAME)
|
||||
{
|
||||
if (m_menu_stack.size() == 1)
|
||||
{
|
||||
clearScreenCache();
|
||||
m_menu_stack.emplace_back(RACE_STATE_NAME, (Screen*)NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::function<Screen*()> > screen_function;
|
||||
for (auto& p : m_menu_stack)
|
||||
screen_function.push_back(p.second->getNewScreenPointer());
|
||||
|
@ -127,6 +127,7 @@ World* World::m_world[PT_COUNT];
|
||||
*/
|
||||
World::World() : WorldStatus()
|
||||
{
|
||||
GUIEngine::getDevice()->setResizable(true);
|
||||
RewindManager::setEnable(NetworkConfig::get()->isNetworking());
|
||||
#ifdef DEBUG
|
||||
m_magic_number = 0xB01D6543;
|
||||
@ -601,6 +602,7 @@ Controller* World::loadAIController(AbstractKart* kart)
|
||||
//-----------------------------------------------------------------------------
|
||||
World::~World()
|
||||
{
|
||||
GUIEngine::getDevice()->setResizable(false);
|
||||
if (m_process_type == PT_MAIN)
|
||||
material_manager->unloadAllTextures();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user