From bd62abfe020e5a383f965f65648d710e672db24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 29 May 2013 15:16:55 -0300 Subject: [PATCH] cImage::GetInfo now also Fallback To Packs. --- projects/android-project/README | 2 ++ projects/linux/ee.creator.user | 6 +++--- src/eepp/graphics/cimage.cpp | 17 ++++++++++++++++- src/eepp/graphics/csprite.cpp | 8 ++++++++ src/test/eetest.cpp | 6 +++--- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/projects/android-project/README b/projects/android-project/README index 4d81d8eb8..e403e0224 100644 --- a/projects/android-project/README +++ b/projects/android-project/README @@ -1 +1,3 @@ Create a symbolic link to the assets folder in this current folder ( ln -s ../../assets ./assets ) + +If you are in Windows and you don't know how to make the symbolic link, just copy & paste the assets folder. diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index daf4548bf..414feeb17 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -48,9 +48,9 @@ Desktop Desktop {388e5431-b31b-42b3-b9ad-9002d279d75d} - 15 + 0 0 - 7 + 0 /home/programming/eepp/make/linux diff --git a/src/eepp/graphics/cimage.cpp b/src/eepp/graphics/cimage.cpp index 04c61291d..f220d0e69 100644 --- a/src/eepp/graphics/cimage.cpp +++ b/src/eepp/graphics/cimage.cpp @@ -48,7 +48,22 @@ EE_SAVE_TYPE cImage::ExtensionToSaveType( const std::string& Extension ) { } bool cImage::GetInfo( const std::string& path, int * width, int * height, int * channels ) { - return stbi_info( path.c_str(), width, height, channels ) != 0; + bool res = stbi_info( path.c_str(), width, height, channels ) != 0; + + if ( !res && cPackManager::instance()->FallbackToPacks() ) { + std::string npath( path ); + cPack * tPack = cPackManager::instance()->Exists( npath ); + + if ( NULL != tPack ) { + SafeDataPointer PData; + + tPack->ExtractFileToMemory( npath, PData ); + + res = stbi_info_from_memory( PData.Data, PData.DataSize, width, height, channels ); + } + } + + return res; } bool cImage::IsImage( const std::string& path ) { diff --git a/src/eepp/graphics/csprite.cpp b/src/eepp/graphics/csprite.cpp index 78dd9f733..4571cc734 100755 --- a/src/eepp/graphics/csprite.cpp +++ b/src/eepp/graphics/csprite.cpp @@ -346,6 +346,10 @@ bool cSprite::AddFramesByPatternId( const Uint32& SubTextureId, const std::strin return true; } + #ifdef EE_DEBUG + cLog::instance()->Write( "cSprite::AddFramesByPatternId: Couldn't find any pattern with Id: " + String::ToStr( SubTextureId ) ); + #endif + return false; } @@ -358,6 +362,10 @@ bool cSprite::AddFramesByPattern( const std::string& name, const std::string& ex return true; } + #ifdef EE_DEBUG + cLog::instance()->Write( "cSprite::AddFramesByPattern: Couldn't find any pattern with: " + name ); + #endif + return false; } diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 80718c4b1..c29ef1960 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -52,7 +52,7 @@ void cEETest::Init() { if ( NULL != mWindow && mWindow->Created() ) { SetScreen( StartScreen ); - mWindow->Caption( "EE++ Test Application" ); + mWindow->Caption( "eepp - Test Application" ); TF = cTextureFactory::instance(); TF->Allocate(40); @@ -138,8 +138,8 @@ void cEETest::CreateUIThemeTextureAtlas() { return; #endif - std::string tgpath( MyPath + "uithemeta/uitheme" ); - std::string Path( MyPath + "uitheme" ); + std::string tgpath( MyPath + "ui/uitheme" ); + std::string Path( MyPath + "ui/uitheme" ); if ( !FileSystem::FileExists( tgpath + EE_TEXTURE_ATLAS_EXTENSION ) ) { cTexturePacker tp( 256, 256, true, 2 );