mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 10:36:30 +03:00
Some clean up.
--HG-- branch : dev-font
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 4.9 KiB |
@@ -51,7 +51,7 @@ class tSoundLoader : public ObjectLoader {
|
||||
|
||||
void start();
|
||||
private:
|
||||
void loadFromPath();
|
||||
void loadFromFile();
|
||||
void loadFromMemory();
|
||||
void loadFromPack();
|
||||
void loadFromSamples();
|
||||
@@ -124,7 +124,7 @@ void tSoundLoader<T>::start() {
|
||||
ObjectLoader::start();
|
||||
|
||||
if ( SND_LT_PATH == mLoadType )
|
||||
loadFromPath();
|
||||
loadFromFile();
|
||||
else if ( SND_LT_MEM == mLoadType )
|
||||
loadFromMemory();
|
||||
else if ( SND_LT_PACK == mLoadType )
|
||||
@@ -137,7 +137,7 @@ void tSoundLoader<T>::start() {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void tSoundLoader<T>::loadFromPath() {
|
||||
void tSoundLoader<T>::loadFromFile() {
|
||||
mSndMngr->loadFromFile( mId, mFilepath );
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class EE_API TileMap {
|
||||
|
||||
virtual MapLayer * getLayer( const std::string& name );
|
||||
|
||||
virtual bool load( const std::string& path );
|
||||
virtual bool loadFromFile( const std::string& path );
|
||||
|
||||
virtual bool loadFromStream( IOStream& IOS );
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@ class EE_API Console : protected LogReaderInterface {
|
||||
Uint32 getBackgroundTextureId() const { return mTexId; }
|
||||
|
||||
/** Set the Console Background Color */
|
||||
void setBackgroundColor( const ColorA& BackColor ) { mConColor = BackColor; }
|
||||
void setBackgroundColor( const ColorA& BackColor ) { mConColor = BackColor; mMaxAlpha = mConColor.a(); }
|
||||
|
||||
void setCharacterSize( const Uint32& characterSize );
|
||||
|
||||
/** Get the Console Background Color */
|
||||
const ColorA& getBackgroundColor() const { return mConColor; }
|
||||
|
||||
@@ -66,7 +66,7 @@ class EE_API TextureAtlasLoader {
|
||||
* If the loader is not threaded, it will load the atlas immediately.
|
||||
* @param TextureAtlasPath The texture atlas path.
|
||||
*/
|
||||
void load( const std::string& TextureAtlasPath = "" );
|
||||
void loadFromFile( const std::string& TextureAtlasPath = "" );
|
||||
|
||||
/** Loads a texture atlas from a io stream.
|
||||
* If the loader is not threaded, it will load the atlas immediately.
|
||||
|
||||
@@ -16,7 +16,7 @@ class EE_API TextureAtlasManager : public ResourceManager<TextureAtlas> {
|
||||
virtual ~TextureAtlasManager();
|
||||
|
||||
/** Loads a texture atlas from its path ( the texture atlas binary is expected, not the texture, the ".eta" file ). */
|
||||
TextureAtlas * load( const std::string& TextureAtlasPath );
|
||||
TextureAtlas * loadFromFile( const std::string& TextureAtlasPath );
|
||||
|
||||
/** Loads a texture atlas from a io stream. */
|
||||
TextureAtlas * loadFromStream( IOStream& IOS );
|
||||
|
||||
@@ -80,7 +80,7 @@ class EE_API TextureFactory : protected Mutex {
|
||||
* @param KeepLocalCopy Keep the array data copy. ( useful if want to reload the texture )
|
||||
* @return The internal Texture Id
|
||||
*/
|
||||
Uint32 load( const std::string& Filepath, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
|
||||
Uint32 loadFromFile( const std::string& Filepath, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
|
||||
|
||||
/** Remove and Unload the Texture Id
|
||||
* @param TexId
|
||||
|
||||
@@ -119,7 +119,7 @@ class EE_API TextureLoader : public ObjectLoader {
|
||||
Clock mTE;
|
||||
|
||||
void loadFile();
|
||||
void loadFromPath();
|
||||
void loadFromFile();
|
||||
void loadFromMemory();
|
||||
void loadFromPack();
|
||||
void loadFromPixels();
|
||||
|
||||
@@ -30,7 +30,7 @@ class EE_API PackManager : public Container<Pack> {
|
||||
|
||||
/** @brief Sets if the files that failed to be loaded from the file system should try to be loaded from the currently open packs.
|
||||
** For example if you try to load a texture from the file system a fails it will search the same path in the opened packs, and load it from there.
|
||||
** TextureFactory::instance()->load( "mytexture.png" );
|
||||
** TextureFactory::instance()->loadFromFile( "mytexture.png" );
|
||||
** If the file is not in the file system, it will be searched in the opened packs, and loaded if is found.
|
||||
** In case that the process path is appended to the path... like Sys::GetProcessPath() + "mytexture.png", the process path will be removed from the file path.
|
||||
*/
|
||||
|
||||
@@ -51,11 +51,11 @@ class EE_API UITheme : protected ResourceManager<UISkin> {
|
||||
|
||||
static UITheme * loadFromTextureAtlas( UITheme * tTheme, Graphics::TextureAtlas * getTextureAtlas );
|
||||
|
||||
static UITheme * loadFromPath( UITheme * tTheme, const std::string& Path, const std::string ImgExt = "png" );
|
||||
static UITheme * loadFromFile( UITheme * tTheme, const std::string& Path, const std::string ImgExt = "png" );
|
||||
|
||||
static UITheme * loadFromTextureAtlas( Graphics::TextureAtlas * getTextureAtlas, const std::string& Name, const std::string NameAbbr );
|
||||
|
||||
static UITheme * loadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt = "png" );
|
||||
static UITheme * loadFromFile( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt = "png" );
|
||||
|
||||
void addThemeElement( const std::string& Element );
|
||||
|
||||
|
||||
@@ -886,7 +886,7 @@ void MapEditor::updateScroll() {
|
||||
void MapEditor::mapOpen( const UIEvent * Event ) {
|
||||
UICommonDialog * CDL = reinterpret_cast<UICommonDialog*> ( Event->getControl() );
|
||||
|
||||
if ( mUIMap->Map()->load( CDL->getFullPath() ) ) {
|
||||
if ( mUIMap->Map()->loadFromFile( CDL->getFullPath() ) ) {
|
||||
onMapLoad();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void UIMapNew::onOKClick( const UIEvent * Event ) {
|
||||
Map->setBackColor( ColorA( 100, 100, 100, 100 ) );
|
||||
Map->setGridLinesColor( ColorA( 150, 150, 150, 150 ) );
|
||||
Map->forceHeadersOnLoad( Sizei( w, h ), Sizei( tw, th ), ml, Flags );
|
||||
Map->load( mapPath );
|
||||
Map->loadFromFile( mapPath );
|
||||
Map->disableForcedHeaders();
|
||||
Map->mPath = oldPath;
|
||||
|
||||
|
||||
@@ -840,7 +840,7 @@ bool TileMap::loadFromStream( IOStream& IOS ) {
|
||||
if ( NULL == TextureAtlasManager::instance()->getByName( sgname ) ) {
|
||||
TextureAtlasLoader * tgl = eeNew( TextureAtlasLoader, () );
|
||||
|
||||
tgl->load( Sys::getProcessPath() + TextureAtlases[i] );
|
||||
tgl->loadFromFile( Sys::getProcessPath() + TextureAtlases[i] );
|
||||
|
||||
eeSAFE_DELETE( tgl );
|
||||
}
|
||||
@@ -1038,7 +1038,7 @@ const std::string& TileMap::getPath() const {
|
||||
return mPath;
|
||||
}
|
||||
|
||||
bool TileMap::load( const std::string& path ) {
|
||||
bool TileMap::loadFromFile( const std::string& path ) {
|
||||
if ( FileSystem::fileExists( path ) ) {
|
||||
mPath = path;
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ Console::~Console() {
|
||||
}
|
||||
}
|
||||
|
||||
void Console::setCharacterSize(const EE::Uint32 & characterSize) {
|
||||
mTextCache.setCharacterSize( characterSize );
|
||||
mFontSize = (Float)( mTextCache.getFont()->getLineSpacing( mTextCache.getCharacterSizePx() ) );
|
||||
}
|
||||
|
||||
void Console::create( Font* Font, const bool& MakeDefaultCommands, const bool& AttachToLog, const unsigned int& MaxLogLines, const Uint32& TextureId ) {
|
||||
if ( NULL == mWindow ) {
|
||||
mWindow = Engine::instance()->getCurrentWindow();
|
||||
|
||||
@@ -32,7 +32,7 @@ TextureAtlasLoader::TextureAtlasLoader( const std::string& TextureAtlasPath, con
|
||||
mTextureAtlas(NULL),
|
||||
mLoadCallback( LoadCallback )
|
||||
{
|
||||
load();
|
||||
loadFromFile();
|
||||
}
|
||||
|
||||
TextureAtlasLoader::TextureAtlasLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureAtlasName, const bool& Threaded, GLLoadCallback LoadCallback ) :
|
||||
@@ -134,7 +134,7 @@ void TextureAtlasLoader::loadFromStream( IOStream& IOS ) {
|
||||
}
|
||||
}
|
||||
|
||||
void TextureAtlasLoader::load( const std::string& TextureAtlasPath ) {
|
||||
void TextureAtlasLoader::loadFromFile( const std::string& TextureAtlasPath ) {
|
||||
if ( TextureAtlasPath.size() )
|
||||
mTextureAtlasPath = TextureAtlasPath;
|
||||
|
||||
@@ -359,7 +359,7 @@ bool TextureAtlasLoader::updateTextureAtlas( std::string TextureAtlasPath, std::
|
||||
return false;
|
||||
|
||||
mSkipResourceLoad = true;
|
||||
load( TextureAtlasPath );
|
||||
loadFromFile( TextureAtlasPath );
|
||||
mSkipResourceLoad = false;
|
||||
|
||||
if ( !mTempAtlass.size() )
|
||||
|
||||
@@ -15,7 +15,7 @@ TextureAtlasManager::TextureAtlasManager() :
|
||||
TextureAtlasManager::~TextureAtlasManager() {
|
||||
}
|
||||
|
||||
TextureAtlas * TextureAtlasManager::load( const std::string& TextureAtlasPath ) {
|
||||
TextureAtlas * TextureAtlasManager::loadFromFile( const std::string& TextureAtlasPath ) {
|
||||
TextureAtlasLoader loader( TextureAtlasPath );
|
||||
|
||||
return loader.getTextureAtlas();
|
||||
|
||||
@@ -55,7 +55,7 @@ Uint32 TextureFactory::loadFromStream( IOStream& Stream, const bool& Mipmap, con
|
||||
return myTex.getId();
|
||||
}
|
||||
|
||||
Uint32 TextureFactory::load( const std::string& Filepath, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
|
||||
Uint32 TextureFactory::loadFromFile( const std::string& Filepath, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
|
||||
TextureLoader myTex( Filepath, Mipmap, ClampMode, CompressTexture, KeepLocalCopy );
|
||||
myTex.load();
|
||||
return myTex.getId();
|
||||
|
||||
@@ -232,7 +232,7 @@ void TextureLoader::start() {
|
||||
mTE.restart();
|
||||
|
||||
if ( TEX_LT_PATH == mLoadType )
|
||||
loadFromPath();
|
||||
loadFromFile();
|
||||
else if ( TEX_LT_MEM == mLoadType )
|
||||
loadFromMemory();
|
||||
else if ( TEX_LT_PACK == mLoadType )
|
||||
@@ -255,7 +255,7 @@ void TextureLoader::loadFile() {
|
||||
fs.read( reinterpret_cast<char*> ( mPixels ), mSize );
|
||||
}
|
||||
|
||||
void TextureLoader::loadFromPath() {
|
||||
void TextureLoader::loadFromFile() {
|
||||
if ( FileSystem::fileExists( mFilepath ) ) {
|
||||
mImgType = stbi_test( mFilepath.c_str() );
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ UITheme * UITheme::loadFromTextureAtlas( UITheme * tTheme, Graphics::TextureAtla
|
||||
return tTheme;
|
||||
}
|
||||
|
||||
UITheme * UITheme::loadFromPath( UITheme * tTheme, const std::string& Path, const std::string ImgExt ) {
|
||||
UITheme * UITheme::loadFromFile( UITheme * tTheme, const std::string& Path, const std::string ImgExt ) {
|
||||
Clock TE;
|
||||
|
||||
loadThemeElements( tTheme->mUIElements, tTheme->mUIIcons );
|
||||
@@ -210,7 +210,7 @@ UITheme * UITheme::loadFromPath( UITheme * tTheme, const std::string& Path, cons
|
||||
Element = RPath + ElemName + "." + ImgExt;
|
||||
|
||||
if ( FileSystem::fileExists( Element ) ) {
|
||||
tSG->add( eeNew( SubTexture, ( TextureFactory::instance()->load( Element ), ElemName ) ) );
|
||||
tSG->add( eeNew( SubTexture, ( TextureFactory::instance()->loadFromFile( Element ), ElemName ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,8 +231,8 @@ UITheme * UITheme::loadFromPath( UITheme * tTheme, const std::string& Path, cons
|
||||
return tTheme;
|
||||
}
|
||||
|
||||
UITheme * UITheme::loadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt ) {
|
||||
return loadFromPath( eeNew( UITheme, ( Name, NameAbbr ) ), Path, ImgExt );
|
||||
UITheme * UITheme::loadFromFile( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt ) {
|
||||
return loadFromFile( eeNew( UITheme, ( Name, NameAbbr ) ), Path, ImgExt );
|
||||
}
|
||||
|
||||
UITheme * UITheme::loadFromTextureAtlas( Graphics::TextureAtlas * TextureAtlas, const std::string& Name, const std::string NameAbbr ) {
|
||||
@@ -293,7 +293,7 @@ bool UITheme::searchFilesOfElement( Graphics::TextureAtlas * SG, const std::stri
|
||||
ElemFullPath = ElemPath + "." + ImgExt;
|
||||
|
||||
if ( FileSystem::fileExists( ElemFullPath ) ) {
|
||||
SG->add( eeNew( SubTexture, ( TextureFactory::instance()->load( ElemFullPath ), ElemName ) ) );
|
||||
SG->add( eeNew( SubTexture, ( TextureFactory::instance()->loadFromFile( ElemFullPath ), ElemName ) ) );
|
||||
|
||||
IsComplex = 1;
|
||||
Found = true;
|
||||
@@ -310,7 +310,7 @@ bool UITheme::searchFilesOfElement( Graphics::TextureAtlas * SG, const std::stri
|
||||
ElemFullPath = ElemPath + "." + ImgExt;
|
||||
|
||||
if ( FileSystem::fileExists( ElemFullPath ) ) {
|
||||
SG->add( eeNew( SubTexture, ( TextureFactory::instance()->load( ElemFullPath ), ElemName ) ) );
|
||||
SG->add( eeNew( SubTexture, ( TextureFactory::instance()->loadFromFile( ElemFullPath ), ElemName ) ) );
|
||||
|
||||
Found = true;
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
std::string AppPath = Sys::getProcessPath();
|
||||
|
||||
// Load the rock texture
|
||||
Uint32 PlanetId = TextureFactory::instance()->load( AppPath + "assets/sprites/7.png" );
|
||||
Uint32 RockId = TextureFactory::instance()->load( AppPath + "assets/sprites/5.png" );
|
||||
Uint32 PlanetId = TextureFactory::instance()->loadFromFile( AppPath + "assets/sprites/7.png" );
|
||||
Uint32 RockId = TextureFactory::instance()->loadFromFile( AppPath + "assets/sprites/5.png" );
|
||||
|
||||
// Load a previously generated texture atlas that contains the SubTextures needed to load an animated sprite
|
||||
TextureAtlasLoader Blindies( AppPath + "assets/atlases/bnb.eta" );
|
||||
|
||||
@@ -177,7 +177,7 @@ void EETest::loadFonts() {
|
||||
|
||||
void EETest::onFontLoaded( ResourceLoader * ObjLoaded ) {
|
||||
TTF = FontManager::instance()->getByName( "arial" );
|
||||
DBSM = FontManager::instance()->getByName( "DejaVuSansMono" );
|
||||
Font * DBSM = FontManager::instance()->getByName( "DejaVuSansMono" );
|
||||
|
||||
eePRINTL( "Fonts loading time: %4.3f ms.", mFTE.getElapsed().asMilliseconds() );
|
||||
|
||||
@@ -185,8 +185,10 @@ void EETest::onFontLoaded( ResourceLoader * ObjLoaded ) {
|
||||
eeASSERT( DBSM != NULL );
|
||||
|
||||
Con.create( DBSM, true );
|
||||
Con.setBackgroundColor( 0x201f1fEE );
|
||||
Con.setFontColor( 0xcfcfcfff );
|
||||
Con.ignoreCharOnPrompt( 186 ); // 'º'
|
||||
Con.getTextCache().setOutlineThickness( 1 );
|
||||
Con.getTextCache().setCharacterSize( 12 );
|
||||
Con.getTextCache().setOutlineColor( ColorA(0,0,0,150) );
|
||||
|
||||
mBuda = String::fromUtf8( "El mono ve el pez en el agua y sufre. Piensa que su mundo es el único que existe, el mejor, el real. Sufre porque es bueno y tiene compasión, lo ve y piensa: \"Pobre se está ahogando no puede respirar\". Y lo saca, lo saca y se queda tranquilo, por fin lo salvé. Pero el pez se retuerce de dolor y muere. Por eso te mostré el sueño, es imposible meter el mar en tu cabeza, que es un balde." );
|
||||
@@ -275,7 +277,7 @@ void EETest::createUI() {
|
||||
//UI_MAN_OPS = UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER | UI_MANAGER_DRAW_DEBUG_DATA | UI_MANAGER_DRAW_BOXES;
|
||||
UIManager::instance()->init(UI_MAN_OPS);
|
||||
|
||||
//mTheme = UITheme::loadFromPath( eeNew( UIThemeDefault, ( mThemeName, mThemeName ) ), MyPath + mThemeName + "/" );
|
||||
//mTheme = UITheme::loadFromFile( eeNew( UIThemeDefault, ( mThemeName, mThemeName ) ), MyPath + mThemeName + "/" );
|
||||
|
||||
TextureAtlasLoader tgl( MyPath + "ui/" + mThemeName + EE_TEXTURE_ATLAS_EXTENSION );
|
||||
|
||||
@@ -465,10 +467,10 @@ void EETest::createUI() {
|
||||
#ifdef EE_PLATFORM_TOUCH
|
||||
TextureAtlas * SG = GlobalTextureAtlas::instance();
|
||||
|
||||
Texture * butTex = TF->getTexture( TF->load( MyPath + "sprites/button-te_normal.png" ) );
|
||||
Texture * butTex = TF->getTexture( TF->loadFromFile( MyPath + "sprites/button-te_normal.png" ) );
|
||||
|
||||
SG->add( butTex->getId(), "button-te_normal" );
|
||||
SG->add( TF->load( MyPath + "sprites/button-te_mdown.png" ), "button-te_mdown" );
|
||||
SG->add( TF->loadFromFile( MyPath + "sprites/button-te_mdown.png" ), "button-te_mdown" );
|
||||
|
||||
UISkinSimple nSkin( "button-te" );
|
||||
Sizei screenSize = UIManager::instance()->getMainControl()->getSize();
|
||||
@@ -1024,7 +1026,7 @@ void EETest::loadTextures() {
|
||||
TNP.resize(12);
|
||||
|
||||
for ( i = 0; i <= 6; i++ ) {
|
||||
TN[i] = TF->load( MyPath + "sprites/" + String::toStr(i+1) + ".png", (i+1) == 7 ? true : false, ( (i+1) == 4 ) ? CLAMP_REPEAT : CLAMP_TO_EDGE );
|
||||
TN[i] = TF->loadFromFile( MyPath + "sprites/" + String::toStr(i+1) + ".png", (i+1) == 7 ? true : false, ( (i+1) == 4 ) ? CLAMP_REPEAT : CLAMP_TO_EDGE );
|
||||
TNP[i] = TF->getTexture( TN[i] );
|
||||
}
|
||||
|
||||
@@ -1038,14 +1040,14 @@ void EETest::loadTextures() {
|
||||
Tiles[i] = SG->getByName( String::toStr( i+1 ) );
|
||||
}
|
||||
|
||||
Tiles[6] = SG->add( TF->load( MyPath + "sprites/objects/1.png" ), "7" );
|
||||
Tiles[6] = SG->add( TF->loadFromFile( MyPath + "sprites/objects/1.png" ), "7" );
|
||||
|
||||
#ifdef EE_GLES
|
||||
Image tImg( MyPath + "sprites/objects/2.png", 4 );
|
||||
tImg.CreateMaskFromColor( ColorA(0,0,0,255), 0 );
|
||||
Tiles[7] = SG->Add( TF->loadFromPixels( tImg.getPixelsPtr(), tImg.getWidth(), tImg.getHeight(), tImg.getChannels() ), "8" );
|
||||
#else
|
||||
Tiles[7] = SG->add( TF->load( MyPath + "sprites/objects/2.png" ), "8" );
|
||||
Tiles[7] = SG->add( TF->loadFromFile( MyPath + "sprites/objects/2.png" ), "8" );
|
||||
Tiles[7]->getTexture()->createMaskFromColor( ColorA(0,0,0,255), 0 );
|
||||
#endif
|
||||
}
|
||||
@@ -1085,7 +1087,7 @@ void EETest::loadTextures() {
|
||||
Tex->unlock(false, true);
|
||||
}
|
||||
|
||||
Cursor[0] = TF->load( MyPath + "cursors/cursor.tga" );
|
||||
Cursor[0] = TF->loadFromFile( MyPath + "cursors/cursor.tga" );
|
||||
CursorP[0] = TF->getTexture( Cursor[0] );
|
||||
|
||||
CursorManager * CurMan = mWindow->getCursorManager();
|
||||
@@ -1112,7 +1114,7 @@ void EETest::loadTextures() {
|
||||
|
||||
eePRINTL( "Textures loading time: %4.3f ms.", TE.getElapsed().asMilliseconds() );
|
||||
|
||||
Map.load( MyPath + "maps/test.eem" );
|
||||
Map.loadFromFile( MyPath + "maps/test.eem" );
|
||||
Map.setDrawGrid( false );
|
||||
Map.setClipedArea( false );
|
||||
Map.setDrawBackground( false );
|
||||
|
||||
@@ -62,7 +62,6 @@ class EETest : private Thread {
|
||||
Sprite SP;
|
||||
Sprite CL1, CL2;
|
||||
Font * TTF;
|
||||
Font * DBSM;
|
||||
|
||||
Primitives PR;
|
||||
bool iL1, iL2;
|
||||
|
||||
Reference in New Issue
Block a user