diff --git a/include/eepp/graphics/textureatlasloader.hpp b/include/eepp/graphics/textureatlasloader.hpp index 4cead8a1a..a50cd8149 100644 --- a/include/eepp/graphics/textureatlasloader.hpp +++ b/include/eepp/graphics/textureatlasloader.hpp @@ -69,9 +69,6 @@ class EE_API TextureAtlasLoader { ~TextureAtlasLoader(); - /** In the case that the loader is threaded, to know if the texture atlas was loaded, the main thread must call Update to update the state of the load. And finish the job. */ - void update(); - /** Loads a texture atlas from its path ( the texture atlas binary is expected, not the texture, the ".eta" file ). * If the loader is not threaded, it will load the atlas immediately. * @param TextureAtlasPath The texture atlas path. @@ -107,7 +104,7 @@ class EE_API TextureAtlasLoader { /** @return True if the texture atlas is loaded. */ const bool& isLoaded() const; - + /** @return True if the texture atlas is loading. */ const bool& isLoading() const; diff --git a/include/eepp/math/interpolation1d.hpp b/include/eepp/math/interpolation1d.hpp index fa5e7e9b4..ded9b79fb 100644 --- a/include/eepp/math/interpolation1d.hpp +++ b/include/eepp/math/interpolation1d.hpp @@ -126,6 +126,8 @@ class EE_API Interpolation1d { UintPtr getData() const; void setData(const UintPtr & data); + + Float getCurrentProgress(); protected: UintPtr mData; int mType; diff --git a/include/eepp/math/interpolation2d.hpp b/include/eepp/math/interpolation2d.hpp index f3b34286f..01b4688fe 100755 --- a/include/eepp/math/interpolation2d.hpp +++ b/include/eepp/math/interpolation2d.hpp @@ -128,6 +128,8 @@ class EE_API Interpolation2d { UintPtr getData() const; void setData(const UintPtr & data); + + Float getCurrentProgress(); protected: UintPtr mData; int mType; diff --git a/include/eepp/scene/action.hpp b/include/eepp/scene/action.hpp index 36efeed06..8048e651d 100644 --- a/include/eepp/scene/action.hpp +++ b/include/eepp/scene/action.hpp @@ -35,6 +35,8 @@ class EE_API Action { virtual bool isDone() = 0; + virtual Float getCurrentProgress() = 0; + virtual Action * clone() const; virtual Action * reverse() const; diff --git a/include/eepp/scene/actions/actioninterpolation1d.hpp b/include/eepp/scene/actions/actioninterpolation1d.hpp index f60ff711f..569f88d8d 100644 --- a/include/eepp/scene/actions/actioninterpolation1d.hpp +++ b/include/eepp/scene/actions/actioninterpolation1d.hpp @@ -17,6 +17,8 @@ class EE_API ActionInterpolation1d : public Action { bool isDone() override; + Float getCurrentProgress(); + Interpolation1d * getInterpolation(); protected: mutable Interpolation1d mInterpolation; diff --git a/include/eepp/scene/actions/actioninterpolation2d.hpp b/include/eepp/scene/actions/actioninterpolation2d.hpp index 58f71c8dd..fde6e82c2 100644 --- a/include/eepp/scene/actions/actioninterpolation2d.hpp +++ b/include/eepp/scene/actions/actioninterpolation2d.hpp @@ -17,6 +17,8 @@ class EE_API ActionInterpolation2d : public Action { bool isDone() override; + Float getCurrentProgress() override; + Interpolation2d * getInterpolation(); protected: mutable Interpolation2d mInterpolation; diff --git a/include/eepp/scene/actions/delay.hpp b/include/eepp/scene/actions/delay.hpp index 703a9cf61..60f569a71 100644 --- a/include/eepp/scene/actions/delay.hpp +++ b/include/eepp/scene/actions/delay.hpp @@ -10,7 +10,7 @@ namespace EE { namespace Scene { namespace Actions { class EE_API Delay : public Action { public: static Delay * New( const Time& time ); - + void start() override; void stop() override; @@ -19,6 +19,8 @@ class EE_API Delay : public Action { bool isDone() override; + Float getCurrentProgress() override; + Action * clone() const override; Action * reverse() const override; @@ -26,11 +28,11 @@ class EE_API Delay : public Action { protected: Clock mClock; Time mTime; - + Delay( const Time& time ); - + }; -}}} +}}} #endif diff --git a/include/eepp/scene/actions/marginmove.hpp b/include/eepp/scene/actions/marginmove.hpp index 1cad59646..3714f80ad 100644 --- a/include/eepp/scene/actions/marginmove.hpp +++ b/include/eepp/scene/actions/marginmove.hpp @@ -33,6 +33,8 @@ class EE_API MarginMove : public Action { Action * reverse() const override; + Float getCurrentProgress(); + Interpolation1d getInterpolationLeft() const; void setInterpolationLeft(const Interpolation1d & interpolationLeft); diff --git a/include/eepp/scene/actions/sequence.hpp b/include/eepp/scene/actions/sequence.hpp index f256e9687..791ea0cd4 100644 --- a/include/eepp/scene/actions/sequence.hpp +++ b/include/eepp/scene/actions/sequence.hpp @@ -25,6 +25,8 @@ class EE_API Sequence : public Action { bool isDone() override; + Float getCurrentProgress(); + Action * clone() const override; Action * reverse() const override; @@ -34,11 +36,11 @@ class EE_API Sequence : public Action { protected: std::vector mSequence; Uint32 mCurPos; - + Sequence( const std::vector sequence ); - + }; -}}} +}}} #endif diff --git a/include/eepp/scene/actions/spawn.hpp b/include/eepp/scene/actions/spawn.hpp index 382a8c18a..a1d6345c8 100644 --- a/include/eepp/scene/actions/spawn.hpp +++ b/include/eepp/scene/actions/spawn.hpp @@ -25,6 +25,8 @@ class EE_API Spawn : public Action { bool isDone() override; + Float getCurrentProgress(); + Action * clone() const override; Action * reverse() const override; @@ -33,11 +35,11 @@ class EE_API Spawn : public Action { protected: std::vector mSpawn; bool mAllDone; - + Spawn( const std::vector spawn ); - + }; -}}} +}}} #endif diff --git a/include/eepp/scene/actions/tint.hpp b/include/eepp/scene/actions/tint.hpp index 2855c30a1..12d08cafe 100644 --- a/include/eepp/scene/actions/tint.hpp +++ b/include/eepp/scene/actions/tint.hpp @@ -36,6 +36,8 @@ class EE_API Tint : public Action { Action * reverse() const override; + Float getCurrentProgress(); + Interpolation1d getInterpolationR() const; void setInterpolationR(const Interpolation1d & interpolationR); diff --git a/include/eepp/ui/tools/textureatlaseditor.hpp b/include/eepp/ui/tools/textureatlaseditor.hpp index 52d288c06..6877b60cd 100644 --- a/include/eepp/ui/tools/textureatlaseditor.hpp +++ b/include/eepp/ui/tools/textureatlaseditor.hpp @@ -33,25 +33,6 @@ class EE_API TextureAtlasEditor { bool isEdited() { return mEdited; } protected: - class UITGEUpdater : public UINode - { - public: - explicit UITGEUpdater( TextureAtlasEditor * TGEditor ) : - UINode(), - mTGEditor( TGEditor ) - { - subscribeScheduledUpdate(); - } - - ~UITGEUpdater() { - } - - virtual void scheduledUpdate( const Time& ) { mTGEditor->update(); } - protected: - TextureAtlasEditor * mTGEditor; - }; - friend class UITGEUpdater; - UIWindow * mUIWindow; Node * mUIContainer; UITheme * mTheme; @@ -68,7 +49,6 @@ class EE_API TextureAtlasEditor { UIWinMenu * mWinMenu; UIDropDownList * mTextureFilterList; TextureAtlasTextureRegionEditor * mTextureRegionEditor; - UITGEUpdater * mTGEU; bool mEdited; void windowClose( const Event * Event ); diff --git a/include/eepp/ui/uinodedrawable.hpp b/include/eepp/ui/uinodedrawable.hpp index 01ec90e8b..5f8f63bd1 100644 --- a/include/eepp/ui/uinodedrawable.hpp +++ b/include/eepp/ui/uinodedrawable.hpp @@ -38,6 +38,8 @@ class EE_API UINodeDrawable : public Drawable { bool isDone() override; + Float getCurrentProgress(); + Action * clone() const override; Action * reverse() const override; diff --git a/src/eepp/graphics/text.cpp b/src/eepp/graphics/text.cpp index 917e79925..0f39ad185 100644 --- a/src/eepp/graphics/text.cpp +++ b/src/eepp/graphics/text.cpp @@ -40,7 +40,7 @@ std::string Text::styleFlagToString( const Uint32& flags ) { } Uint32 Text::stringToStyleFlag( const std::string& str ) { - std::string valStr = str; + std::string valStr = String::trim( str ); String::toLowerInPlace( valStr ); std::vector strings = String::split( valStr, '|' ); Uint32 flags = Text::Regular; diff --git a/src/eepp/graphics/textureatlasloader.cpp b/src/eepp/graphics/textureatlasloader.cpp index 419ede525..9b52a5db2 100644 --- a/src/eepp/graphics/textureatlasloader.cpp +++ b/src/eepp/graphics/textureatlasloader.cpp @@ -117,11 +117,6 @@ void TextureAtlasLoader::setTextureFilter(const Texture::TextureFilter & texture } } -void TextureAtlasLoader::update() { - if ( mRL.isLoaded() && !mLoaded ) - createTextureRegions(); -} - void TextureAtlasLoader::loadFromStream( IOStream& IOS ) { mRL.setThreaded( mThreaded ); @@ -158,12 +153,13 @@ void TextureAtlasLoader::loadFromStream( IOStream& IOS ) { } } - if ( !mSkipResourceLoad || ( !mSkipResourceLoad && 0 == mRL.getCount() ) ) { + if ( !mSkipResourceLoad ) { mIsLoading = true; - mRL.load(); - - if ( !mThreaded || ( !mSkipResourceLoad && 0 == mRL.getCount() ) ) - createTextureRegions(); + mRL.load( [&]( ResourceLoader * ) { + if ( !mLoaded ) { + createTextureRegions(); + } + } ); } } } @@ -215,7 +211,7 @@ TextureAtlas * TextureAtlasLoader::getTextureAtlas() const { void TextureAtlasLoader::createTextureRegions() { mIsLoading = false; bool IsAlreadyLoaded = false; - + for ( Uint32 z = 0; z < mTempAtlass.size(); z++ ) { sTempTexAtlas * tTexAtlas = &mTempAtlass[z]; sTextureHdr * tTexHdr = &tTexAtlas->Texture; diff --git a/src/eepp/math/interpolation1d.cpp b/src/eepp/math/interpolation1d.cpp index 00b2324de..cec3823b0 100644 --- a/src/eepp/math/interpolation1d.cpp +++ b/src/eepp/math/interpolation1d.cpp @@ -293,6 +293,10 @@ void Interpolation1d::setData(const UintPtr & data) { mData = data; } +Float Interpolation1d::getCurrentProgress() { + return mCurTime >= mActP->t ? 1.f : mCurTime.asMilliseconds() / mActP->t.asMilliseconds(); +} + const bool& Interpolation1d::getLoop() const { return mLoop; } diff --git a/src/eepp/math/interpolation2d.cpp b/src/eepp/math/interpolation2d.cpp index 9631158ee..d48939dc9 100755 --- a/src/eepp/math/interpolation2d.cpp +++ b/src/eepp/math/interpolation2d.cpp @@ -288,6 +288,10 @@ void Interpolation2d::setData(const UintPtr & data) mData = data; } +Float Interpolation2d::getCurrentProgress() { + return mCurTime >= mActP->t ? 1.f : mCurTime.asMilliseconds() / mActP->t.asMilliseconds(); +} + bool Interpolation2d::getLoop() const { return mLoop; } diff --git a/src/eepp/scene/actions/actioninterpolation1d.cpp b/src/eepp/scene/actions/actioninterpolation1d.cpp index 02a39c8c5..59815a6e5 100644 --- a/src/eepp/scene/actions/actioninterpolation1d.cpp +++ b/src/eepp/scene/actions/actioninterpolation1d.cpp @@ -36,6 +36,10 @@ bool ActionInterpolation1d::isDone() { return mInterpolation.ended(); } +Float ActionInterpolation1d::getCurrentProgress() { + return mInterpolation.getCurrentProgress(); +} + Interpolation1d * ActionInterpolation1d::getInterpolation() { return &mInterpolation; } diff --git a/src/eepp/scene/actions/actioninterpolation2d.cpp b/src/eepp/scene/actions/actioninterpolation2d.cpp index 060afba06..f8b9e9210 100644 --- a/src/eepp/scene/actions/actioninterpolation2d.cpp +++ b/src/eepp/scene/actions/actioninterpolation2d.cpp @@ -36,6 +36,10 @@ bool ActionInterpolation2d::isDone() { return mInterpolation.ended(); } +Float ActionInterpolation2d::getCurrentProgress() { + return mInterpolation.getCurrentProgress(); +} + Interpolation2d * ActionInterpolation2d::getInterpolation() { return &mInterpolation; } diff --git a/src/eepp/scene/actions/delay.cpp b/src/eepp/scene/actions/delay.cpp index dcfbe4b0b..4be812f94 100644 --- a/src/eepp/scene/actions/delay.cpp +++ b/src/eepp/scene/actions/delay.cpp @@ -28,6 +28,10 @@ bool Delay::isDone() { return mClock.getElapsedTime() >= mTime; } +Float Delay::getCurrentProgress() { + return !isDone() ? mClock.getElapsedTime().asMilliseconds() / mTime.asMilliseconds() : 1.f; +} + Action *Delay::clone() const { return New( mTime ); } diff --git a/src/eepp/scene/actions/marginmove.cpp b/src/eepp/scene/actions/marginmove.cpp index 7a273bf79..8d3cb5b3a 100644 --- a/src/eepp/scene/actions/marginmove.cpp +++ b/src/eepp/scene/actions/marginmove.cpp @@ -151,4 +151,8 @@ Action * MarginMove::reverse() const { return NULL; } -}}} +Float MarginMove::getCurrentProgress() { + return mInterpolationLeft.getCurrentProgress(); +} + +}}} diff --git a/src/eepp/scene/actions/sequence.cpp b/src/eepp/scene/actions/sequence.cpp index eb42e487b..0376dec46 100644 --- a/src/eepp/scene/actions/sequence.cpp +++ b/src/eepp/scene/actions/sequence.cpp @@ -70,6 +70,10 @@ bool Sequence::isDone() { return mCurPos == mSequence.size() - 1 && mSequence[ mCurPos ]->isDone(); } +Float Sequence::getCurrentProgress() { + return mCurPos / static_cast( mSequence.size() ); +} + Action * Sequence::clone() const { return Sequence::New( mSequence ); } @@ -96,4 +100,4 @@ Sequence::Sequence( const std::vector sequence ) : mCurPos( 0 ) {} -}}} +}}} diff --git a/src/eepp/scene/actions/spawn.cpp b/src/eepp/scene/actions/spawn.cpp index 8e6f782ac..65f232ab0 100644 --- a/src/eepp/scene/actions/spawn.cpp +++ b/src/eepp/scene/actions/spawn.cpp @@ -75,6 +75,16 @@ bool Spawn::isDone() { return mAllDone; } +Float Spawn::getCurrentProgress() { + Float min = 1.f; + + for ( size_t i = 0; i < mSpawn.size(); i++ ) { + min = eemin( min, mSpawn[ i ]->getCurrentProgress() ); + } + + return min; +} + Action * Spawn::clone() const { return Spawn::New( mSpawn ); } @@ -101,4 +111,4 @@ Spawn::Spawn( const std::vector spawn ) : mAllDone( false ) {} -}}} +}}} diff --git a/src/eepp/scene/actions/tint.cpp b/src/eepp/scene/actions/tint.cpp index 1f5cfa783..5c3555163 100644 --- a/src/eepp/scene/actions/tint.cpp +++ b/src/eepp/scene/actions/tint.cpp @@ -119,6 +119,10 @@ Action * Tint::reverse() const { return NULL; } +Float Tint::getCurrentProgress() { + return mInterpolationR.getCurrentProgress(); +} + void Tint::onUpdate( const Time& ) { if ( NULL != mNode && mNode->isWidget() ) { UIWidget * widget = static_cast( mNode ); diff --git a/src/eepp/ui/tools/textureatlaseditor.cpp b/src/eepp/ui/tools/textureatlaseditor.cpp index 21d47a9be..584c12d3f 100644 --- a/src/eepp/ui/tools/textureatlaseditor.cpp +++ b/src/eepp/ui/tools/textureatlaseditor.cpp @@ -150,9 +150,6 @@ TextureAtlasEditor::TextureAtlasEditor( UIWindow * attachTo, const TGEditorClose mUIContainer->addEventListener( Event::OnClose, cb::Make1( this, &TextureAtlasEditor::windowClose ) ); mUIContainer->find("texture_atlas_editor_root")->setThemeSkin( mTheme, "winback" ); } - - mTGEU = eeNew( UITGEUpdater, ( this ) ); - mTGEU->setParent( mUIContainer ); } TextureAtlasEditor::~TextureAtlasEditor() { @@ -300,7 +297,8 @@ void TextureAtlasEditor::onTextureAtlasCreate( TexturePacker * TexPacker ) { std::string FPath( FileSystem::fileRemoveExtension( mTexturePacker->getFilepath() + EE_TEXTURE_ATLAS_EXTENSION ) ); - mTextureAtlasLoader = TextureAtlasLoader::New( FPath, true, cb::Make1( this, &TextureAtlasEditor::onTextureAtlasLoaded ) ); + bool threaded = mUIWindow->getSceneNode()->getWindow()->isThreadedGLContext(); + mTextureAtlasLoader = TextureAtlasLoader::New( FPath, threaded, cb::Make1( this, &TextureAtlasEditor::onTextureAtlasLoaded ) ); } void TextureAtlasEditor::updateControls() { @@ -386,25 +384,20 @@ void TextureAtlasEditor::onTextureRegionChange( const Event * Event ) { } } -void TextureAtlasEditor::update() { - if ( NULL != mTextureAtlasLoader && !mTextureAtlasLoader->isLoaded() ) { - mTextureAtlasLoader->update(); - } -} - void TextureAtlasEditor::openTextureAtlas( const Event * Event ) { eeSAFE_DELETE( mTextureAtlasLoader ); - bool threaded = true; - #if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN - threaded = false; - #endif + bool threaded = mUIWindow->getSceneNode()->getWindow()->isThreadedGLContext(); mTextureAtlasLoader = TextureAtlasLoader::New( Event->getNode()->asType()->getFullPath(), threaded, cb::Make1( this, &TextureAtlasEditor::onTextureAtlasLoaded ) ); } -void TextureAtlasEditor::onTextureAtlasLoaded( TextureAtlasLoader * ) { - if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->isLoaded() ) { - updateControls(); +void TextureAtlasEditor::onTextureAtlasLoaded( TextureAtlasLoader * textureAtlasLoader ) { + mTextureAtlasLoader = textureAtlasLoader; + + if ( mTextureAtlasLoader->isLoaded() ) { + mUIContainer->runOnMainThread( [&] { + updateControls(); + } ); } } diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index 6f6a2f5a4..cfc7d95ea 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -233,8 +233,11 @@ void UIListBox::removeListBoxItems( std::vector ItemsIndex ) { if ( !erase ) { ItemsCpy.push_back( mItems[i] ); mTexts.push_back( mItems[i]->getText() ); - } else { - eeSAFE_DELETE( mItems[i] ); // doesn't call to mItems[i]->Close(); because is not checking for close. + } else if ( NULL != mItems[i] ) { + mItems[i]->close(); + mItems[i]->setVisible( false ); + mItems[i]->setEnabled( false ); + mItems[i] = NULL; } } @@ -563,8 +566,11 @@ void UIListBox::updateScroll( bool fromScrollChange ) { } mVisibleLast = i; - } else { - eeSAFE_DELETE( mItems[i] ); + } else if ( NULL != mItems[i] ) { + mItems[i]->close(); + mItems[i]->setVisible( false ); + mItems[i]->setEnabled( false ); + mItems[i] = NULL; item = NULL; } @@ -611,7 +617,10 @@ void UIListBox::updateScroll( bool fromScrollChange ) { mVisibleLast = i; } else { - eeSAFE_DELETE( mItems[i] ); + mItems[i]->close(); + mItems[i]->setVisible( false ); + mItems[i]->setEnabled( false ); + mItems[i] = NULL; item = NULL; } diff --git a/src/eepp/ui/uinodedrawable.cpp b/src/eepp/ui/uinodedrawable.cpp index ceb1450d9..901d94fa8 100644 --- a/src/eepp/ui/uinodedrawable.cpp +++ b/src/eepp/ui/uinodedrawable.cpp @@ -524,6 +524,10 @@ bool UINodeDrawable::MoveAction::isDone() { return mElapsed.asMicroseconds() >= mDuration.asMicroseconds(); } +Float UINodeDrawable::MoveAction::getCurrentProgress() { + return mElapsed.asMilliseconds() / mDuration.asMilliseconds(); +} + void UINodeDrawable::MoveAction::onStart() { UINode * node = mNode->asType(); LayerDrawable * layer = node->getBackground()->getLayer(0); diff --git a/src/eepp/ui/uitable.cpp b/src/eepp/ui/uitable.cpp index 67da4497a..6ef1c71f8 100644 --- a/src/eepp/ui/uitable.cpp +++ b/src/eepp/ui/uitable.cpp @@ -383,8 +383,11 @@ void UITable::remove( std::vector ItemsIndex ) { if ( !erase ) { ItemsCpy.push_back( mItems[i] ); - } else { - eeSAFE_DELETE( mItems[i] ); // doesn't call to mItems[i]->Close(); because is not checking for close. + } else if ( NULL != mItems[i] ) { + mItems[i]->close(); + mItems[i]->setVisible( false ); + mItems[i]->setEnabled( false ); + mItems[i] = NULL; } } diff --git a/src/eepp/ui/uitabwidget.cpp b/src/eepp/ui/uitabwidget.cpp index 5d76fd2ff..2ff106ccb 100644 --- a/src/eepp/ui/uitabwidget.cpp +++ b/src/eepp/ui/uitabwidget.cpp @@ -385,7 +385,10 @@ void UITabWidget::remove( const Uint32& Index ) { mTabSelected->getControlOwned()->setEnabled( false ); } - eeSAFE_DELETE( mTabs[ Index ] ); + mTabs[ Index ]->close(); + mTabs[ Index ]->setVisible( false ); + mTabs[ Index ]->setEnabled( false ); + mTabs[ Index ] = NULL; mTabs.erase( mTabs.begin() + Index ); @@ -417,7 +420,11 @@ void UITabWidget::remove( UITab * Tab ) { void UITabWidget::removeAll() { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { - eeSAFE_DELETE( mTabs[ i ] ); + if ( NULL != mTabs[ i ] ) { + mTabs[ i ]->close(); + mTabs[ i ]->setVisible( false ); + mTabs[ i ]->setEnabled( false ); + } } mTabs.clear(); diff --git a/src/eepp/ui/uitextview.cpp b/src/eepp/ui/uitextview.cpp index 75b226773..81028fbd9 100644 --- a/src/eepp/ui/uitextview.cpp +++ b/src/eepp/ui/uitextview.cpp @@ -617,7 +617,8 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta SAVE_NORMAL_STATE_ATTR( String::format( "%dpx", getCharacterSize() ) ); setCharacterSize( attribute.asDpDimensionI() ); - } else if ( "font-style" == name || "textstyle" == name || "fontstyle" == name ) { + } else if ( "font-style" == name || "textstyle" == name || "fontstyle" == name || + "text-decoration" == name || "textdecoration" == name ) { Uint32 flags = attribute.asFontStyle(); SAVE_NORMAL_STATE_ATTR( Text::styleFlagToString( getFontStyle() ) ); diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index da9230d91..014db382b 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -293,7 +293,8 @@ void UIWindow::drawFrameBuffer() { if ( mFrameBuffer->hasColorBuffer() ) { mFrameBuffer->draw( Rect( 0, 0, mSize.getWidth(), mSize.getHeight() ), Rect( mScreenPos.x, mScreenPos.y, mScreenPos.x + mSize.getWidth(), mScreenPos.y + mSize.getHeight() ) ); } else { - TextureRegion textureRegion( mFrameBuffer->getTexture()->getTextureId(), Rect( 0, 0, mSize.getWidth(), mSize.getHeight() ) ); + Rect r( 0, 0, mSize.getWidth(), mSize.getHeight() ); + TextureRegion textureRegion( mFrameBuffer->getTexture()->getTextureId(), r, r.getSize().asFloat() ); textureRegion.draw( mScreenPosi.x, mScreenPosi.y, Color::White, getRotation(), getScale() ); } } diff --git a/src/eepp/window/backend/SDL2/windowsdl2.cpp b/src/eepp/window/backend/SDL2/windowsdl2.cpp index a61edb72f..85ca9152d 100644 --- a/src/eepp/window/backend/SDL2/windowsdl2.cpp +++ b/src/eepp/window/backend/SDL2/windowsdl2.cpp @@ -183,6 +183,7 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) { } #else mGLContext = SDL_GL_CreateContext( mSDLWindow ); + mWindow.ContextConfig.SharedGLContext = false; #endif if ( NULL == mGLContext diff --git a/src/tools/textureatlaseditor/textureatlaseditor.cpp b/src/tools/textureatlaseditor/textureatlaseditor.cpp index 00cd51f68..a057fde08 100644 --- a/src/tools/textureatlaseditor/textureatlaseditor.cpp +++ b/src/tools/textureatlaseditor/textureatlaseditor.cpp @@ -42,7 +42,7 @@ EE_MAIN_FUNC int main (int argc, char * argv []) { Display * currentDisplay = Engine::instance()->getDisplayManager()->getDisplayIndex(0); Float pixelDensity = PixelDensity::toFloat( currentDisplay->getPixelDensity() ); - win = Engine::instance()->createWindow( WindowSettings( 1280, 720, "eepp - Texture Atlas Editor", WindowStyle::Default, WindowBackend::Default, 32, "assets/icon/ee.png", pixelDensity ), ContextSettings( true, GLv_default, true, 24, 1, 0, false ) ); + win = Engine::instance()->createWindow( WindowSettings( 1280, 720, "eepp - Texture Atlas Editor", WindowStyle::Default, WindowBackend::Default, 32, "assets/icon/ee.png", pixelDensity ), ContextSettings( true, GLv_default, true, 24, 1, 0, true ) ); if ( win->isOpen() ) { PixelDensity::setPixelDensity( eemax( win->getScale(), pixelDensity ) );