From 9539e8d74469825167a943d844e45be28b720f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 4 Feb 2018 12:58:52 -0300 Subject: [PATCH] Several fixes. --HG-- branch : dev-scenenode --- include/eepp/ui/uiscenenode.hpp | 2 ++ src/eepp/maps/mapeditor/mapeditor.cpp | 6 ++++-- src/eepp/scene/node.cpp | 1 - src/eepp/scene/scenenode.cpp | 9 +++++++-- src/eepp/ui/tools/textureatlaseditor.cpp | 6 ++++-- src/eepp/ui/uiscenenode.cpp | 4 ++++ src/eepp/ui/uiwindow.cpp | 3 ++- src/eepp/window/engine.cpp | 3 +++ 8 files changed, 26 insertions(+), 8 deletions(-) diff --git a/include/eepp/ui/uiscenenode.hpp b/include/eepp/ui/uiscenenode.hpp index 5e2b07e02..51eabf9f3 100644 --- a/include/eepp/ui/uiscenenode.hpp +++ b/include/eepp/ui/uiscenenode.hpp @@ -21,6 +21,8 @@ class EE_API UISceneNode : public SceneNode { const Sizef& getSize(); + virtual const Sizef& getRealSize(); + void setTranslator( Translator translator ); Translator& getTranslator(); diff --git a/src/eepp/maps/mapeditor/mapeditor.cpp b/src/eepp/maps/mapeditor/mapeditor.cpp index 4325774f6..5bf346bc6 100644 --- a/src/eepp/maps/mapeditor/mapeditor.cpp +++ b/src/eepp/maps/mapeditor/mapeditor.cpp @@ -62,7 +62,6 @@ MapEditor::MapEditor( UIWindow * AttatchTo, const MapEditorCloseCb& callback ) : if ( NULL == mUIWindow ) { mUIContainer = SceneManager::instance()->getUISceneNode(); - //mUIContainer->setThemeSkin( mTheme, "winback" ); } else { mUIContainer = mUIWindow->getContainer(); } @@ -70,6 +69,8 @@ MapEditor::MapEditor( UIWindow * AttatchTo, const MapEditorCloseCb& callback ) : if ( NULL != mUIWindow ) { mUIWindow->setTitle( "Map Editor" ); mUIWindow->addEventListener( Event::OnWindowClose, cb::Make1( this, &MapEditor::windowClose ) ); + } else { + mUIContainer->addEventListener( Event::OnClose, cb::Make1( this, &MapEditor::windowClose ) ); } createME(); @@ -175,7 +176,8 @@ void MapEditor::createWinMenu() { mWinContainer->setParent( mUIContainer ); mWinContainer->setPosition( 0, WinMenu->getSize().getHeight() ); mWinContainer->setSize( mUIContainer->getSize().getWidth(), mUIContainer->getSize().getHeight() - WinMenu->getSize().getHeight() ); - mWinContainer->setAnchors(UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM | UI_ANCHOR_LEFT | UI_ANCHOR_RIGHT ); + mWinContainer->setAnchors( UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM | UI_ANCHOR_LEFT | UI_ANCHOR_RIGHT ); + mWinContainer->setThemeSkin( mTheme, "winback" ); } void MapEditor::createETGMenu() { diff --git a/src/eepp/scene/node.cpp b/src/eepp/scene/node.cpp index 53cd6d0e7..bbb83d881 100644 --- a/src/eepp/scene/node.cpp +++ b/src/eepp/scene/node.cpp @@ -557,7 +557,6 @@ void Node::childAddAt( Node * ChildCtrl, Uint32 Pos ) { ChildCtrl->mParentCtrl = this; ChildCtrl->mSceneNode = ChildCtrl->getSceneNode(); - if ( ChildLoop == NULL ) { mChild = ChildCtrl; mChildLast = ChildCtrl; diff --git a/src/eepp/scene/scenenode.cpp b/src/eepp/scene/scenenode.cpp index 894d5cc6e..140919340 100644 --- a/src/eepp/scene/scenenode.cpp +++ b/src/eepp/scene/scenenode.cpp @@ -32,6 +32,7 @@ SceneNode::SceneNode( EE::Window::Window * window ) : mHighlightInvalidationColor( 220, 0, 0, 255 ) { mNodeFlags |= NODE_FLAG_SCENENODE; + mSceneNode = this; enableReportSizeChangeToChilds(); @@ -45,12 +46,14 @@ SceneNode::SceneNode( EE::Window::Window * window ) : } SceneNode::~SceneNode() { - onClose(); - if ( -1 != mResizeCb && NULL != Engine::existsSingleton() && Engine::instance()->existsWindow( mWindow ) ) { mWindow->popResizeCallback( mResizeCb ); } + onClose(); + + eeSAFE_DELETE( mEventDispatcher ); + eeSAFE_DELETE( mFrameBuffer ); } @@ -110,6 +113,8 @@ void SceneNode::onSizeChange() { mFrameBuffer->resize( fboSize.getWidth(), fboSize.getHeight() ); } } + + Node::onSizeChange(); } void SceneNode::addToCloseQueue( Node * Ctrl ) { diff --git a/src/eepp/ui/tools/textureatlaseditor.cpp b/src/eepp/ui/tools/textureatlaseditor.cpp index 977bd74b3..ea19b4bc6 100644 --- a/src/eepp/ui/tools/textureatlaseditor.cpp +++ b/src/eepp/ui/tools/textureatlaseditor.cpp @@ -40,13 +40,12 @@ TextureAtlasEditor::TextureAtlasEditor( UIWindow * AttatchTo, const TGEditorClos if ( NULL == mUIWindow ) { mUIContainer = SceneManager::instance()->getUISceneNode(); - //mUIContainer->setThemeSkin( mTheme, "winback" ); } else { mUIContainer = mUIWindow->getContainer(); } std::string layout = R"xml( - + @@ -147,6 +146,9 @@ TextureAtlasEditor::TextureAtlasEditor( UIWindow * AttatchTo, const TGEditorClos if ( NULL != mUIWindow ) { mUIWindow->setTitle( "Texture Atlas Editor" ); mUIWindow->addEventListener( Event::OnWindowClose, cb::Make1( this, &TextureAtlasEditor::windowClose ) ); + } else { + mUIContainer->addEventListener( Event::OnClose, cb::Make1( this, &TextureAtlasEditor::windowClose ) ); + static_cast( mUIContainer->find("texture_atlas_editor_root") )->setThemeSkin( mTheme, "winback" ); } mTGEU = eeNew( UITGEUpdater, ( this ) ); diff --git a/src/eepp/ui/uiscenenode.cpp b/src/eepp/ui/uiscenenode.cpp index 30a0b7e9f..6102a73dc 100644 --- a/src/eepp/ui/uiscenenode.cpp +++ b/src/eepp/ui/uiscenenode.cpp @@ -216,4 +216,8 @@ const Sizef &UISceneNode::getSize() { return mDpSize; } +const Sizef &UISceneNode::getRealSize() { + return mSize; +} + }} diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index a11bb5786..2cd5f45e3 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace EE { namespace UI { @@ -78,7 +79,7 @@ UIWindow::UIWindow( UIWindow::WindowBaseContainerType type, const UIWindowStyleC } UIWindow::~UIWindow() { - if ( NULL != getUISceneNode() ) { + if ( NULL != getUISceneNode() && !SceneManager::instance()->isShootingDown() ) { getUISceneNode()->windowRemove( this ); getUISceneNode()->setFocusLastWindow( this ); diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 090d9938b..2399cb0ee 100755 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #if EE_PLATFORM == EE_PLATFORM_ANDROID #include @@ -73,6 +74,8 @@ Engine::~Engine() { Scene::SceneManager::destroySingleton(); + UIThemeManager::destroySingleton(); + FontManager::destroySingleton(); TextureFactory::destroySingleton();