Added UpdateTextureAtlas function on cTextureGroupLoader. This is to update a current texture atlas, it will check if some image was changed and update it, and if some images where added or removed it will recreate the whole texture atlas.

Changed the name of the singleton template from cSingleton to tSingleton ( c is for class, and t for template, that's why i changed ).
Removed the using namespace std, and added std:: to the std methods and templates.
Added some API calls for windows dll.
Added SaveTypeToExtension and DirPathAddSlashAtEnd on utils.
This commit is contained in:
spartanj
2010-08-30 00:07:43 -03:00
parent bb8760ec42
commit d9bd5d763f
36 changed files with 433 additions and 196 deletions

View File

@@ -7,31 +7,31 @@ namespace EE { namespace Audio {
typedef Vector3<ALfloat> Vector3AL; //! Use this special vector because OpenAL doesn't support doubles.
/** @brief Listener is a global interface for defining the audio listener properties. */
class EE_API cAudioListener : public cSingleton<cAudioListener> {
class EE_API cAudioListener : public tSingleton<cAudioListener> {
public:
/** Change the global volume of all the sounds. ( default 100 )
/** Change the global volume of all the sounds. ( default 100 )
* @param Volume New global volume, in the range [0, 100]
*/
void SetGlobalVolume( const ALfloat& Volume );
/** Get the Global Volume */
ALfloat GetGlobalVolume();
/** Change the position of the listener. \n The default position is (0, 0, 0) */
void SetPosition( const ALfloat& X, const ALfloat& Y, const ALfloat& Z );
/** Change the position of the listener from a 3D vector. */
void SetPosition(const Vector3AL& Position);
/** Get the current position of the listener */
Vector3AL GetPosition();
/** Change the orientation of the listener (the point he must look at). \n The default target is (0, 0, -1). */
void SetTarget( const ALfloat& X, const ALfloat& Y, const ALfloat& Z );
/** Change the orientation of the listener from a 3D vector. */
void SetTarget(const Vector3AL& Target);
/** Get the current orientation of the listener (the point he's looking at) */
Vector3AL GetTarget();
};

View File

@@ -98,7 +98,7 @@ namespace EE {
#define eeSAFE_DELETE_ARRAY(p) { if(p) { delete[](p); (p)=NULL; } }
typedef float eeFloat; //! The internal floating point used on EE++. \n This can help to improve compatibility with some platforms. \n And helps for an easy change from single precision to double precision.
typedef double eeDouble; //! The internal double floating point. It's only used when the engine needs some very high precision floating point ( for example the timer )
typedef double eeDouble; //! The internal double floating point. It's only used when the engine needs some very high precision floating point ( for example the timer )
typedef unsigned int eeUint;
typedef signed int eeInt;
@@ -110,8 +110,6 @@ namespace EE {
#ifdef EE_GLES
const GLubyte EE_GLES_INDICES [] = {0, 3, 1, 2};
#endif
using namespace std;
}
#endif

View File

@@ -6,8 +6,8 @@
namespace EE { namespace Graphics {
class EE_API cFontManager : public tResourceManager<cFont>, public cSingleton<cFontManager> {
friend class cSingleton<cFontManager>;
class EE_API cFontManager : public tResourceManager<cFont>, public tSingleton<cFontManager> {
friend class tSingleton<cFontManager>;
public:
cFontManager();

View File

@@ -9,7 +9,7 @@ using namespace EE::Window;
namespace EE { namespace Graphics {
class cFrameBuffer {
class EE_API cFrameBuffer {
public:
static cFrameBuffer * CreateNew( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false );

View File

@@ -7,7 +7,7 @@
namespace EE { namespace Graphics {
class cFrameBufferFBO : public cFrameBuffer {
class EE_API cFrameBufferFBO : public cFrameBuffer {
public:
cFrameBufferFBO();

View File

@@ -43,7 +43,7 @@
namespace EE { namespace Graphics {
class cFrameBufferPBuffer : public cFrameBuffer {
class EE_API cFrameBufferPBuffer : public cFrameBuffer {
public:
cFrameBufferPBuffer();

View File

@@ -7,8 +7,8 @@
namespace EE { namespace Graphics {
/** @brief The global Batch Renderer class. This class will be used by the engine for the rendering. */
class EE_API cGlobalBatchRenderer : public cSingleton<cGlobalBatchRenderer>, public cBatchRenderer {
friend class cSingleton<cGlobalBatchRenderer>;
class EE_API cGlobalBatchRenderer : public tSingleton<cGlobalBatchRenderer>, public cBatchRenderer {
friend class tSingleton<cGlobalBatchRenderer>;
public:
cGlobalBatchRenderer();
~cGlobalBatchRenderer();

View File

@@ -6,8 +6,8 @@
namespace EE { namespace Graphics {
class EE_API cGlobalShapeGroup : public cShapeGroup, public cSingleton<cGlobalShapeGroup> {
friend class cSingleton<cGlobalShapeGroup>;
class EE_API cGlobalShapeGroup : public cShapeGroup, public tSingleton<cGlobalShapeGroup> {
friend class tSingleton<cGlobalShapeGroup>;
public:
cGlobalShapeGroup();

View File

@@ -16,9 +16,9 @@ cShader::cShader( const Uint32& Type, const std::string& Filename ) {
cLog::instance()->Write( std::string( "Couldn't open shader object: " ) + Filename );
}
fs.seekg ( 0, ios::end );
fs.seekg ( 0, std::ios::end );
Int32 Length = fs.tellg();
fs.seekg ( 0, ios::beg );
fs.seekg ( 0, std::ios::beg );
std::string Buffer( Length + 1, 0 );
fs.read( reinterpret_cast<char*> ( &Buffer[0] ), Length );
fs.close();

View File

@@ -6,8 +6,8 @@
namespace EE { namespace Graphics {
class EE_API cShaderProgramManager : public tResourceManager<cShaderProgram>, public cSingleton<cShaderProgramManager> {
friend class cSingleton<cShaderProgramManager>;
class EE_API cShaderProgramManager : public tResourceManager<cShaderProgram>, public tSingleton<cShaderProgramManager> {
friend class tSingleton<cShaderProgramManager>;
public:
cShaderProgramManager();

View File

@@ -7,8 +7,8 @@
namespace EE { namespace Graphics {
class EE_API cShapeGroupManager : public tResourceManager<cShapeGroup>, public cSingleton<cShapeGroupManager> {
friend class cSingleton<cShapeGroupManager>;
class EE_API cShapeGroupManager : public tResourceManager<cShapeGroup>, public tSingleton<cShapeGroupManager> {
friend class tSingleton<cShapeGroupManager>;
public:
cShapeGroupManager();

View File

@@ -13,8 +13,8 @@ namespace EE { namespace Graphics {
class cGlobalBatchRenderer;
/** @brief The Texture Manager Class. Here we do all the textures stuff. (Singleton Class) */
class EE_API cTextureFactory: public cSingleton<cTextureFactory>, protected cMutex {
friend class cSingleton<cTextureFactory>;
class EE_API cTextureFactory: public tSingleton<cTextureFactory>, protected cMutex {
friend class tSingleton<cTextureFactory>;
public:
/** Create an empty texture
* @param Width Texture Width

View File

@@ -1,13 +1,17 @@
#include "ctexturegrouploader.hpp"
#include "cshapegroup.hpp"
#include "cshapegroupmanager.hpp"
#include "ctexturepacker.hpp"
#include "../helper/SOIL/stb_image.h"
#include "../helper/SOIL/SOIL.h"
namespace EE { namespace Graphics {
cTextureGroupLoader::cTextureGroupLoader() :
mThreaded(false),
mLoaded(false),
mAppPath( AppPath() )
mAppPath( AppPath() ),
mSkipResourceLoad(false)
{
}
@@ -15,11 +19,35 @@ cTextureGroupLoader::cTextureGroupLoader( const std::string& TextureGroupPath, c
mTextureGroupPath( TextureGroupPath ),
mThreaded( Threaded ),
mLoaded(false),
mAppPath( AppPath() )
mAppPath( AppPath() ),
mPack(NULL),
mSkipResourceLoad(false)
{
Load();
}
cTextureGroupLoader::cTextureGroupLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureGroupName, const bool& Threaded ) :
mTextureGroupPath( TextureGroupName ),
mThreaded( Threaded ),
mLoaded(false),
mAppPath( AppPath() ),
mPack(NULL),
mSkipResourceLoad(false)
{
LoadFromMemory( Data, DataSize, TextureGroupName );
}
cTextureGroupLoader::cTextureGroupLoader( cPack * Pack, const std::string& FilePackPath, const bool& Threaded ) :
mTextureGroupPath( FilePackPath ),
mThreaded( Threaded ),
mLoaded(false),
mAppPath( AppPath() ),
mPack(NULL),
mSkipResourceLoad(false)
{
LoadFromPack( Pack, FilePackPath );
}
cTextureGroupLoader::~cTextureGroupLoader()
{
}
@@ -37,15 +65,13 @@ void cTextureGroupLoader::Load( const std::string& TextureGroupPath ) {
if ( TextureGroupPath.size() )
mTextureGroupPath = TextureGroupPath;
sTextureGroupHdr TexGrHdr;
std::fstream fs ( mTextureGroupPath.c_str() , std::ios::in | std::ios::binary );
if ( fs.is_open() ) {
fs.read( reinterpret_cast<char*> (&TexGrHdr), sizeof(sTextureGroupHdr) );
fs.read( reinterpret_cast<char*> (&mTexGrHdr), sizeof(sTextureGroupHdr) );
if ( TexGrHdr.Magic == ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ) ) {
for ( Uint32 i = 0; i < TexGrHdr.TextureCount; i++ ) {
if ( mTexGrHdr.Magic == ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ) ) {
for ( Uint32 i = 0; i < mTexGrHdr.TextureCount; i++ ) {
sTextureHdr tTextureHdr;
sTempTexGroup tTexGroup;
@@ -57,7 +83,8 @@ void cTextureGroupLoader::Load( const std::string& TextureGroupPath ) {
std::string name( &tTextureHdr.Name[0] );
std::string path( FileRemoveFileName( mTextureGroupPath ) + name );
mRL.Add( new cTextureLoader( path ) );
if ( !mSkipResourceLoad )
mRL.Add( new cTextureLoader( path ) );
fs.read( reinterpret_cast<char*> (&tTexGroup.Shapes[0]), sizeof(sShapeHdr) * tTextureHdr.ShapeCount );
@@ -65,7 +92,8 @@ void cTextureGroupLoader::Load( const std::string& TextureGroupPath ) {
}
}
mRL.Load();
if ( !mSkipResourceLoad )
mRL.Load();
if ( !mThreaded )
CreateShapes();
@@ -74,6 +102,8 @@ void cTextureGroupLoader::Load( const std::string& TextureGroupPath ) {
void cTextureGroupLoader::LoadFromPack( cPack * Pack, const std::string& FilePackPath ) {
if ( NULL != Pack && Pack->IsOpen() && -1 != Pack->Exists( FilePackPath ) ) {
mPack = Pack;
std::vector<Uint8> TempData;
Pack->ExtractFileToMemory( FilePackPath, TempData );
@@ -88,16 +118,14 @@ void cTextureGroupLoader::LoadFromMemory( const Uint8* Data, const Uint32& DataS
if ( TextureGroupName.size() )
mTextureGroupPath = TextureGroupName;
sTextureGroupHdr TexGrHdr;
const Uint8* dataPtr = Data;
if ( NULL != dataPtr ) {
memcpy( (void*)&TexGrHdr, dataPtr, sizeof(sTextureGroupHdr) );
memcpy( (void*)&mTexGrHdr, dataPtr, sizeof(sTextureGroupHdr) );
dataPtr += sizeof(sTextureGroupHdr);
if ( TexGrHdr.Magic == ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ) ) {
for ( Uint32 i = 0; i < TexGrHdr.TextureCount; i++ ) {
if ( mTexGrHdr.Magic == ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ) ) {
for ( Uint32 i = 0; i < mTexGrHdr.TextureCount; i++ ) {
sTextureHdr tTextureHdr;
sTempTexGroup tTexGroup;
@@ -110,7 +138,10 @@ void cTextureGroupLoader::LoadFromMemory( const Uint8* Data, const Uint32& DataS
std::string name( &tTextureHdr.Name[0] );
std::string path( FileRemoveFileName( mTextureGroupPath ) + name );
mRL.Add( new cTextureLoader( path ) );
if ( NULL != mPack )
mRL.Add( new cTextureLoader( mPack, path ) );
else
mRL.Add( new cTextureLoader( mAppPath + path ) );
memcpy( (void*)(&tTexGroup.Shapes[0]), dataPtr, sizeof(sShapeHdr) * tTextureHdr.ShapeCount );
dataPtr += sizeof(sShapeHdr) * tTextureHdr.ShapeCount;
@@ -145,7 +176,7 @@ void cTextureGroupLoader::CreateShapes() {
// Create the Shape Group with the name of the real texture, not the Childs ( example load 1.png and not 1_ch1.png )
if ( 0 == z ) {
if ( tTexHdr->Flags & HDR_TEXTURE_FLAG_REMOVE_EXTENSION )
if ( mTexGrHdr.Flags & HDR_TEXTURE_GROUP_REMOVE_EXTENSION )
name = FileRemoveExtension( name );
tSG = new cShapeGroup( name );
@@ -158,7 +189,7 @@ void cTextureGroupLoader::CreateShapes() {
std::string ShapeName( &tSh->Name[0] );
if ( tSh->Flags & HDR_SHAPE_FLAG_REMOVE_EXTENSION )
if ( mTexGrHdr.Flags & HDR_TEXTURE_GROUP_REMOVE_EXTENSION )
ShapeName = FileRemoveExtension( ShapeName );
eeRecti tRect( tSh->X, tSh->Y, tSh->X + tSh->Width, tSh->Y + tSh->Height );
@@ -191,5 +222,155 @@ const bool& cTextureGroupLoader::IsLoaded() const {
return mLoaded;
}
}}
bool cTextureGroupLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std::string ImagesPath ) {
if ( !TextureAtlasPath.size() || !ImagesPath.size() || !FileExists( TextureAtlasPath ) || !IsDirectory( ImagesPath ) )
return false;
mSkipResourceLoad = true;
Load( TextureAtlasPath );
mSkipResourceLoad = false;
if ( !mTempGroups.size() )
return false;
Int32 x, y, c;
Int32 NeedUpdate = 0;
DirPathAddSlashAtEnd( ImagesPath );
Uint32 z;
Uint32 totalShapes = 0;
for ( z = 0; z < mTempGroups.size(); z++ )
totalShapes += mTempGroups[z].Texture.ShapeCount;
Uint32 totalImages = 0;
std::vector<std::string> PathFiles = FilesGetInPath( ImagesPath );
for ( z = 0; z < PathFiles.size(); z++ ) {
std::string realpath( ImagesPath + PathFiles[z] );
if ( stbi_info( realpath.c_str(), &x, &y, &c ) )
totalImages++;
}
if ( totalShapes != totalImages ) {
NeedUpdate = 2;
} else {
for ( z = 0; z < mTempGroups.size(); z++ ) {
sTempTexGroup * tTexGroup = &mTempGroups[z];
sTextureHdr * tTexHdr = &tTexGroup->Texture;
if ( 2 != NeedUpdate ) {
for ( Int32 i = 0; i < tTexHdr->ShapeCount; i++ ) {
sShapeHdr * tSh = &tTexGroup->Shapes[i];
std::string path( ImagesPath + tSh->Name );
if ( FileExists( path ) ) {
if ( stbi_info( path.c_str(), &x, &y, &c ) ) {
if ( tSh->Date != FileGetModificationDate( path ) ) {
if ( ( !( tSh->Flags & HDR_SHAPE_FLAG_FLIPED ) && tSh->Width == x && tSh->Height == y ) || // If size or channels changed, the image need update
( ( tSh->Flags & HDR_SHAPE_FLAG_FLIPED ) && tSh->Width == y && tSh->Height == x ) ||
tSh->Channels != c
)
{
NeedUpdate = 1;
} else {
NeedUpdate = 2;
break;
}
}
} else {
NeedUpdate = 2; // Something is wrong on the image
}
} else {
NeedUpdate = 2; // Need recreation of the whole texture atlas, some image where deleted.
break;
}
}
} else {
break;
}
}
}
if ( NeedUpdate ) {
std::string tapath( FileRemoveExtension( TextureAtlasPath ) + "." + SaveTypeToExtension( mTexGrHdr.Format ) );
if ( 2 == NeedUpdate ) {
cTexturePacker tp( mTexGrHdr.Width, mTexGrHdr.Height, mTexGrHdr.Flags & HDR_TEXTURE_GROUP_POW_OF_TWO, mTexGrHdr.PixelBorder, mTexGrHdr.Flags & HDR_TEXTURE_GROUP_ALLOW_FLIPPING );
tp.AddTexturesPath( ImagesPath );
tp.PackTextures();
tp.Save( tapath, (EE_SAVETYPE)mTexGrHdr.Format );
} else if ( 1 == NeedUpdate ) {
std::string etgpath = FileRemoveExtension( tapath ) + ".etg";
std::fstream fs ( etgpath.c_str() , std::ios::out | std::ios::binary );
if ( !fs.is_open() )
return false;
fs.write( reinterpret_cast<const char*> (&mTexGrHdr), sizeof(sTextureGroupHdr) );
for ( Uint32 z = 0; z < mTempGroups.size(); z++ ) {
if ( z != 0 ) {
tapath = FileRemoveExtension( TextureAtlasPath ) + "_ch" + toStr( z ) + "." + SaveTypeToExtension( mTexGrHdr.Format );
}
unsigned char * imgPtr = SOIL_load_image( tapath.c_str(), &x, &y, &c, SOIL_LOAD_AUTO );
if ( NULL != imgPtr ) {
cImage Img( imgPtr, x, y, c );
Img.AvoidFreeImage( true );
sTempTexGroup * tTexGroup = &mTempGroups[z];
sTextureHdr * tTexHdr = &tTexGroup->Texture;
fs.write( reinterpret_cast<const char*> (tTexHdr), sizeof(sTextureHdr) );
for ( Int32 i = 0; i < tTexHdr->ShapeCount; i++ ) {
sShapeHdr * tSh = &tTexGroup->Shapes[i];
std::string imgcopypath( ImagesPath + tSh->Name );
Uint32 ModifDate = FileGetModificationDate( imgcopypath );
if ( tSh->Date != ModifDate ) {
tSh->Date = ModifDate; // Update the shape hdr
unsigned char * imgCopyPtr = SOIL_load_image( imgcopypath.c_str(), &x, &y, &c, SOIL_LOAD_AUTO );
if ( NULL != imgCopyPtr ) {
cImage ImgCopy( imgCopyPtr, x, y, c );
ImgCopy.AvoidFreeImage( true );
Img.CopyImage( &ImgCopy, tSh->X, tSh->Y ); // Update the image into the texture atlas
SOIL_free_image_data( imgCopyPtr );
} else
break;
}
}
fs.write( reinterpret_cast<const char*> (&tTexGroup->Shapes[0]), sizeof(sShapeHdr) * tTexHdr->ShapeCount );
Img.SaveToFile( tapath, (EE_SAVETYPE)mTexGrHdr.Format );
SOIL_free_image_data( imgPtr );
}
else
return false; // fatal error
}
fs.close();
}
}
return true;
}
}}

View File

@@ -17,6 +17,10 @@ class EE_API cTextureGroupLoader {
cTextureGroupLoader( const std::string& TextureGroupPath, const bool& Threaded = false );
cTextureGroupLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureGroupName, const bool& Threaded = false );
cTextureGroupLoader( cPack * Pack, const std::string& FilePackPath, const bool& Threaded = false );
~cTextureGroupLoader();
void Update();
@@ -32,18 +36,24 @@ class EE_API cTextureGroupLoader {
void Threaded( const bool& threaded );
const bool& IsLoaded() const;
/** Will check if the texture atlas is updated ( all the image of the path are inside the texture atlas, and are the same version, otherwise it will recreate or update the texture atlas. */
bool UpdateTextureAtlas( std::string TextureAtlasPath, std::string ImagesPath );
protected:
cResourceLoader mRL;
std::string mTextureGroupPath;
bool mThreaded;
bool mLoaded;
std::string mAppPath;
cPack * mPack;
bool mSkipResourceLoad;
typedef struct sTempTexGroupS {
sTextureHdr Texture;
std::vector<sShapeHdr> Shapes;
} sTempTexGroup;
sTextureGroupHdr mTexGrHdr;
std::vector<sTempTexGroup> mTempGroups;
void CreateShapes();

View File

@@ -352,8 +352,7 @@ void cTexturePacker::CreateChild() {
bool cTexturePacker::AddTexturesPath( std::string TexturesPath ) {
if ( IsDirectory( TexturesPath ) ) {
if ( TexturesPath[ TexturesPath.size() - 1 ] != '/' && TexturesPath[ TexturesPath.size() - 1 ] != '\\' )
TexturesPath += "/";
DirPathAddSlashAtEnd( TexturesPath );
std::vector<std::string > files = FilesGetInPath( TexturesPath );
std::sort( files.begin(), files.end() );
@@ -528,6 +527,8 @@ void cTexturePacker::Save( const std::string& Filepath, const EE_SAVETYPE& Forma
}
}
mFormat = Format;
Img.SaveToFile( Filepath, Format );
ChildSave( Format );
@@ -555,6 +556,20 @@ void cTexturePacker::SaveShapes() {
TexGrHdr.Magic = ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) );
TexGrHdr.TextureCount = 1 + GetChildCount();
TexGrHdr.Format = mFormat;
TexGrHdr.Width = mWidth;
TexGrHdr.Height = mHeight;
TexGrHdr.PixelBorder = mPixelBorder;
TexGrHdr.Flags = 0;
if ( mAllowFlipping )
TexGrHdr.Flags |= HDR_TEXTURE_GROUP_ALLOW_FLIPPING;
if ( !mSaveExtensions )
TexGrHdr.Flags |= HDR_TEXTURE_GROUP_REMOVE_EXTENSION;
if ( mForcePowOfTwo )
TexGrHdr.Flags |= HDR_TEXTURE_GROUP_POW_OF_TWO;
sTextureHdr TexHdr[ TexGrHdr.TextureCount ];
@@ -626,6 +641,7 @@ void cTexturePacker::CreateShapesHdr( cTexturePacker * Packer, std::vector<sShap
tShapeHdr.ResourceID = MakeHash( name );
tShapeHdr.Width = tTex->Width();
tShapeHdr.Height = tTex->Height();
tShapeHdr.Channels = tTex->Channels();
tShapeHdr.DestWidth = tTex->Width();
tShapeHdr.DestHeight = tTex->Height();
tShapeHdr.OffsetX = 0;
@@ -638,9 +654,6 @@ void cTexturePacker::CreateShapesHdr( cTexturePacker * Packer, std::vector<sShap
if ( tTex->Flipped() )
tShapeHdr.Flags |= HDR_SHAPE_FLAG_FLIPED;
if ( !mSaveExtensions )
tShapeHdr.Flags |= HDR_SHAPE_FLAG_REMOVE_EXTENSION;
fs->write( reinterpret_cast<const char*> (&tShapeHdr), sizeof(sShapeHdr) );
}
}
@@ -657,13 +670,7 @@ sTextureHdr cTexturePacker::CreateTextureHdr( cTexturePacker * Packer ) {
TexHdr.ResourceID = MakeHash( name );
TexHdr.Size = FileSize( Packer->GetFilepath() );
TexHdr.Width = Packer->GetWidth();
TexHdr.Height = Packer->GetHeight();
TexHdr.ShapeCount = Packer->GetPlacedCount();
TexHdr.Flags = 0;
if ( !mSaveExtensions )
TexHdr.Flags |= HDR_TEXTURE_FLAG_REMOVE_EXTENSION;
return TexHdr;
}

View File

@@ -89,6 +89,7 @@ class EE_API cTexturePacker {
bool mForcePowOfTwo;
Int32 mPixelBorder;
bool mSaveExtensions;
EE_SAVETYPE mFormat;
cTexturePacker * GetChild() const;

View File

@@ -7,6 +7,7 @@ cTexturePackerTex::cTexturePackerTex( const std::string& Name ) :
mName(Name),
mWidth(0),
mHeight(0),
mChannels(0),
mX(0),
mY(0),
mLongestEdge(0),
@@ -16,9 +17,7 @@ cTexturePackerTex::cTexturePackerTex( const std::string& Name ) :
mLoadedInfo(false),
mDisabled(false)
{
Int32 c;
if ( stbi_info( Name.c_str(), &mWidth, &mHeight, &c ) ) {
if ( stbi_info( Name.c_str(), &mWidth, &mHeight, &mChannels ) ) {
mArea = mWidth * mHeight;
mLongestEdge = ( mWidth >= mHeight ) ? mWidth : mHeight;
mLoadedInfo = true;

View File

@@ -17,6 +17,8 @@ class cTexturePackerTex {
inline const Int32& Y() const { return mY; }
inline const Int32& Channels() { return mChannels; }
inline void X( const Int32& x ) { mX = x; }
inline void Y( const Int32& y ) { mY = y; }
@@ -46,6 +48,7 @@ class cTexturePackerTex {
std::string mName;
Int32 mWidth;
Int32 mHeight;
Int32 mChannels;
Int32 mX;
Int32 mY;
Int32 mLongestEdge;

View File

@@ -14,6 +14,7 @@ typedef struct sShapeHdrS {
Int32 Y;
Int32 Width;
Int32 Height;
Int32 Channels;
Uint32 ResourceID;
Int32 OffsetX;
Int32 OffsetY;
@@ -23,25 +24,28 @@ typedef struct sShapeHdrS {
} sShapeHdr;
#define HDR_SHAPE_FLAG_FLIPED ( 1 << 0 )
#define HDR_SHAPE_FLAG_REMOVE_EXTENSION ( 1 << 1 )
typedef struct sTextureHdrS {
char Name[ HDR_NAME_SIZE ];
Uint32 ResourceID;
Uint32 Size;
Int32 Width;
Int32 Height;
Int32 ShapeCount;
Uint32 Flags;
} sTextureHdr;
#define HDR_TEXTURE_FLAG_REMOVE_EXTENSION ( 1 << 1 )
typedef struct sTextureGroupHdrS {
Uint32 Magic;
Uint32 TextureCount;
Uint32 Format;
Int32 Width;
Int32 Height;
Uint32 PixelBorder;
Uint32 Flags;
} sTextureGroupHdr;
#define HDR_TEXTURE_GROUP_ALLOW_FLIPPING ( 1 << 0 )
#define HDR_TEXTURE_GROUP_REMOVE_EXTENSION ( 1 << 1 )
#define HDR_TEXTURE_GROUP_POW_OF_TWO ( 1 << 2 )
}}}
#endif

View File

@@ -3,9 +3,9 @@
namespace EE { namespace System {
#if EE_PLATFORM == EE_PLATFORM_WIN32
#define iniEOL endl
#define iniEOL std::endl
#else
#define iniEOL '\r' << endl
#define iniEOL '\r' << std::endl
#endif
cIniFile::cIniFile ( std::string const iniPath ) {
@@ -30,12 +30,12 @@ bool cIniFile::LoadFromMemory( const Uint8* RAWData, const Uint32& size ) {
bool cIniFile::LoadFromFile( const std::string& iniPath ) {
// Normally you would use ifstream, but the SGI CC compiler has
// a few bugs with ifstream. So ... fstream used.
fstream f;
std::fstream f;
std::string line;
Path ( iniPath );
f.open ( mPath.c_str(), ios::in );
f.open ( mPath.c_str(), std::ios::in );
if ( f.fail() )
return false;
@@ -112,9 +112,9 @@ bool cIniFile::WriteFile() {
unsigned commentID, keyID, valueID;
// Normally you would use ofstream, but the SGI CC compiler has
// a few bugs with ofstream. So ... fstream used.
fstream f;
std::fstream f;
f.open ( mPath.c_str(), ios::out );
f.open ( mPath.c_str(), std::ios::out );
if ( f.fail() )
return false;
@@ -326,8 +326,8 @@ bool cIniFile::DeleteValue ( std::string const keyname, std::string const valuen
return false;
// This looks strange, but is neccessary.
vector<std::string>::iterator npos = mKeys[keyID].names.begin() + valueID;
vector<std::string>::iterator vpos = mKeys[keyID].values.begin() + valueID;
std::vector<std::string>::iterator npos = mKeys[keyID].names.begin() + valueID;
std::vector<std::string>::iterator vpos = mKeys[keyID].values.begin() + valueID;
mKeys[keyID].names.erase ( npos, npos + 1 );
mKeys[keyID].values.erase ( vpos, vpos + 1 );
@@ -346,8 +346,8 @@ bool cIniFile::DeleteKey ( std::string const keyname ) {
//mKeys[keyID].names.clear();
//mKeys[keyID].values.clear();
vector<std::string>::iterator npos = mNames.begin() + keyID;
vector<key>::iterator kpos = mKeys.begin() + keyID;
std::vector<std::string>::iterator npos = mNames.begin() + keyID;
std::vector<key>::iterator kpos = mKeys.begin() + keyID;
mNames.erase ( npos, npos + 1 );
mKeys.erase ( kpos, kpos + 1 );
@@ -378,7 +378,7 @@ std::string cIniFile::HeaderComment ( unsigned const commentID ) const {
bool cIniFile::DeleteHeaderComment ( unsigned commentID ) {
if ( commentID < mComments.size() ) {
vector<std::string>::iterator cpos = mComments.begin() + commentID;
std::vector<std::string>::iterator cpos = mComments.begin() + commentID;
mComments.erase ( cpos, cpos + 1 );
return true;
}
@@ -428,7 +428,7 @@ std::string cIniFile::KeyComment ( std::string const keyname, unsigned const com
bool cIniFile::DeleteKeyComment ( unsigned const keyID, unsigned const commentID ) {
if ( keyID < mKeys.size() && commentID < mKeys[keyID].comments.size() ) {
vector<std::string>::iterator cpos = mKeys[keyID].comments.begin() + commentID;
std::vector<std::string>::iterator cpos = mKeys[keyID].comments.begin() + commentID;
mKeys[keyID].comments.erase ( cpos, cpos + 1 );
return true;
}

View File

@@ -29,13 +29,13 @@ class EE_API cIniFile {
bool mCaseInsensitive;
std::string mPath;
struct key {
vector<std::string> names;
vector<std::string> values;
vector<std::string> comments;
std::vector<std::string> names;
std::vector<std::string> values;
std::vector<std::string> comments;
};
vector<key> mKeys;
vector<std::string> mNames;
vector<std::string> mComments;
std::vector<key> mKeys;
std::vector<std::string> mNames;
std::vector<std::string> mComments;
std::string CheckCase ( std::string s ) const;
std::vector <std::string> mLines;

View File

@@ -18,9 +18,9 @@ cLog::~cLog() {
std::string str = mFilePath;
str += "log.log";
ofstream fs(str.c_str(), ios::app);
std::ofstream fs(str.c_str(), std::ios::app);
fs << mData << endl;
fs << mData << std::endl;
fs.close();
}
}

View File

@@ -6,8 +6,8 @@
namespace EE { namespace System {
class EE_API cLog : public cSingleton<cLog> {
friend class cSingleton<cLog>;
class EE_API cLog : public tSingleton<cLog> {
friend class tSingleton<cLog>;
public:
void Save(const std::string& filepath = "./");
void Write(const std::string& Text, const bool& newLine = true);

View File

@@ -50,7 +50,7 @@ bool cPak::Open( const std::string& path ) {
if ( CheckPack() == 0 ) {
myPak.pakFilesNum = myPak.header.dir_length / 64; // Number of files in the PAK
myPak.fs.seekg( myPak.header.dir_offset, ios::beg ); // Seek to read the pakEntrys
myPak.fs.seekg( myPak.header.dir_offset, std::ios::beg ); // Seek to read the pakEntrys
for ( Uint32 i = 0; i < myPak.pakFilesNum; i++ ) { // Read all the pakEntrys
pakEntry Entry;
@@ -104,7 +104,7 @@ bool cPak::ExtractFile( const std::string& path , const std::string& dest ) {
Int32 Pos = Exists( path );
if ( Pos != -1 ) {
fstream fs ( dest.c_str() , std::ios::out | std::ios::binary );
std::fstream fs ( dest.c_str() , std::ios::out | std::ios::binary );
std::vector<Uint8> tmpv;
if ( ExtractFileToMemory( path, tmpv ) )
@@ -130,7 +130,7 @@ bool cPak::ExtractFileToMemory( const std::string& path, std::vector<Uint8>& dat
data.clear();
data.resize( pakFiles[Pos].file_length );
myPak.fs.seekg( pakFiles[Pos].file_position, ios::beg );
myPak.fs.seekg( pakFiles[Pos].file_position, std::ios::beg );
myPak.fs.read( reinterpret_cast<char*> (&data[0]), pakFiles[Pos].file_length );
Ret = true;
@@ -152,7 +152,7 @@ bool cPak::ExtractFileToMemory( const std::string& path, Uint8** data, Uint32* d
*dataSize = pakFiles[Pos].file_length;
*data = new Uint8[ (*dataSize) ];
myPak.fs.seekg( pakFiles[Pos].file_position, ios::beg );
myPak.fs.seekg( pakFiles[Pos].file_position, std::ios::beg );
myPak.fs.read( reinterpret_cast<char*> ( *data ), pakFiles[Pos].file_length );
Ret = true;
@@ -175,7 +175,7 @@ bool cPak::AddFile( const Uint8 * data, const Uint32& dataSize, const std::strin
myPak.header.dir_length = sizeof(pakEntry);
myPak.pakFilesNum = 1;
myPak.fs.seekg( 4 , ios::beg ); // seek after head (PACK)
myPak.fs.seekg( 4 , std::ios::beg ); // seek after head (PACK)
myPak.fs.write( reinterpret_cast<const char*> (&myPak.header.dir_offset), sizeof( myPak.header.dir_offset ) );
myPak.fs.write( reinterpret_cast<const char*> (&myPak.header.dir_length), sizeof( myPak.header.dir_length ) );
@@ -201,17 +201,17 @@ bool cPak::AddFile( const Uint8 * data, const Uint32& dataSize, const std::strin
std::vector<pakEntry> pakE;
pakE.resize( myPak.pakFilesNum + 1 ); // Alloc space for all the pakEntrys and the new one
myPak.fs.seekg( myPak.header.dir_offset, ios::beg ); // seek to the file pakEntrys
myPak.fs.seekg( myPak.header.dir_offset, std::ios::beg ); // seek to the file pakEntrys
myPak.fs.read( reinterpret_cast<char*> (&pakE[0]), sizeof(pakEntry) * myPak.pakFilesNum ); // get all the pakEntrys
myPak.header.dir_offset = myPak.header.dir_offset + fsize; // Update the new dir_offset
myPak.header.dir_length = myPak.header.dir_length + sizeof(pakEntry); // Update the new dir_length
myPak.fs.seekg( 4 , ios::beg ); // Update the new dir_offset and dir_length to the pakFile
myPak.fs.seekg( 4 , std::ios::beg ); // Update the new dir_offset and dir_length to the pakFile
myPak.fs.write( reinterpret_cast<const char*> (&myPak.header.dir_offset), sizeof( myPak.header.dir_offset ) );
myPak.fs.write( reinterpret_cast<const char*> (&myPak.header.dir_length), sizeof( myPak.header.dir_length ) );
myPak.fs.seekg( (myPak.header.dir_offset - fsize), ios::beg ); // Seek to the file allocation zone
myPak.fs.seekg( (myPak.header.dir_offset - fsize), std::ios::beg ); // Seek to the file allocation zone
myPak.fs.write( reinterpret_cast<const char*> (&data[0]), fsize ); // Alloc the file
// Fill the new file data on the pakEntry

View File

@@ -79,7 +79,7 @@ bool cRC4::EncryptFile( const std::string& SourceFile, const std::string& DestFi
fs2.write( reinterpret_cast<const char*>( &tmpv[0] ), (std::streamsize)tmpv.size() );
fs2.close();
} else {
fs.seekg( 0, ios::beg );
fs.seekg( 0, std::ios::beg );
fs.write( reinterpret_cast<const char*>( &tmpv[0] ), (std::streamsize)tmpv.size() );
}

View File

@@ -5,7 +5,7 @@ namespace EE { namespace System {
/** @brief Template class for only one instance classes. */
template<typename T>
class cSingleton {
class tSingleton {
static T* ms_singleton;
public:
@@ -35,7 +35,7 @@ class cSingleton {
}
}
};
template <typename T> T* cSingleton <T>::ms_singleton = 0;
template <typename T> T* tSingleton <T>::ms_singleton = 0;
}}
#endif

View File

@@ -291,7 +291,7 @@ void cEETest::Init() {
Launch();
} else {
cout << "Failed to start EE++" << endl;
std::cout << "Failed to start EE++" << std::endl;
cEngine::DestroySingleton();
exit(0);
}
@@ -541,7 +541,7 @@ void cEETest::LoadTextures() {
CL2.AddFrame(TN[0], 96, 96);
CL2.Color( eeRGBA( 255, 255, 255, 255 ) );
mTGL = new cTextureGroupLoader( MyPath + "res/1.etg", false );
mTGL = new cTextureGroupLoader( MyPath + "data/bnb/bnb.etg" );
mBlindy.AddFramesByPattern( "rn" );
mBlindy.UpdatePos( 320.f, 0.f );
@@ -1167,9 +1167,15 @@ void cEETest::Particles() {
}
int main (int argc, char * argv []) {
/* cTexturePacker tp( 512, 512 );
std::string Path = "/home/downloads/files/temp/bnb/allin/";
/* std::string Path( "/home/downloads/files/temp/bnb/allin/" );
*/
/*
cTextureGroupLoader * tgl = new cTextureGroupLoader();
tgl->UpdateTextureAtlas( AppPath() + "data/bnb/bnb.etg", Path );
delete tgl;
*/
/*
cTexturePacker tp( 512, 512 );
if ( argc > 1 )
Path = std::string( argv[1] );
@@ -1178,7 +1184,7 @@ int main (int argc, char * argv []) {
tp.PackTextures();
tp.Save( AppPath() + "res/1.png", EE_SAVE_TYPE_PNG );
tp.Save( AppPath() + "data/bnb/bnb.png", EE_SAVE_TYPE_PNG );
*/
cEETest Test;
Test.Process();

View File

@@ -8,8 +8,8 @@ namespace EE { namespace UI {
class cUIControl;
class EE_API cUIManager : public cSingleton<cUIManager> {
friend class cSingleton<cUIManager>;
class EE_API cUIManager : public tSingleton<cUIManager> {
friend class tSingleton<cUIManager>;
public:
cUIManager();
~cUIManager();

View File

@@ -7,7 +7,7 @@ namespace EE { namespace Utils { namespace easing {
typedef eeFloat( *easingCbFunc )( eeFloat, eeFloat, eeFloat, eeFloat );
extern easingCbFunc easingCb[];
extern EE_API easingCbFunc easingCb[];
/**
* Calculate the position of a point from a linear interpolation.
@@ -16,164 +16,164 @@ extern easingCbFunc easingCb[];
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat LinearInterpolation( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API LinearInterpolation( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>QuadraticIn()</code> method starts motion from a zero velocity
* and then accelerates motion as it executes.
* The <code>QuadraticIn()</code> method starts motion from a zero velocity
* and then accelerates motion as it executes.
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
*/
eeFloat EE_API QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>QuadraticOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
* The <code>QuadraticOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat QuadraticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
*/
eeFloat EE_API QuadraticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>QuadraticInOut()</code> method combines the motion
* of the <code>QuadraticIn()</code> and <code>QuadraticOut()</code> methods
* to start the motion from a zero velocity,
* accelerate motion, then decelerate to a zero velocity.
* to start the motion from a zero velocity,
* accelerate motion, then decelerate to a zero velocity.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat QuadraticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
*/
eeFloat EE_API QuadraticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>SineIn()</code> method starts motion from zero velocity
* and then accelerates motion as it executes.
* The <code>SineIn()</code> method starts motion from zero velocity
* and then accelerates motion as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>easeOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
* The <code>easeOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat SineOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API SineOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>easeInOut()</code> method combines the motion
* of the <code>easeIn()</code> and <code>easeOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat SineInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API SineInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>ExponentialIn()</code> method starts motion slowly
* and then accelerates motion as it executes.
* The <code>ExponentialIn()</code> method starts motion slowly
* and then accelerates motion as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial position of a component.
* @param c Specifies the total change in position of the component.
* @param d Specifies the duration of the effect, in milliseconds.
* @return Number corresponding to the position of the component.
*/
eeFloat ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return Number corresponding to the position of the component.
*/
eeFloat EE_API ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>ExponentialOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
* The <code>ExponentialOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat ExponentialOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API ExponentialOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>ExponentialInOut()</code> method combines the motion
* of the <code>ExponentialIn()</code> and <code>ExponentialOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat ExponentialInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API ExponentialInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat QuarticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API QuarticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat QuarticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API QuarticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat QuarticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API QuarticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat QuinticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API QuinticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat QuinticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API QuinticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat QuinticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API QuinticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat CircularIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API CircularIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat CircularOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API CircularOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat CircularInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API CircularInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat CubicIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API CubicIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat CubicOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API CubicOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat CubicInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API CubicInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat BackIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API BackIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat BackOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API BackOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat BackInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API BackInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat BounceIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API BounceIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat BounceOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API BounceOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat BounceInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API BounceInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat ElasticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API ElasticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat ElasticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API ElasticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat ElasticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
eeFloat EE_API ElasticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
}}}

View File

@@ -119,9 +119,9 @@ void EE_API StrCopy( char * Dst, const char * Src, eeUint DstSize );
* @param Str String to compare
* @return The position of the last char compared ( -1 if fails )
*/
Int32 StrStartsWith( const std::string& Start, const std::string Str );
Int32 EE_API StrStartsWith( const std::string& Start, const std::string Str );
Int32 StrStartsWith( const std::wstring& Start, const std::wstring Str );
Int32 EE_API StrStartsWith( const std::wstring& Start, const std::wstring Str );
}}

View File

@@ -309,8 +309,8 @@ bool FileGet( const std::string& path, std::vector<Uint8>& data ) {
bool FileCopy( const std::string& src, const std::string& dst ) {
if ( FileExists( src ) ) {
ifstream in( src.c_str() );
ofstream out( dst.c_str() );
std::ifstream in( src.c_str() );
std::ofstream out( dst.c_str() );
if ( in.is_open() && out.is_open() ) {
out << in.rdbuf();
@@ -408,4 +408,26 @@ Uint32 FileGetModificationDate( const std::string& Filepath ) {
return 0;
}
std::string SaveTypeToExtension( const Uint32& Format ) {
switch( Format ) { // I dont use the save types to avoid including something from EE::Graphics
case 0: return "tga"; // EE_SAVE_TYPE_TGA
case 1: return "bmp"; // EE_SAVE_TYPE_BMP
case 2: return "png"; // EE_SAVE_TYPE_PNG
case 3: return "dds"; // EE_SAVE_TYPE_DDS
}
return "";
}
void DirPathAddSlashAtEnd( std::string& path ) {
if ( path[ path.size() - 1 ] != '/' && path[ path.size() - 1 ] != '\\' ) {
#if EE_PLATFORM == EE_PLATFORM_WIN32
path += '\\';
#else
path += '/';
#endif
}
}
}}

View File

@@ -48,41 +48,47 @@ namespace EE { namespace Utils {
* @param data The vector to allocate the file in memory
* @return True if returned the file to the vector.
*/
bool FileGet( const std::string& path, std::vector<Uint8>& data );
bool EE_API FileGet( const std::string& path, std::vector<Uint8>& data );
/** Copy a file to location.
* @param src Source File Path
* @param dst Destination File Path
* @return If success.
*/
bool FileCopy( const std::string& src, const std::string& dst );
bool EE_API FileCopy( const std::string& src, const std::string& dst );
/** @return The file extension
* @param filepath The file path or name
* @param lowerExt Lowercase the extension obtained? ( true by default )
*/
std::string FileExtension( const std::string& filepath, const bool& lowerExt = true );
std::string EE_API FileExtension( const std::string& filepath, const bool& lowerExt = true );
/** @return The file name of a file path */
std::string FileNameFromPath( const std::string& filepath );
std::string EE_API FileNameFromPath( const std::string& filepath );
/** @return Removes the file name from a path, and return the path. */
std::string FileRemoveFileName( const std::string& filepath );
std::string EE_API FileRemoveFileName( const std::string& filepath );
/** @return Removes the extension of a filepath */
std::string FileRemoveExtension( const std::string& filepath );
std::string EE_API FileRemoveExtension( const std::string& filepath );
/** Write a file in binary mode and close it. */
bool FileWrite( const std::string& filepath, const Uint8* data, const Uint32& dataSize );
bool EE_API FileWrite( const std::string& filepath, const Uint8* data, const Uint32& dataSize );
/** Write a file in binary mode and close it. */
bool FileWrite( const std::string& filepath, const std::vector<Uint8>& data );
bool EE_API FileWrite( const std::string& filepath, const std::vector<Uint8>& data );
/** @return The Number of CPUs of the system. */
eeInt GetNumCPUs();
eeInt EE_API GetNumCPUs();
/** @return The modification date of the file */
Uint32 FileGetModificationDate( const std::string& Filepath );
Uint32 EE_API FileGetModificationDate( const std::string& Filepath );
/** @return The File Extension of a Save Type */
std::string EE_API SaveTypeToExtension( const Uint32& Format );
/** If the directory path not end with a slash, it will add it. */
void DirPathAddSlashAtEnd( std::string& path );
}
}

View File

@@ -21,8 +21,8 @@ inline BOOL WIN_ShowWindow( HWND hWnd, int nCmdShow ) {
#endif
/** @brief The basic Graphics class. Here Init the context and render to screen. (Singleton Class). */
class EE_API cEngine : public cSingleton<cEngine> {
friend class cSingleton<cEngine>;
class EE_API cEngine : public tSingleton<cEngine> {
friend class tSingleton<cEngine>;
public:
/** Init the opengl context and the screen
* @param Width Screen Width

View File

@@ -291,8 +291,8 @@ enum EE_KEY {
};
/** @brief The basic input class. For mouse and keyboard. */
class EE_API cInput : public cSingleton<cInput> {
friend class cSingleton<cInput>;
class EE_API cInput : public tSingleton<cInput> {
friend class tSingleton<cInput>;
public:
typedef boost::function1<void, EE_Event*> InputCallback;
typedef boost::function0<void> VideoResizeCallback;

View File

@@ -8,8 +8,8 @@ namespace EE { namespace Window {
#define MAX_JOYSTICKS (16)
class EE_API cJoystickManager : public cSingleton<cJoystickManager> {
friend class cSingleton<cJoystickManager>;
class EE_API cJoystickManager : public tSingleton<cJoystickManager> {
friend class tSingleton<cJoystickManager>;
friend class cJoystick;
public:
cJoystickManager();

View File

@@ -6,7 +6,7 @@
namespace EE { namespace Window {
/** @brief The class defines a view like a 2D camera ( position, size, move, scale ). \nBasically is a 2D proyection in pixels seted over a viewport. */
class cView {
class EE_API cView {
public:
cView();
cView( const eeInt& X, const eeInt& Y, const eeInt& Width, const eeInt& Height );