diff --git a/include/eepp/audio/base.hpp b/include/eepp/audio/base.hpp index db0e54f48..454f2803d 100644 --- a/include/eepp/audio/base.hpp +++ b/include/eepp/audio/base.hpp @@ -10,8 +10,8 @@ #include using namespace EE::System; -#include -using namespace EE::Utils; +#include +using namespace EE::Math; /** This module is based on the sfml-audio module. diff --git a/include/eepp/base/string.hpp b/include/eepp/base/string.hpp index 1a249a7ac..0bd61cb5b 100644 --- a/include/eepp/base/string.hpp +++ b/include/eepp/base/string.hpp @@ -667,7 +667,6 @@ EE_API String operator +( const String& left, const String& right ); #endif /** @class EE::String -** @ingroup system ** EE::String is a utility string class defined mainly for ** convenience. It is a Unicode string (implemented using ** UTF-32), thus it can store any character in the world diff --git a/include/eepp/base/utf.hpp b/include/eepp/base/utf.hpp index 2db98c07c..27e40d8fa 100644 --- a/include/eepp/base/utf.hpp +++ b/include/eepp/base/utf.hpp @@ -750,7 +750,6 @@ typedef Utf<32> Utf32; //////////////////////////////////////////////////////////// /// \class EE::Utf -/// \ingroup system /// /// Utility class providing generic functions for UTF conversions. /// diff --git a/include/eepp/ee.hpp b/include/eepp/ee.hpp index 569d95e7a..ef029ca3c 100755 --- a/include/eepp/ee.hpp +++ b/include/eepp/ee.hpp @@ -31,14 +31,10 @@ #include "base.hpp" using namespace EE; - // Utils - #include - using namespace EE::Utils; - using namespace EE::Utils::easing; - // Math #include using namespace EE::Math; + using namespace EE::Math::easing; // System #include diff --git a/include/eepp/gaming/base.hpp b/include/eepp/gaming/base.hpp index ede30ae9b..3d3048269 100644 --- a/include/eepp/gaming/base.hpp +++ b/include/eepp/gaming/base.hpp @@ -3,14 +3,13 @@ #include -#include -#include -#include -#include -using namespace EE::Utils; - +#include +#include #include +using namespace EE::Math; +#include +#include #include #include #include diff --git a/include/eepp/gaming/mapeditor/cmapeditor.hpp b/include/eepp/gaming/mapeditor/cmapeditor.hpp index e37390c3f..68144ceda 100644 --- a/include/eepp/gaming/mapeditor/cmapeditor.hpp +++ b/include/eepp/gaming/mapeditor/cmapeditor.hpp @@ -80,7 +80,7 @@ class EE_API cMapEditor { void WindowClose( const cUIEvent * Event ); - void TextureGroupOpen( const cUIEvent * Event ); + void TextureAtlasOpen( const cUIEvent * Event ); void CreateME(); diff --git a/include/eepp/graphics/base.hpp b/include/eepp/graphics/base.hpp index 71d9db144..e454ec850 100644 --- a/include/eepp/graphics/base.hpp +++ b/include/eepp/graphics/base.hpp @@ -237,15 +237,15 @@ #define EE_QUAD_VERTEX 4 #endif -#include -#include -#include -#include -#include -using namespace EE::Utils; +#include +#include +#include #include +using namespace EE::Math; +#include +#include #include #include #include diff --git a/include/eepp/graphics/cglobaltextureatlas.hpp b/include/eepp/graphics/cglobaltextureatlas.hpp index ba18ad24c..3011eefc9 100644 --- a/include/eepp/graphics/cglobaltextureatlas.hpp +++ b/include/eepp/graphics/cglobaltextureatlas.hpp @@ -6,6 +6,7 @@ namespace EE { namespace Graphics { +/** @brief Any SubTexture that doesn't belong to an specific TextureAtlas ( a real texture atlas texture ), goes here. */ class EE_API cGlobalTextureAtlas : public cTextureAtlas { SINGLETON_DECLARE_HEADERS(cGlobalTextureAtlas) diff --git a/include/eepp/graphics/cimage.hpp b/include/eepp/graphics/cimage.hpp index 40387de7f..bdeb605d8 100644 --- a/include/eepp/graphics/cimage.hpp +++ b/include/eepp/graphics/cimage.hpp @@ -3,9 +3,7 @@ #include -#include -using namespace EE::Utils; - +#include #include #include #include diff --git a/include/eepp/graphics/cshaderprogram.hpp b/include/eepp/graphics/cshaderprogram.hpp index 62c98271a..47c442233 100644 --- a/include/eepp/graphics/cshaderprogram.hpp +++ b/include/eepp/graphics/cshaderprogram.hpp @@ -2,8 +2,8 @@ #define EE_GRAPHICSCSHADERPROGRAM_H #include -#include #include +#include namespace EE { namespace Graphics { diff --git a/include/eepp/graphics/ctextureatlasloader.hpp b/include/eepp/graphics/ctextureatlasloader.hpp index f72a70ff8..00963ed0a 100644 --- a/include/eepp/graphics/ctextureatlasloader.hpp +++ b/include/eepp/graphics/ctextureatlasloader.hpp @@ -1,5 +1,5 @@ -#ifndef EE_GRAPHICSCTEXTUREGROUPLOADER_HPP -#define EE_GRAPHICSCTEXTUREGROUPLOADER_HPP +#ifndef EE_GRAPHICSCTEXTUREATLASLOADER_HPP +#define EE_GRAPHICSCTEXTUREATLASLOADER_HPP #include #include @@ -20,9 +20,9 @@ class EE_API cTextureAtlasLoader { cTextureAtlasLoader(); - cTextureAtlasLoader( const std::string& TextureGroupPath, const bool& Threaded = false, GLLoadCallback LoadCallback = GLLoadCallback() ); + cTextureAtlasLoader( const std::string& TextureAtlasPath, const bool& Threaded = false, GLLoadCallback LoadCallback = GLLoadCallback() ); - cTextureAtlasLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureGroupName, const bool& Threaded = false, GLLoadCallback LoadCallback = GLLoadCallback() ); + cTextureAtlasLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureAtlasName, const bool& Threaded = false, GLLoadCallback LoadCallback = GLLoadCallback() ); cTextureAtlasLoader( cPack * Pack, const std::string& FilePackPath, const bool& Threaded = false, GLLoadCallback LoadCallback = GLLoadCallback() ); @@ -30,11 +30,11 @@ class EE_API cTextureAtlasLoader { void Update(); - void Load( const std::string& TextureGroupPath = "" ); + void Load( const std::string& TextureAtlasPath = "" ); void LoadFromStream( cIOStream& IOS ); - void LoadFromMemory( const Uint8* Data, const Uint32& DataSize, const std::string& TextureGroupName ); + void LoadFromMemory( const Uint8* Data, const Uint32& DataSize, const std::string& TextureAtlasName ); void LoadFromPack( cPack * Pack, const std::string& FilePackPath ); @@ -60,7 +60,7 @@ class EE_API cTextureAtlasLoader { void SetLoadCallback( GLLoadCallback LoadCallback ); protected: cResourceLoader mRL; - std::string mTextureGroupPath; + std::string mTextureAtlasPath; bool mThreaded; bool mLoaded; cPack * mPack; @@ -70,13 +70,13 @@ class EE_API cTextureAtlasLoader { GLLoadCallback mLoadCallback; std::vector mTexuresLoaded; - typedef struct sTempTexGroupS { + typedef struct sTempTexAtlasS { sTextureHdr Texture; std::vector SubTextures; - } sTempTexGroup; + } sTempTexAtlas; - sTextureGroupHdr mTexGrHdr; - std::vector mTempGroups; + sTextureAtlasHdr mTexGrHdr; + std::vector mTempAtlass; void CreateSubTextures(); }; diff --git a/include/eepp/graphics/ctextureatlasmanager.hpp b/include/eepp/graphics/ctextureatlasmanager.hpp index c90682ac7..17818c86b 100644 --- a/include/eepp/graphics/ctextureatlasmanager.hpp +++ b/include/eepp/graphics/ctextureatlasmanager.hpp @@ -22,7 +22,7 @@ class EE_API cTextureAtlasManager : public tResourceManager { /** Search for a pattern name * @param name First part of the sub texture name * @param extension Extension of the sub texture name ( if have one, otherwise "" ) - * @param SearchInTextureAtlas If you want only to search in a especific group ( NULL if you want to search in all groups ) + * @param SearchInTextureAtlas If you want only to search in a especific atlas ( NULL if you want to search in all atlases ) * @example Search for name "car" with extensions "png", i will try to find car00.png car01.png car02.png, and so on, it will continue if find something, otherwise it will stop ( it will always search at least for car00.png and car01.png ) */ std::vector GetSubTexturesByPattern( const std::string& name, const std::string& extension = "", cTextureAtlas * SearchInTextureAtlas = NULL ); diff --git a/include/eepp/graphics/packerhelper.hpp b/include/eepp/graphics/packerhelper.hpp index 892517d25..d2c38d48e 100644 --- a/include/eepp/graphics/packerhelper.hpp +++ b/include/eepp/graphics/packerhelper.hpp @@ -32,7 +32,7 @@ typedef struct sTextureHdrS { Int32 SubTextureCount; } sTextureHdr; -typedef struct sTextureGroupHdrS { +typedef struct sTextureAtlasHdrS { Uint32 Magic; Uint32 TextureCount; Uint32 Format; @@ -40,11 +40,15 @@ typedef struct sTextureGroupHdrS { Int32 Height; Uint32 PixelBorder; Uint32 Flags; -} sTextureGroupHdr; +} sTextureAtlasHdr; -#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 ) +#define HDR_TEXTURE_ATLAS_ALLOW_FLIPPING ( 1 << 0 ) +#define HDR_TEXTURE_ATLAS_REMOVE_EXTENSION ( 1 << 1 ) +#define HDR_TEXTURE_ATLAS_POW_OF_TWO ( 1 << 2 ) + +#define EE_TEXTURE_ATLAS_MAGIC_OLD ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ) +#define EE_TEXTURE_ATLAS_MAGIC ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'A' << 24 ) ) +#define EE_TEXTURE_ATLAS_EXTENSION ".eta" }}} diff --git a/include/eepp/math.hpp b/include/eepp/math.hpp index 1eaec4313..9ee712fb1 100644 --- a/include/eepp/math.hpp +++ b/include/eepp/math.hpp @@ -1,7 +1,20 @@ #ifndef EEPP_MATH_HPP #define EEPP_MATH_HPP +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #endif diff --git a/include/eepp/math/base.hpp b/include/eepp/math/base.hpp index e18840e46..7f072376e 100644 --- a/include/eepp/math/base.hpp +++ b/include/eepp/math/base.hpp @@ -2,16 +2,6 @@ #define EE_MATH_BASE #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace EE::Utils; +#include #endif diff --git a/include/eepp/utils/cinterpolation.hpp b/include/eepp/math/cinterpolation.hpp similarity index 95% rename from include/eepp/utils/cinterpolation.hpp rename to include/eepp/math/cinterpolation.hpp index 77fe181cb..30d6d99f9 100644 --- a/include/eepp/utils/cinterpolation.hpp +++ b/include/eepp/math/cinterpolation.hpp @@ -1,10 +1,10 @@ -#ifndef EE_UTILSCINTERPOLATION_H -#define EE_UTILSCINTERPOLATION_H +#ifndef EE_MATHCINTERPOLATION_H +#define EE_MATHCINTERPOLATION_H -#include +#include #include -namespace EE { namespace Utils { +namespace EE { namespace Math { /** @brief The basic 1d point template. */ template diff --git a/include/eepp/math/cmtrand.hpp b/include/eepp/math/cmtrand.hpp index e91b8e3a8..a2cdb9b75 100755 --- a/include/eepp/math/cmtrand.hpp +++ b/include/eepp/math/cmtrand.hpp @@ -58,8 +58,8 @@ // Adapted to EE++ ( this is not the original file ). // Added RandRange. -#ifndef EE_UTILSCMTRAND_HPP -#define EE_UTILSCMTRAND_HPP +#ifndef EE_MATHCMTRAND_HPP +#define EE_MATHCMTRAND_HPP #include diff --git a/include/eepp/utils/cperlinnoise.hpp b/include/eepp/math/cperlinnoise.hpp similarity index 80% rename from include/eepp/utils/cperlinnoise.hpp rename to include/eepp/math/cperlinnoise.hpp index 8445ef6d9..5b5ff57a0 100755 --- a/include/eepp/utils/cperlinnoise.hpp +++ b/include/eepp/math/cperlinnoise.hpp @@ -1,5 +1,5 @@ -#ifndef EE_UTILSCPERLINNOISE_H -#define EE_UTILSCPERLINNOISE_H +#ifndef EE_MATHCPERLINNOISE_H +#define EE_MATHCPERLINNOISE_H /* My code is based on this sites: http://freespace.virgin.net/hugo.elias/models/m_perlin.htm @@ -7,13 +7,14 @@ http://www.animeimaging.com/asp/PerlinNoise.aspx - by James Long And for the C++ implementation of Henrik Krysell. */ -#include +#include -namespace EE { namespace Utils { +namespace EE { namespace Math { class EE_API cPerlinNoise { public: cPerlinNoise(); + ~cPerlinNoise(); void Init(); @@ -21,32 +22,45 @@ class EE_API cPerlinNoise { eeFloat PerlinNoise2D(eeFloat x, eeFloat y); void Octaves( const eeInt& octaves ) { mOctaves = octaves; } + void Persistence( const eeFloat& pers) { mPersistence = pers; } + void Frequency( const eeFloat& freq ) { mFrequency = freq; } + void Amplitude( const eeFloat& amp ) { mAmplitude = amp; } + void FrequencyOctaveDep( const bool& dep ) { mFreqOctaveDep = dep; } + void AmplitudeOctaveDep( const bool& dep ) { mAmpOctaveDep = dep; } eeInt Octaves() const { return mOctaves; } + eeFloat Persistence() const { return mPersistence; } + eeFloat Frequency() const { return mFrequency; } + eeFloat Amplitude() const { return mAmplitude; } + bool FrequencyOctaveDep() const { return mFreqOctaveDep; } + bool AmplitudeOctaveDep() const { return mAmpOctaveDep; } protected: eeFloat Noise2D(Int32 x, Int32 y); + eeFloat SmoothedNoise2D(eeFloat x, eeFloat y); + eeFloat Interpolate(eeFloat a, eeFloat b, eeFloat x); + eeFloat InterpolatedNoise2D(eeFloat x, eeFloat y); - eeFloat mCurrSeed; - eeFloat mPersistence; - eeInt mOctaves; - eeFloat mFrequency; - eeFloat mAmplitude; + eeFloat mCurrSeed; + eeFloat mPersistence; + eeInt mOctaves; + eeFloat mFrequency; + eeFloat mAmplitude; - bool mFreqOctaveDep; - bool mAmpOctaveDep; + bool mFreqOctaveDep; + bool mAmpOctaveDep; }; }} diff --git a/include/eepp/utils/cwaypoints.hpp b/include/eepp/math/cwaypoints.hpp similarity index 95% rename from include/eepp/utils/cwaypoints.hpp rename to include/eepp/math/cwaypoints.hpp index 3fdb214db..d2f92f3f9 100755 --- a/include/eepp/utils/cwaypoints.hpp +++ b/include/eepp/math/cwaypoints.hpp @@ -1,11 +1,11 @@ -#ifndef EE_UTILSCWAYPOINTS_H -#define EE_UTILSCWAYPOINTS_H +#ifndef EE_MATHCWAYPOINTS_H +#define EE_MATHCWAYPOINTS_H -#include -#include +#include +#include #include -namespace EE { namespace Utils { +namespace EE { namespace Math { /** @brief The basic waypoint class. */ template diff --git a/include/eepp/math/easing.hpp b/include/eepp/math/easing.hpp new file mode 100644 index 000000000..5fc5cb541 --- /dev/null +++ b/include/eepp/math/easing.hpp @@ -0,0 +1,389 @@ +#ifndef EE_MATH_EASINGEASING_H +#define EE_MATH_EASINGEASING_H + +#include + +namespace EE { namespace Math { namespace easing { + +typedef eeFloat( *easingCbFunc )( eeFloat, eeFloat, eeFloat, eeFloat ); + +extern EE_API easingCbFunc easingCb[]; + +/** +* Calculate the position of a point from a linear interpolation. +* +* @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. +*/ +inline eeFloat LinearInterpolation( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return b + t * c / d; +} + +/** +* The QuadraticIn() 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. +*/ +inline eeFloat QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + return c * t * t + b; +} + +/** +* The QuadraticOut() 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. +*/ +inline eeFloat QuadraticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + return -c * t * ( t - 2 ) + b; +} + +/** +* The QuadraticInOut() method combines the motion +* of the QuadraticIn() and QuadraticOut() methods +* 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. +*/ +inline eeFloat QuadraticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d / 2; + + if ( t < 1 ) + return c / 2 * t * t + b; + + --t; + + return -c / 2 * ( t * ( t - 2 ) - 1 ) + b; +} + +/** +* The SineIn() 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. +*/ +inline eeFloat SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return -c * eecos( t / d * ( EE_PI / 2 ) ) + c + b; +} + +/** +* The easeOut() 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. +*/ +inline eeFloat SineOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return c * eesin( t / d * ( EE_PI / 2 ) ) + b; +} + +/** +* The easeInOut() method combines the motion +* of the easeIn() and easeOut() methods +* 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. +*/ +inline eeFloat SineInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return -c / 2 * ( eecos( EE_PI * t / d ) - 1 ) + b; +} + +/** +* The ExponentialIn() 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. +*/ +inline eeFloat ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return t == 0 ? b : c * eepow( 2, 10 * ( t / d - 1 ) ) + b; +} + +/** +* The ExponentialOut() 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. +*/ +inline eeFloat ExponentialOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return t == d ? b + c : c * ( -eepow( 2, -10 * t / d ) + 1 ) + b; +} + +/** +* The ExponentialInOut() method combines the motion +* of the ExponentialIn() and ExponentialOut() methods +* 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. +*/ +inline eeFloat ExponentialInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + if (t == 0) + return b; + + if (t == d) + return b + c; + + if ( ( t /= d / 2 ) < 1 ) + return c / 2 * eepow( 2, 10 * (t - 1) ) + b; + + return c / 2 * ( -eepow( 2, -10 * --t ) + 2 ) + b; +} + +inline eeFloat QuarticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + return c * t * t * t * t + b; +} + +inline eeFloat QuarticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t = t / d - 1; + + return -c * ( t * t * t * t - 1 ) + b; +} + +inline eeFloat QuarticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d / 2; + + if ( t < 1) + return c / 2 * t * t * t * t + b; + + t -= 2; + + return -c / 2 * ( t * t * t * t - 2 ) + b; +} + +inline eeFloat QuinticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + return c * t * t * t * t * t + b; +} + +inline eeFloat QuinticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t = t / d - 1; + + return c * ( t * t * t * t * t + 1) + b; +} + +inline eeFloat QuinticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d / 2; + + if ( t < 1 ) + return c / 2 * t * t * t * t * t + b; + + t -= 2; + + return c / 2 * ( t * t * t * t * t + 2) + b; +} + +inline eeFloat CircularIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + return -c * ( eesqrt( 1 - t * t ) - 1) + b; +} + +inline eeFloat CircularOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t = t / d - 1; + + return c * eesqrt( 1 - t * t ) + b; +} + +inline eeFloat CircularInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d / 2; + + if ( t < 1 ) + return -c / 2 * ( eesqrt( 1 - t * t ) - 1 ) + b; + + t -= 2; + + return c / 2 * ( eesqrt( 1 - t * t ) + 1) + b; +} + +inline eeFloat CubicIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + return c * t * t * t + b; +} + +inline eeFloat CubicOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t = t / d - 1; + + return c * ( t * t * t + 1) + b; +} + +inline eeFloat CubicInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d / 2; + + if ( t < 1 ) + return c / 2 * t * t * t + b; + + t -= 2; + + return c / 2 * ( t * t * t + 2 ) + b; +} + +inline eeFloat BackIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + eeFloat s = 1.70158f; + + t /= d; + + return c * t * t * ( ( s + 1 ) * t - s) + b; +} + +inline eeFloat BackOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + eeFloat s = 1.70158f; + + t = t / d - 1; + + return c * ( t * t * ( ( s + 1 ) * t + s ) + 1 ) + b; +} + +inline eeFloat BackInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + float s = 1.70158f; + + t /= d / 2; + s *= ( 1.525f ); + + if ( t < 1 ) + return c / 2 * ( t * t * ( ( s + 1 ) * t - s ) ) + b; + + t -= 2; + + return c / 2 * ( t * t * ( ( s + 1 ) * t + s ) + 2) + b; +} + +inline eeFloat BounceOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + t /= d; + + if ( t < ( 1.f / 2.75f ) ) { + return c * ( 7.5625f * t * t ) + b; + } else if ( t < ( 2.f / 2.75f) ) { + t -= ( 1.5f / 2.75f ); + + return c * ( 7.5625f * t * t + 0.75f ) + b; + } else if (t < ( 2.5f / 2.75f ) ) { + t -= ( 2.25f / 2.75f ); + + return c * ( 7.5625f * t * t + 0.9375f ) + b; + } else { + t -= ( 2.625f / 2.75f ); + + return c * ( 7.5625f * t * t + 0.984375f ) + b; + } +} + +inline eeFloat BounceIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + return c - BounceOut( d - t, 0, c, d ) + b; +} + +inline eeFloat BounceInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + if ( t < d * 0.5f ) + return BounceIn( t * 2.f, 0.f, c, d ) * 0.5f + b; + + return BounceOut( t * 2.f - d, 0.f, c, d ) * 0.5f + c * 0.5f + b; +} + +inline eeFloat ElasticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + if ( t == 0.f ) + return b; + + t /= d; + + if ( t == 1.f ) + return b + c; + + eeFloat p = d * 0.3f; + eeFloat s = p / 4.f; + eeFloat a = c; + + t -= 1.f; + + return -( a * eepow( 2.f , 10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) ) + b; +} + +inline eeFloat ElasticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + if ( t == 0.f ) + return b; + + t /= d; + + if ( t ==1 ) + return b + c; + + eeFloat p = d * 0.3f; + eeFloat s = p / 4.f; + eeFloat a = c; + + return ( a * eepow( 2.f, -10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) + c + b ); +} + +inline eeFloat ElasticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { + if ( t == 0 ) + return b; + + t /= d / 2; + + if ( t == 2 ) + return b + c; + + eeFloat p = d * ( 0.3f * 1.5f ); + eeFloat a = c; + eeFloat s = p / 4.f; + + if ( t < 1 ) { + t -= 1.f; + + return -0.5f * ( a * eepow( 2.f, 10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) ) + b; + } + + t -= 1.f; + + return a * eepow( 2.f, -10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) * 0.5f + c + b; +} + +}}} + +#endif diff --git a/include/eepp/utils/helper.hpp b/include/eepp/math/helper.hpp similarity index 86% rename from include/eepp/utils/helper.hpp rename to include/eepp/math/helper.hpp index ec10ed7c4..349565223 100644 --- a/include/eepp/utils/helper.hpp +++ b/include/eepp/math/helper.hpp @@ -1,7 +1,7 @@ -#ifndef EE_UTILS_HELPER -#define EE_UTILS_HELPER +#ifndef EE_MATH_HELPER +#define EE_MATH_HELPER -namespace EE { namespace Utils { +namespace EE { namespace Math { /** @enum EE_INTERPOLATION Define the type of interpolation used. */ enum EE_INTERPOLATION { diff --git a/include/eepp/utils/line2.hpp b/include/eepp/math/line2.hpp similarity index 83% rename from include/eepp/utils/line2.hpp rename to include/eepp/math/line2.hpp index 3f17adb36..0fb756ed1 100644 --- a/include/eepp/utils/line2.hpp +++ b/include/eepp/math/line2.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSLINE2_HPP -#define EE_UTILSLINE2_HPP +#ifndef EE_MATHLINE2_HPP +#define EE_MATHLINE2_HPP -namespace EE { namespace Utils { +#include + +namespace EE { namespace Math { template class Line2 { @@ -36,4 +38,4 @@ typedef Line2 eeLine2f; }} -#endif +#endif diff --git a/include/eepp/math/math.hpp b/include/eepp/math/math.hpp index 1168ce7fb..49973a427 100755 --- a/include/eepp/math/math.hpp +++ b/include/eepp/math/math.hpp @@ -1,8 +1,13 @@ -#ifndef EECMATH_H -#define EECMATH_H +#ifndef EE_MATH_HPP +#define EE_MATH_HPP -#include #include +#include +#include +#include +#include +#include +#include namespace EE { namespace Math { diff --git a/include/eepp/utils/polygon2.hpp b/include/eepp/math/polygon2.hpp similarity index 94% rename from include/eepp/utils/polygon2.hpp rename to include/eepp/math/polygon2.hpp index 299ea6709..08dfed0e5 100755 --- a/include/eepp/utils/polygon2.hpp +++ b/include/eepp/math/polygon2.hpp @@ -1,12 +1,12 @@ -#ifndef EE_UTILSPOLIGON2_H -#define EE_UTILSPOLIGON2_H +#ifndef EE_MATHPOLIGON2_H +#define EE_MATHPOLIGON2_H -#include -#include -#include +#include +#include +#include #include -namespace EE { namespace Utils { +namespace EE { namespace Math { template class Polygon2 { diff --git a/include/eepp/utils/quad2.hpp b/include/eepp/math/quad2.hpp similarity index 95% rename from include/eepp/utils/quad2.hpp rename to include/eepp/math/quad2.hpp index 161f7bba8..6314d292b 100644 --- a/include/eepp/utils/quad2.hpp +++ b/include/eepp/math/quad2.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSQUAD2_HPP -#define EE_UTILSQUAD2_HPP +#ifndef EE_MATHQUAD2_HPP +#define EE_MATHQUAD2_HPP -namespace EE { namespace Utils { +#include + +namespace EE { namespace Math { template class Quad2 { diff --git a/include/eepp/utils/rect.hpp b/include/eepp/math/rect.hpp similarity index 96% rename from include/eepp/utils/rect.hpp rename to include/eepp/math/rect.hpp index a2ea05946..4574f1a69 100755 --- a/include/eepp/utils/rect.hpp +++ b/include/eepp/math/rect.hpp @@ -1,10 +1,10 @@ -#ifndef EE_UTILSCRECT_H -#define EE_UTILSCRECT_H +#ifndef EE_MATHCRECT_H +#define EE_MATHCRECT_H -#include -#include +#include +#include -namespace EE { namespace Utils { +namespace EE { namespace Math { template class tRECT { diff --git a/include/eepp/utils/size.hpp b/include/eepp/math/size.hpp similarity index 90% rename from include/eepp/utils/size.hpp rename to include/eepp/math/size.hpp index 7207e0d08..266de5005 100644 --- a/include/eepp/utils/size.hpp +++ b/include/eepp/math/size.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSSIZE_HPP -#define EE_UTILSSIZE_HPP +#ifndef EE_MATHSIZE_HPP +#define EE_MATHSIZE_HPP -namespace EE { namespace Utils { +#include + +namespace EE { namespace Math { template class tSize : public Vector2 diff --git a/include/eepp/utils/triangle2.hpp b/include/eepp/math/triangle2.hpp similarity index 79% rename from include/eepp/utils/triangle2.hpp rename to include/eepp/math/triangle2.hpp index 3a32a7f6a..4a9ab72ab 100644 --- a/include/eepp/utils/triangle2.hpp +++ b/include/eepp/math/triangle2.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSTRIANGLE2_HPP -#define EE_UTILSTRIANGLE2_HPP +#ifndef EE_MATHTRIANGLE2_HPP +#define EE_MATHTRIANGLE2_HPP -namespace EE { namespace Utils { +#include + +namespace EE { namespace Math { template class Triangle2 { diff --git a/include/eepp/utils/vector2.hpp b/include/eepp/math/vector2.hpp similarity index 98% rename from include/eepp/utils/vector2.hpp rename to include/eepp/math/vector2.hpp index 66842c8ba..dc0c3488f 100755 --- a/include/eepp/utils/vector2.hpp +++ b/include/eepp/math/vector2.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSVECTOR2_H -#define EE_UTILSVECTOR2_H +#ifndef EE_MATHVECTOR2_H +#define EE_MATHVECTOR2_H -namespace EE { namespace Utils { +#include + +namespace EE { namespace Math { template class Vector2 { diff --git a/include/eepp/utils/vector3.hpp b/include/eepp/math/vector3.hpp similarity index 94% rename from include/eepp/utils/vector3.hpp rename to include/eepp/math/vector3.hpp index 5ade1d3ef..79da93d33 100755 --- a/include/eepp/utils/vector3.hpp +++ b/include/eepp/math/vector3.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSVECTOR3_H -#define EE_UTILSVECTOR3_H +#ifndef EE_MATHVECTOR3_H +#define EE_MATHVECTOR3_H -namespace EE { namespace Utils { +#include + +namespace EE { namespace Math { template class Vector3 { diff --git a/include/eepp/physics/base.hpp b/include/eepp/physics/base.hpp index 7f35ecb2c..a535d12d6 100644 --- a/include/eepp/physics/base.hpp +++ b/include/eepp/physics/base.hpp @@ -5,12 +5,13 @@ #include //! EE includes needed for the wrapper, all templates, so it will be easy to port this. -#include -#include -#include -#include -using namespace EE::Utils; +#include +#include +using namespace EE::Math; + +#include +#include #include using namespace EE::System; diff --git a/include/eepp/system/base.hpp b/include/eepp/system/base.hpp index 13e9f5b93..271ee9bc2 100644 --- a/include/eepp/system/base.hpp +++ b/include/eepp/system/base.hpp @@ -1,11 +1,9 @@ -#ifndef EE_UTILS_BASE -#define EE_UTILS_BASE +#ifndef EE_SYSTEM_BASE +#define EE_SYSTEM_BASE #include -#include -#include - -using namespace EE::Utils; +#include +using namespace EE::Math; #endif diff --git a/include/eepp/utils/colors.hpp b/include/eepp/system/colors.hpp similarity index 96% rename from include/eepp/utils/colors.hpp rename to include/eepp/system/colors.hpp index 40e4581ff..9556ed5f2 100755 --- a/include/eepp/utils/colors.hpp +++ b/include/eepp/system/colors.hpp @@ -1,7 +1,9 @@ -#ifndef EE_UTILSCCOLORS_H -#define EE_UTILSCCOLORS_H +#ifndef EE_SYSTEMCCOLORS_H +#define EE_SYSTEMCCOLORS_H -namespace EE { namespace Utils { +#include + +namespace EE { namespace System { template class tColor { diff --git a/include/eepp/system/cpack.hpp b/include/eepp/system/cpack.hpp index c16192755..3efd69561 100755 --- a/include/eepp/system/cpack.hpp +++ b/include/eepp/system/cpack.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace EE { namespace System { diff --git a/include/eepp/system/filesystem.hpp b/include/eepp/system/filesystem.hpp index 212d382a1..795bd8321 100644 --- a/include/eepp/system/filesystem.hpp +++ b/include/eepp/system/filesystem.hpp @@ -2,6 +2,7 @@ #define EE_SYSTEM_FILESYSTEM_HPP #include +#include namespace EE { namespace System { diff --git a/include/eepp/utils/safedatapointer.hpp b/include/eepp/system/safedatapointer.hpp similarity index 51% rename from include/eepp/utils/safedatapointer.hpp rename to include/eepp/system/safedatapointer.hpp index 42cc2497b..939451928 100644 --- a/include/eepp/utils/safedatapointer.hpp +++ b/include/eepp/system/safedatapointer.hpp @@ -1,9 +1,9 @@ -#ifndef EE_UTILS_SAFEDATAPOINTER -#define EE_UTILS_SAFEDATAPOINTER +#ifndef EE_SYSTEM_SAFEDATAPOINTER +#define EE_SYSTEM_SAFEDATAPOINTER -#include +#include -namespace EE { namespace Utils { +namespace EE { namespace System { class EE_API SafeDataPointer { public: diff --git a/include/eepp/system/tresourcemanager.hpp b/include/eepp/system/tresourcemanager.hpp index 9dd3fb6d9..e85fb3b49 100644 --- a/include/eepp/system/tresourcemanager.hpp +++ b/include/eepp/system/tresourcemanager.hpp @@ -2,6 +2,7 @@ #define EE_SYSTEMTRESOURCEMANAGER_HPP #include +#include #include namespace EE { namespace System { @@ -207,4 +208,3 @@ Uint32 tResourceManager::Count( const std::string& Name ) { }} #endif - diff --git a/include/eepp/system/utils.hpp b/include/eepp/system/utils.hpp new file mode 100755 index 000000000..83c2a5afe --- /dev/null +++ b/include/eepp/system/utils.hpp @@ -0,0 +1,35 @@ +#ifndef EE_SYSTEMCUTILS_H +#define EE_SYSTEMCUTILS_H + +#include +#include + +namespace EE { namespace System { + +/** @return string hash */ +Uint32 EE_API MakeHash( const std::string& str ); + +/** @return string hash */ +Uint32 EE_API MakeHash( const Uint8 * str ); + +/** Write a bit into the Key in the position defined. +* @param Key The Key to write +* @param Pos The Position of the bit +* @param BitWrite 0 for write 0, any other to write 1. +*/ +void EE_API Write32BitKey( Uint32 * Key, Uint32 Pos, Uint32 BitWrite ); + +/** Read a bit from a 32 bit key, in the position defined +* @param Key The Key to read +* @param Pos The Position in the key to read +* @return True if the bit is 1 +*/ +bool EE_API Read32BitKey( Uint32 * Key, Uint32 Pos ); + +/** Write a 32 bit flag value */ +void EE_API SetFlagValue( Uint32 * Key, Uint32 Val, Uint32 BitWrite ); + +} + +} +#endif diff --git a/include/eepp/ui/base.hpp b/include/eepp/ui/base.hpp index 38664f5d3..125197820 100644 --- a/include/eepp/ui/base.hpp +++ b/include/eepp/ui/base.hpp @@ -3,17 +3,16 @@ #include -#include -#include -#include -#include -#include -#include -#include -using namespace EE::Utils; - +#include +#include +#include +#include +#include #include +using namespace EE::Math; +#include +#include #include #include using namespace EE::System; diff --git a/include/eepp/ui/cuitheme.hpp b/include/eepp/ui/cuitheme.hpp index b760eac41..a209fb1c0 100644 --- a/include/eepp/ui/cuitheme.hpp +++ b/include/eepp/ui/cuitheme.hpp @@ -151,7 +151,7 @@ class EE_API cUITheme : public tResourceManager { static bool SearchFilesOfElement( cTextureAtlas * SG, const std::string& Path, std::string Element, Uint32& IsComplex, const std::string ImgExt ); - static bool SearchFilesInGroup( cTextureAtlas * SG, std::string Element, Uint32& IsComplex ); + static bool SearchFilesInAtlas( cTextureAtlas * SG, std::string Element, Uint32& IsComplex ); }; }} diff --git a/include/eepp/ui/tools/ctextureatlaseditor.hpp b/include/eepp/ui/tools/ctextureatlaseditor.hpp index 8bf5b047f..d8e47848f 100644 --- a/include/eepp/ui/tools/ctextureatlaseditor.hpp +++ b/include/eepp/ui/tools/ctextureatlaseditor.hpp @@ -1,5 +1,5 @@ -#ifndef EE_UITOOLSCTEXTUREGROUPEDITOR_HPP -#define EE_UITOOLSCTEXTUREGROUPEDITOR_HPP +#ifndef EE_UITOOLSCTEXTUREATLASEDITOR_HPP +#define EE_UITOOLSCTEXTUREATLASEDITOR_HPP #include #include @@ -40,7 +40,7 @@ class EE_API cTextureAtlasEditor { cUITheme * mTheme; TGEditorCloseCb mCloseCb; cTexturePacker * mTexturePacker; - cTextureAtlasLoader * mTextureGroupLoader; + cTextureAtlasLoader * mTextureAtlasLoader; cSubTexture * mCurSubTexture; cUISpinBox * mSpinOffX; cUISpinBox * mSpinOffY; @@ -59,13 +59,13 @@ class EE_API cTextureAtlasEditor { void FileMenuClick( const cUIEvent * Event ); - void OnTextureGroupCreate( cTexturePacker * TexPacker ); + void OnTextureAtlasCreate( cTexturePacker * TexPacker ); - void OpenTextureGroup( const cUIEvent * Event ); + void OpenTextureAtlas( const cUIEvent * Event ); - void SaveTextureGroup( const cUIEvent * Event ); + void SaveTextureAtlas( const cUIEvent * Event ); - void OnTextureGroupClose( const cUIEvent * Event ); + void OnTextureAtlasClose( const cUIEvent * Event ); void OnSubTextureChange( const cUIEvent * Event ); @@ -91,7 +91,7 @@ class EE_API cTextureAtlasEditor { void OnHBOffset( const cUIEvent * Event ); - void OnTextureGroupLoaded( cTextureAtlasLoader * TGLoader ); + void OnTextureAtlasLoaded( cTextureAtlasLoader * TGLoader ); void Update(); }; diff --git a/include/eepp/ui/tools/ctextureatlasnew.hpp b/include/eepp/ui/tools/ctextureatlasnew.hpp index 4af9f17d2..9c082810f 100644 --- a/include/eepp/ui/tools/ctextureatlasnew.hpp +++ b/include/eepp/ui/tools/ctextureatlasnew.hpp @@ -1,5 +1,5 @@ -#ifndef EE_UITOOLSCTEXTUREGROUPNEW_HPP -#define EE_UITOOLSCTEXTUREGROUPNEW_HPP +#ifndef EE_UITOOLSCTEXTUREATLASNEW_HPP +#define EE_UITOOLSCTEXTUREATLASNEW_HPP #include #include @@ -40,7 +40,7 @@ class EE_API cTextureAtlasNew { void OnSelectFolder( const cUIEvent * Event ); - void TextureGroupSave( const cUIEvent * Event ); + void TextureAtlasSave( const cUIEvent * Event ); }; }}} diff --git a/include/eepp/utils.hpp b/include/eepp/utils.hpp deleted file mode 100644 index 3f3b4933f..000000000 --- a/include/eepp/utils.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EEPP_UTILS_HPP -#define EEPP_UTILS_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/include/eepp/utils/base.hpp b/include/eepp/utils/base.hpp deleted file mode 100644 index 5798b7c44..000000000 --- a/include/eepp/utils/base.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef EE_UTILS_BASE -#define EE_UTILS_BASE - -#include -#include - -#endif diff --git a/include/eepp/utils/easing.hpp b/include/eepp/utils/easing.hpp deleted file mode 100644 index 4f59772b6..000000000 --- a/include/eepp/utils/easing.hpp +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef EE_UTILS_EASINGEASING_H -#define EE_UTILS_EASINGEASING_H - -#include - -namespace EE { namespace Utils { namespace easing { - -typedef eeFloat( *easingCbFunc )( eeFloat, eeFloat, eeFloat, eeFloat ); - -extern EE_API easingCbFunc easingCb[]; - -/** -* Calculate the position of a point from a linear interpolation. -* -* @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 EE_API LinearInterpolation( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The QuadraticIn() 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 EE_API QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The QuadraticOut() 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 EE_API QuadraticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The QuadraticInOut() method combines the motion -* of the QuadraticIn() and QuadraticOut() methods -* 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 EE_API QuadraticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The SineIn() 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 EE_API SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The easeOut() 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 EE_API SineOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The easeInOut() method combines the motion -* of the easeIn() and easeOut() methods -* 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 EE_API SineInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The ExponentialIn() 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 EE_API ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The ExponentialOut() 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 EE_API ExponentialOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -/** -* The ExponentialInOut() method combines the motion -* of the ExponentialIn() and ExponentialOut() methods -* 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 EE_API ExponentialInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API QuarticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API QuarticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API QuarticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API QuinticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API QuinticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API QuinticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API CircularIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API CircularOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API CircularInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API CubicIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API CubicOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API CubicInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API BackIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API BackOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API BackInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API BounceIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API BounceOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API BounceInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API ElasticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API ElasticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -eeFloat EE_API ElasticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ); - -}}} - -#endif diff --git a/include/eepp/utils/utils.hpp b/include/eepp/utils/utils.hpp deleted file mode 100755 index 2edb91bc4..000000000 --- a/include/eepp/utils/utils.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef EE_UTILSCUTILS_H -#define EE_UTILSCUTILS_H - -#include -#include -#include - -namespace EE { namespace Utils { - - /** @return string hash */ - Uint32 EE_API MakeHash( const std::string& str ); - - /** @return string hash */ - Uint32 EE_API MakeHash( const Uint8 * str ); - - /** Write a bit into the Key in the position defined. - * @param Key The Key to write - * @param Pos The Position of the bit - * @param BitWrite 0 for write 0, any other to write 1. - */ - void EE_API Write32BitKey( Uint32 * Key, Uint32 Pos, Uint32 BitWrite ); - - /** Read a bit from a 32 bit key, in the position defined - * @param Key The Key to read - * @param Pos The Position in the key to read - * @return True if the bit is 1 - */ - bool EE_API Read32BitKey( Uint32 * Key, Uint32 Pos ); - - /** Write a 32 bit flag value */ - void EE_API SetFlagValue( Uint32 * Key, Uint32 Val, Uint32 BitWrite ); - -} - -} -#endif diff --git a/include/eepp/window/base.hpp b/include/eepp/window/base.hpp index 0582df98f..9dae959c7 100644 --- a/include/eepp/window/base.hpp +++ b/include/eepp/window/base.hpp @@ -3,12 +3,12 @@ #include -#include -#include -#include -#include -using namespace EE::Utils; +#include +#include +using namespace EE::Math; +#include +#include #include #include #include diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 4dc59a3d6..d5e0878e6 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/projects/linux/ee.files b/projects/linux/ee.files index 6b60ee0e2..23bcac7a7 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -333,31 +333,30 @@ ../../src/eepp/ui/tools/ctextureatlassubtextureeditor.cpp ../../src/eepp/ui/tools/ctextureatlasnew.cpp ../../src/eepp/ui/tools/ctextureatlaseditor.cpp -../../include/eepp/utils/vector3.hpp -../../include/eepp/utils/vector2.hpp -../../include/eepp/utils/utils.hpp -../../include/eepp/utils/triangle2.hpp +../../include/eepp/math/vector3.hpp +../../include/eepp/math/vector2.hpp +../../include/eepp/system/utils.hpp +../../include/eepp/math/triangle2.hpp ../../include/eepp/system/sys.hpp ../../src/eepp/system/sys.cpp -../../include/eepp/utils/size.hpp -../../include/eepp/utils/safedatapointer.hpp -../../include/eepp/utils/rect.hpp -../../include/eepp/utils/quad2.hpp -../../include/eepp/utils/polygon2.hpp -../../include/eepp/utils/line2.hpp -../../include/eepp/utils/helper.hpp -../../include/eepp/utils/easing.hpp -../../include/eepp/utils/cwaypoints.hpp -../../include/eepp/utils/cperlinnoise.hpp -../../include/eepp/utils/colors.hpp -../../include/eepp/utils/cinterpolation.hpp -../../include/eepp/utils/base.hpp -../../src/eepp/utils/utils.cpp -../../src/eepp/utils/safedatapointer.cpp -../../src/eepp/utils/easing.cpp -../../src/eepp/utils/cwaypoints.cpp -../../src/eepp/utils/cperlinnoise.cpp -../../src/eepp/utils/cinterpolation.cpp +../../include/eepp/math/size.hpp +../../include/eepp/system/safedatapointer.hpp +../../include/eepp/math/rect.hpp +../../include/eepp/math/quad2.hpp +../../include/eepp/math/polygon2.hpp +../../include/eepp/math/line2.hpp +../../include/eepp/math/helper.hpp +../../include/eepp/math/easing.hpp +../../include/eepp/math/cwaypoints.hpp +../../include/eepp/math/cperlinnoise.hpp +../../include/eepp/system/colors.hpp +../../include/eepp/math/cinterpolation.hpp +../../src/eepp/system/utils.cpp +../../src/eepp/system/safedatapointer.cpp +../../src/eepp/math/easing.cpp +../../src/eepp/math/cwaypoints.cpp +../../src/eepp/math/cperlinnoise.cpp +../../src/eepp/math/cinterpolation.cpp ../../include/eepp/window/keycodes.hpp ../../include/eepp/window/joycodes.hpp ../../include/eepp/window/inputhelper.hpp @@ -538,7 +537,6 @@ ../../src/eepp/helper/haikuttf/hkfontmanager.cpp ../../src/eepp/helper/haikuttf/hkfont.cpp ../../include/eepp/window.hpp -../../include/eepp/utils.hpp ../../include/eepp/ui.hpp ../../include/eepp/system.hpp ../../include/eepp/physics.hpp diff --git a/src/eepp/gaming/cmap.cpp b/src/eepp/gaming/cmap.cpp index 5ee8d83e8..fac68b486 100644 --- a/src/eepp/gaming/cmap.cpp +++ b/src/eepp/gaming/cmap.cpp @@ -768,7 +768,7 @@ bool cMap::LoadFromStream( cIOStream& IOS ) { eeSAFE_DELETE_ARRAY( tProp ); } - //! Load SubTexture Groups + //! Load Texture Atlases if ( MapHdr.TextureAtlasCount ) { sMapTextureAtlas * tSG = eeNewArray( sMapTextureAtlas, MapHdr.TextureAtlasCount ); @@ -780,7 +780,7 @@ bool cMap::LoadFromStream( cIOStream& IOS ) { TextureAtlases.push_back( std::string( tSG[i].Path ) ); } - //! Load the Texture groups if needed + //! Load the Texture Atlases if needed for ( i = 0; i < TextureAtlases.size(); i++ ) { std::string sgname = FileSystem::FileRemoveExtension( FileSystem::FileNameFromPath( TextureAtlases[i] ) ); diff --git a/src/eepp/gaming/mapeditor/cmapeditor.cpp b/src/eepp/gaming/mapeditor/cmapeditor.cpp index 9aea2e04d..b343ceaf7 100644 --- a/src/eepp/gaming/mapeditor/cmapeditor.cpp +++ b/src/eepp/gaming/mapeditor/cmapeditor.cpp @@ -109,8 +109,8 @@ void cMapEditor::CreateWinMenu() { WinMenu->AddMenuButton( "View", PU3 ); cUIPopUpMenu * PU4 = mTheme->CreatePopUpMenu( mUIContainer ); - PU4->Add( "New Texture Group..." ); - PU4->Add( "Add External Texture Group..." ); + PU4->Add( "New Texture Atlas..." ); + PU4->Add( "Add External Texture Atlas..." ); PU4->AddSeparator(); PU4->Add( "Map Properties..." ); @@ -277,7 +277,7 @@ void cMapEditor::CreateSubTextureContainer( Int32 Width ) { mSGCont->Enabled( true ); mSGCont->Visible( true ); - Txt = mTheme->CreateTextBox( "SubTexture Groups:", mSGCont, eeSize( Width, 16 ), eeVector2i( 0, 0 ), TxtFlags ); + Txt = mTheme->CreateTextBox( "Texture Atlases:", mSGCont, eeSize( Width, 16 ), eeVector2i( 0, 0 ), TxtFlags ); mTextureAtlasesList = mTheme->CreateDropDownList( mSGCont, eeSize( Width, 21 ), eeVector2i( 0, Txt->Pos().y +Txt->Size().Height() + 4 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); mTextureAtlasesList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &cMapEditor::OnTextureAtlasChange ) ); @@ -883,16 +883,16 @@ void cMapEditor::MapMenuClick( const cUIEvent * Event ) { const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); - if ( "New Texture Group..." == txt ) { + if ( "New Texture Atlas..." == txt ) { cUIWindow * tWin = mTheme->CreateWindow( NULL, eeSize( 1024, 768 ), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, eeSize( 1024, 768 ) ); eeNew ( Tools::cTextureAtlasEditor, ( tWin ) ); tWin->Center(); tWin->Show(); - } else if ( "Add External Texture Group..." == txt ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, eeSize(), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, eeSize(), 255, UI_CDL_DEFAULT_FLAGS, "*.etg" ); + } else if ( "Add External Texture Atlas..." == txt ) { + cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, eeSize(), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, eeSize(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION ); - TGDialog->Title( "Load texture group..." ); - TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &cMapEditor::TextureGroupOpen ) ); + TGDialog->Title( "Load Texture Atlas..." ); + TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &cMapEditor::TextureAtlasOpen ) ); TGDialog->Center(); TGDialog->Show(); } else if ( "Map Properties..." == txt ) { @@ -990,7 +990,7 @@ void cMapEditor::RefreshLayersList() { } } -void cMapEditor::TextureGroupOpen( const cUIEvent * Event ) { +void cMapEditor::TextureAtlasOpen( const cUIEvent * Event ) { cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); std::string sgname = FileSystem::FileRemoveExtension( FileSystem::FileNameFromPath( CDL->GetFullPath() ) ); diff --git a/src/eepp/graphics/cprimitives.cpp b/src/eepp/graphics/cprimitives.cpp index 8123b3812..89aab00c6 100755 --- a/src/eepp/graphics/cprimitives.cpp +++ b/src/eepp/graphics/cprimitives.cpp @@ -1,5 +1,5 @@ #include -#include +#include namespace EE { namespace Graphics { diff --git a/src/eepp/graphics/ctextureatlasloader.cpp b/src/eepp/graphics/ctextureatlasloader.cpp index 5eccba6a6..95eecc11f 100644 --- a/src/eepp/graphics/ctextureatlasloader.cpp +++ b/src/eepp/graphics/ctextureatlasloader.cpp @@ -22,8 +22,8 @@ cTextureAtlasLoader::cTextureAtlasLoader() : { } -cTextureAtlasLoader::cTextureAtlasLoader( const std::string& TextureGroupPath, const bool& Threaded, GLLoadCallback LoadCallback ) : - mTextureGroupPath( TextureGroupPath ), +cTextureAtlasLoader::cTextureAtlasLoader( const std::string& TextureAtlasPath, const bool& Threaded, GLLoadCallback LoadCallback ) : + mTextureAtlasPath( TextureAtlasPath ), mThreaded( Threaded ), mLoaded(false), mPack(NULL), @@ -35,8 +35,8 @@ cTextureAtlasLoader::cTextureAtlasLoader( const std::string& TextureGroupPath, c Load(); } -cTextureAtlasLoader::cTextureAtlasLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureGroupName, const bool& Threaded, GLLoadCallback LoadCallback ) : - mTextureGroupPath( TextureGroupName ), +cTextureAtlasLoader::cTextureAtlasLoader( const Uint8* Data, const Uint32& DataSize, const std::string& TextureAtlasName, const bool& Threaded, GLLoadCallback LoadCallback ) : + mTextureAtlasPath( TextureAtlasName ), mThreaded( Threaded ), mLoaded(false), mPack(NULL), @@ -45,11 +45,11 @@ cTextureAtlasLoader::cTextureAtlasLoader( const Uint8* Data, const Uint32& DataS mTextureAtlas(NULL), mLoadCallback( LoadCallback ) { - LoadFromMemory( Data, DataSize, TextureGroupName ); + LoadFromMemory( Data, DataSize, TextureAtlasName ); } cTextureAtlasLoader::cTextureAtlasLoader( cPack * Pack, const std::string& FilePackPath, const bool& Threaded, GLLoadCallback LoadCallback ) : - mTextureGroupPath( FilePackPath ), + mTextureAtlasPath( FilePackPath ), mThreaded( Threaded ), mLoaded(false), mPack(NULL), @@ -80,20 +80,20 @@ void cTextureAtlasLoader::LoadFromStream( cIOStream& IOS ) { mRL.Threaded( mThreaded ); if ( IOS.IsOpen() ) { - IOS.Read( (char*)&mTexGrHdr, sizeof(sTextureGroupHdr) ); + IOS.Read( (char*)&mTexGrHdr, sizeof(sTextureAtlasHdr) ); - if ( mTexGrHdr.Magic == ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ) ) { + if ( mTexGrHdr.Magic == EE_TEXTURE_ATLAS_MAGIC || mTexGrHdr.Magic == EE_TEXTURE_ATLAS_MAGIC_OLD ) { for ( Uint32 i = 0; i < mTexGrHdr.TextureCount; i++ ) { sTextureHdr tTextureHdr; - sTempTexGroup tTexGroup; + sTempTexAtlas tTexAtlas; IOS.Read( (char*)&tTextureHdr, sizeof(sTextureHdr) ); - tTexGroup.Texture = tTextureHdr; - tTexGroup.SubTextures.resize( tTextureHdr.SubTextureCount ); + tTexAtlas.Texture = tTextureHdr; + tTexAtlas.SubTextures.resize( tTextureHdr.SubTextureCount ); std::string name( &tTextureHdr.Name[0] ); - std::string path( FileSystem::FileRemoveFileName( mTextureGroupPath ) + name ); + std::string path( FileSystem::FileRemoveFileName( mTextureAtlasPath ) + name ); //! Checks if the texture is already loaded cTexture * tTex = cTextureFactory::instance()->GetByName( path ); @@ -106,9 +106,9 @@ void cTextureAtlasLoader::LoadFromStream( cIOStream& IOS ) { } } - IOS.Read( (char*)&tTexGroup.SubTextures[0], sizeof(sSubTextureHdr) * tTextureHdr.SubTextureCount ); + IOS.Read( (char*)&tTexAtlas.SubTextures[0], sizeof(sSubTextureHdr) * tTextureHdr.SubTextureCount ); - mTempGroups.push_back( tTexGroup ); + mTempAtlass.push_back( tTexAtlas ); } } @@ -122,16 +122,16 @@ void cTextureAtlasLoader::LoadFromStream( cIOStream& IOS ) { } } -void cTextureAtlasLoader::Load( const std::string& TextureGroupPath ) { - if ( TextureGroupPath.size() ) - mTextureGroupPath = TextureGroupPath; +void cTextureAtlasLoader::Load( const std::string& TextureAtlasPath ) { + if ( TextureAtlasPath.size() ) + mTextureAtlasPath = TextureAtlasPath; - if ( FileSystem::FileExists( mTextureGroupPath ) ) { - cIOStreamFile IOS( mTextureGroupPath, std::ios::in | std::ios::binary ); + if ( FileSystem::FileExists( mTextureAtlasPath ) ) { + cIOStreamFile IOS( mTextureAtlasPath, std::ios::in | std::ios::binary ); LoadFromStream( IOS ); } else if ( cPackManager::instance()->FallbackToPacks() ) { - std::string tgPath( mTextureGroupPath ); + std::string tgPath( mTextureAtlasPath ); cPack * tPack = cPackManager::instance()->Exists( tgPath ); @@ -153,9 +153,9 @@ void cTextureAtlasLoader::LoadFromPack( cPack * Pack, const std::string& FilePac } } -void cTextureAtlasLoader::LoadFromMemory( const Uint8* Data, const Uint32& DataSize, const std::string& TextureGroupName ) { - if ( TextureGroupName.size() ) - mTextureGroupPath = TextureGroupName; +void cTextureAtlasLoader::LoadFromMemory( const Uint8* Data, const Uint32& DataSize, const std::string& TextureAtlasName ) { + if ( TextureAtlasName.size() ) + mTextureAtlasPath = TextureAtlasName; cIOStreamMemory IOS( (const char*)Data, DataSize ); @@ -170,12 +170,12 @@ void cTextureAtlasLoader::CreateSubTextures() { mIsLoading = false; bool IsAlreadyLoaded = false; - for ( Uint32 z = 0; z < mTempGroups.size(); z++ ) { - sTempTexGroup * tTexGroup = &mTempGroups[z]; - sTextureHdr * tTexHdr = &tTexGroup->Texture; + for ( Uint32 z = 0; z < mTempAtlass.size(); z++ ) { + sTempTexAtlas * tTexAtlas = &mTempAtlass[z]; + sTextureHdr * tTexHdr = &tTexAtlas->Texture; std::string name( &tTexHdr->Name[0] ); - std::string path( FileSystem::FileRemoveFileName( mTextureGroupPath ) + name ); + std::string path( FileSystem::FileRemoveFileName( mTextureAtlasPath ) + name ); FileSystem::FilePathRemoveProcessPath( path ); @@ -186,21 +186,21 @@ void cTextureAtlasLoader::CreateSubTextures() { // Create the Texture Atlas with the name of the real texture, not the Childs ( example load 1.png and not 1_ch1.png ) if ( 0 == z ) { - if ( mTexGrHdr.Flags & HDR_TEXTURE_GROUP_REMOVE_EXTENSION ) + if ( mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_REMOVE_EXTENSION ) name = FileSystem::FileRemoveExtension( name ); - std::string etgpath = FileSystem::FileRemoveExtension( path ) + ".etg"; + std::string etapath = FileSystem::FileRemoveExtension( path ) + EE_TEXTURE_ATLAS_EXTENSION; cTextureAtlas * tTextureAtlas = cTextureAtlasManager::instance()->GetByName( name ); - if ( NULL != tTextureAtlas && tTextureAtlas->Path() == etgpath ) { + if ( NULL != tTextureAtlas && tTextureAtlas->Path() == etapath ) { mTextureAtlas = tTextureAtlas; IsAlreadyLoaded = true; } else { mTextureAtlas = eeNew( cTextureAtlas, ( name ) ); - mTextureAtlas->Path( etgpath ); + mTextureAtlas->Path( etapath ); cTextureAtlasManager::instance()->Add( mTextureAtlas ); } @@ -209,11 +209,11 @@ void cTextureAtlasLoader::CreateSubTextures() { if ( NULL != tTex ) { if ( !IsAlreadyLoaded ) { for ( Int32 i = 0; i < tTexHdr->SubTextureCount; i++ ) { - sSubTextureHdr * tSh = &tTexGroup->SubTextures[i]; + sSubTextureHdr * tSh = &tTexAtlas->SubTextures[i]; std::string SubTextureName( &tSh->Name[0] ); - if ( mTexGrHdr.Flags & HDR_TEXTURE_GROUP_REMOVE_EXTENSION ) + if ( mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_REMOVE_EXTENSION ) SubTextureName = FileSystem::FileRemoveExtension( SubTextureName ); eeRecti tRect( tSh->X, tSh->Y, tSh->X + tSh->Width, tSh->Y + tSh->Height ); @@ -227,7 +227,7 @@ void cTextureAtlasLoader::CreateSubTextures() { } } } else { - cLog::instance()->Write( "cTextureAtlasLoader::CreateSubTextures: Failed to find texture group texture, it seems that is not loaded for some reason. Couldn't find: " + path ); + cLog::instance()->Write( "cTextureAtlasLoader::CreateSubTextures: Failed to find texture atlas texture, it seems that is not loaded for some reason. Couldn't find: " + path ); eeASSERT( NULL != tTex ); @@ -268,16 +268,16 @@ Uint32 cTextureAtlasLoader::GetTexturesLoadedCount() { } bool cTextureAtlasLoader::UpdateTextureAtlas() { - if ( NULL == mTextureAtlas || !mTextureGroupPath.size() ) + if ( NULL == mTextureAtlas || !mTextureAtlasPath.size() ) return false; //! Update the data of the texture atlas - for ( Uint32 z = 0; z < mTempGroups.size(); z++ ) { - sTempTexGroup * tTexGroup = &mTempGroups[z]; - sTextureHdr * tTexHdr = &tTexGroup->Texture; + for ( Uint32 z = 0; z < mTempAtlass.size(); z++ ) { + sTempTexAtlas * tTexAtlas = &mTempAtlass[z]; + sTextureHdr * tTexHdr = &tTexAtlas->Texture; for ( Int32 i = 0; i < tTexHdr->SubTextureCount; i++ ) { - sSubTextureHdr * tSh = &tTexGroup->SubTextures[i]; + sSubTextureHdr * tSh = &tTexAtlas->SubTextures[i]; cSubTexture * tSubTexture = mTextureAtlas->GetById( tSh->ResourceID ); if ( NULL != tSubTexture ) { @@ -289,18 +289,18 @@ bool cTextureAtlasLoader::UpdateTextureAtlas() { } } - cIOStreamFile fs( mTextureGroupPath, std::ios::out | std::ios::binary ); + cIOStreamFile fs( mTextureAtlasPath, std::ios::out | std::ios::binary ); if ( fs.IsOpen() ) { - fs.Write( reinterpret_cast (&mTexGrHdr), sizeof(sTextureGroupHdr) ); + fs.Write( reinterpret_cast (&mTexGrHdr), sizeof(sTextureAtlasHdr) ); - for ( Uint32 z = 0; z < mTempGroups.size(); z++ ) { - sTempTexGroup * tTexGroup = &mTempGroups[z]; - sTextureHdr * tTexHdr = &tTexGroup->Texture; + for ( Uint32 z = 0; z < mTempAtlass.size(); z++ ) { + sTempTexAtlas * tTexAtlas = &mTempAtlass[z]; + sTextureHdr * tTexHdr = &tTexAtlas->Texture; fs.Write( reinterpret_cast ( tTexHdr ), sizeof(sTextureHdr) ); - fs.Write( reinterpret_cast ( &tTexGroup->SubTextures[0] ), sizeof(sSubTextureHdr) * (std::streamsize)tTexGroup->SubTextures.size() ); + fs.Write( reinterpret_cast ( &tTexAtlas->SubTextures[0] ), sizeof(sSubTextureHdr) * (std::streamsize)tTexAtlas->SubTextures.size() ); } return true; @@ -348,7 +348,7 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: Load( TextureAtlasPath ); mSkipResourceLoad = false; - if ( !mTempGroups.size() ) + if ( !mTempAtlass.size() ) return false; Int32 x, y, c; @@ -360,8 +360,8 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: Uint32 z; Uint32 totalSubTextures = 0; - for ( z = 0; z < mTempGroups.size(); z++ ) - totalSubTextures += mTempGroups[z].Texture.SubTextureCount; + for ( z = 0; z < mTempAtlass.size(); z++ ) + totalSubTextures += mTempAtlass[z].Texture.SubTextureCount; Uint32 totalImages = 0; std::vector PathFiles = FileSystem::FilesGetInPath( ImagesPath ); @@ -377,13 +377,13 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: if ( totalSubTextures != totalImages ) { NeedUpdate = 2; } else { - for ( z = 0; z < mTempGroups.size(); z++ ) { - sTempTexGroup * tTexGroup = &mTempGroups[z]; - sTextureHdr * tTexHdr = &tTexGroup->Texture; + for ( z = 0; z < mTempAtlass.size(); z++ ) { + sTempTexAtlas * tTexAtlas = &mTempAtlass[z]; + sTextureHdr * tTexHdr = &tTexAtlas->Texture; if ( 2 != NeedUpdate ) { for ( Int32 i = 0; i < tTexHdr->SubTextureCount; i++ ) { - sSubTextureHdr * tSh = &tTexGroup->SubTextures[i]; + sSubTextureHdr * tSh = &tTexAtlas->SubTextures[i]; std::string path( ImagesPath + tSh->Name ); @@ -420,7 +420,7 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: std::string tapath( FileSystem::FileRemoveExtension( TextureAtlasPath ) + "." + cImage::SaveTypeToExtension( mTexGrHdr.Format ) ); if ( 2 == NeedUpdate ) { - cTexturePacker tp( mTexGrHdr.Width, mTexGrHdr.Height, 0 != ( mTexGrHdr.Flags & HDR_TEXTURE_GROUP_POW_OF_TWO ), mTexGrHdr.PixelBorder, mTexGrHdr.Flags & HDR_TEXTURE_GROUP_ALLOW_FLIPPING ); + cTexturePacker tp( mTexGrHdr.Width, mTexGrHdr.Height, 0 != ( mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_POW_OF_TWO ), mTexGrHdr.PixelBorder, mTexGrHdr.Flags & HDR_TEXTURE_ATLAS_ALLOW_FLIPPING ); tp.AddTexturesPath( ImagesPath ); @@ -428,16 +428,16 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: tp.Save( tapath, (EE_SAVE_TYPE)mTexGrHdr.Format ); } else if ( 1 == NeedUpdate ) { - std::string etgpath = FileSystem::FileRemoveExtension( tapath ) + ".etg"; + std::string etapath = FileSystem::FileRemoveExtension( tapath ) + EE_TEXTURE_ATLAS_EXTENSION; - cIOStreamFile fs( etgpath , std::ios::out | std::ios::binary ); + cIOStreamFile fs( etapath , std::ios::out | std::ios::binary ); if ( !fs.IsOpen() ) return false; - fs.Write( reinterpret_cast (&mTexGrHdr), sizeof(sTextureGroupHdr) ); + fs.Write( reinterpret_cast (&mTexGrHdr), sizeof(sTextureAtlasHdr) ); - for ( Uint32 z = 0; z < mTempGroups.size(); z++ ) { + for ( Uint32 z = 0; z < mTempAtlass.size(); z++ ) { if ( z != 0 ) { tapath = FileSystem::FileRemoveExtension( TextureAtlasPath ) + "_ch" + String::toStr( z ) + "." + cImage::SaveTypeToExtension( mTexGrHdr.Format ); } @@ -448,13 +448,13 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: cImage Img( imgPtr, x, y, c ); Img.AvoidFreeImage( true ); - sTempTexGroup * tTexGroup = &mTempGroups[z]; - sTextureHdr * tTexHdr = &tTexGroup->Texture; + sTempTexAtlas * tTexAtlas = &mTempAtlass[z]; + sTextureHdr * tTexHdr = &tTexAtlas->Texture; fs.Write( reinterpret_cast (tTexHdr), sizeof(sTextureHdr) ); for ( Int32 i = 0; i < tTexHdr->SubTextureCount; i++ ) { - sSubTextureHdr * tSh = &tTexGroup->SubTextures[i]; + sSubTextureHdr * tSh = &tTexAtlas->SubTextures[i]; std::string imgcopypath( ImagesPath + tSh->Name ); @@ -478,7 +478,7 @@ bool cTextureAtlasLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: } } - fs.Write( reinterpret_cast (&tTexGroup->SubTextures[0]), sizeof(sSubTextureHdr) * tTexHdr->SubTextureCount ); + fs.Write( reinterpret_cast (&tTexAtlas->SubTextures[0]), sizeof(sSubTextureHdr) * tTexHdr->SubTextureCount ); Img.SaveToFile( tapath, (EE_SAVE_TYPE)mTexGrHdr.Format ); diff --git a/src/eepp/graphics/ctexturepacker.cpp b/src/eepp/graphics/ctexturepacker.cpp index a84d15f2a..0952da313 100644 --- a/src/eepp/graphics/ctexturepacker.cpp +++ b/src/eepp/graphics/ctexturepacker.cpp @@ -558,9 +558,9 @@ void cTexturePacker::SaveSubTextures() { if ( NULL != mParent ) return; - sTextureGroupHdr TexGrHdr; + sTextureAtlasHdr TexGrHdr; - TexGrHdr.Magic = ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'T' << 16 ) | ( 'G' << 24 ) ); + TexGrHdr.Magic = EE_TEXTURE_ATLAS_MAGIC; TexGrHdr.TextureCount = 1 + GetChildCount(); TexGrHdr.Format = mFormat; TexGrHdr.Width = mWidth; @@ -569,13 +569,13 @@ void cTexturePacker::SaveSubTextures() { TexGrHdr.Flags = 0; if ( mAllowFlipping ) - TexGrHdr.Flags |= HDR_TEXTURE_GROUP_ALLOW_FLIPPING; + TexGrHdr.Flags |= HDR_TEXTURE_ATLAS_ALLOW_FLIPPING; if ( !mSaveExtensions ) - TexGrHdr.Flags |= HDR_TEXTURE_GROUP_REMOVE_EXTENSION; + TexGrHdr.Flags |= HDR_TEXTURE_ATLAS_REMOVE_EXTENSION; if ( mForcePowOfTwo ) - TexGrHdr.Flags |= HDR_TEXTURE_GROUP_POW_OF_TWO; + TexGrHdr.Flags |= HDR_TEXTURE_ATLAS_POW_OF_TWO; std::vector TexHdr( TexGrHdr.TextureCount ); @@ -592,11 +592,11 @@ void cTexturePacker::SaveSubTextures() { std::vector tSubTexturesHdr; - std::string path = FileSystem::FileRemoveExtension( mFilepath ) + ".etg"; + std::string path = FileSystem::FileRemoveExtension( mFilepath ) + EE_TEXTURE_ATLAS_EXTENSION; cIOStreamFile fs ( path , std::ios::out | std::ios::binary ); if ( fs.IsOpen() ) { - fs.Write( reinterpret_cast (&TexGrHdr), sizeof(sTextureGroupHdr) ); + fs.Write( reinterpret_cast (&TexGrHdr), sizeof(sTextureAtlasHdr) ); fs.Write( reinterpret_cast (&TexHdr[ 0 ]), sizeof(sTextureHdr) ); diff --git a/src/eepp/utils/cinterpolation.cpp b/src/eepp/math/cinterpolation.cpp similarity index 97% rename from src/eepp/utils/cinterpolation.cpp rename to src/eepp/math/cinterpolation.cpp index 74645eac1..a60aea75a 100644 --- a/src/eepp/utils/cinterpolation.cpp +++ b/src/eepp/math/cinterpolation.cpp @@ -1,8 +1,8 @@ -#include -#include -using namespace EE::Utils::easing; +#include +#include +using namespace EE::Math::easing; -namespace EE { namespace Utils { +namespace EE { namespace Math { cInterpolation::cInterpolation() : mType(LINEAR), diff --git a/src/eepp/utils/cperlinnoise.cpp b/src/eepp/math/cperlinnoise.cpp similarity index 97% rename from src/eepp/utils/cperlinnoise.cpp rename to src/eepp/math/cperlinnoise.cpp index 1530fa306..689f8997d 100755 --- a/src/eepp/utils/cperlinnoise.cpp +++ b/src/eepp/math/cperlinnoise.cpp @@ -1,6 +1,6 @@ -#include +#include -namespace EE { namespace Utils { +namespace EE { namespace Math { cPerlinNoise::cPerlinNoise() { Init(); diff --git a/src/eepp/utils/cwaypoints.cpp b/src/eepp/math/cwaypoints.cpp similarity index 97% rename from src/eepp/utils/cwaypoints.cpp rename to src/eepp/math/cwaypoints.cpp index 9179862fe..c604d23c4 100755 --- a/src/eepp/utils/cwaypoints.cpp +++ b/src/eepp/math/cwaypoints.cpp @@ -1,8 +1,8 @@ -#include -#include -using namespace EE::Utils::easing; +#include +#include +using namespace EE::Math::easing; -namespace EE { namespace Utils { +namespace EE { namespace Math { cWaypoints::cWaypoints() : mType(LINEAR), diff --git a/src/eepp/math/easing.cpp b/src/eepp/math/easing.cpp new file mode 100644 index 000000000..b355e7fa8 --- /dev/null +++ b/src/eepp/math/easing.cpp @@ -0,0 +1,39 @@ +#include + +namespace EE { namespace Math { namespace easing { + +easingCbFunc easingCb[] = { + LinearInterpolation, + QuadraticIn, + QuadraticOut, + QuadraticInOut, + SineIn, + SineOut, + SineInOut, + ExponentialIn, + ExponentialOut, + ExponentialInOut, + QuarticIn, + QuarticOut, + QuarticInOut, + QuinticIn, + QuinticOut, + QuinticInOut, + CircularIn, + CircularOut, + CircularInOut, + CubicIn, + CubicOut, + CubicInOut, + BackIn, + BackOut, + BackInOut, + BounceIn, + BounceOut, + BounceInOut, + ElasticIn, + ElasticOut, + ElasticInOut +}; + +}}} diff --git a/src/eepp/utils/safedatapointer.cpp b/src/eepp/system/safedatapointer.cpp similarity index 52% rename from src/eepp/utils/safedatapointer.cpp rename to src/eepp/system/safedatapointer.cpp index 5c48dbae3..858c4e030 100644 --- a/src/eepp/utils/safedatapointer.cpp +++ b/src/eepp/system/safedatapointer.cpp @@ -1,6 +1,8 @@ -#include +#include +#include +#include -namespace EE { namespace Utils { +namespace EE { namespace System { SafeDataPointer::SafeDataPointer() : Data( NULL ), diff --git a/src/eepp/utils/utils.cpp b/src/eepp/system/utils.cpp similarity index 91% rename from src/eepp/utils/utils.cpp rename to src/eepp/system/utils.cpp index ce6d98e77..bb8d5e3dc 100755 --- a/src/eepp/utils/utils.cpp +++ b/src/eepp/system/utils.cpp @@ -1,6 +1,6 @@ -#include +#include -namespace EE { namespace Utils { +namespace EE { namespace System { Uint32 MakeHash( const std::string& str ) { return MakeHash( reinterpret_cast( &str[0] ) ); diff --git a/src/eepp/ui/cuitheme.cpp b/src/eepp/ui/cuitheme.cpp index f8e09cf49..70fc8b6f3 100644 --- a/src/eepp/ui/cuitheme.cpp +++ b/src/eepp/ui/cuitheme.cpp @@ -144,7 +144,7 @@ cUITheme * cUITheme::LoadFromTextureAtlas( cUITheme * tTheme, cTextureAtlas * Te Element = std::string( tTheme->Abbr() + "_" + *it ); - Found = SearchFilesInGroup( TextureAtlas, Element, IsComplex ); + Found = SearchFilesInAtlas( TextureAtlas, Element, IsComplex ); if ( Found ) { ElemFound.push_back( Element ); @@ -235,7 +235,7 @@ cUITheme * cUITheme::LoadFromTextureAtlas( cTextureAtlas * TextureAtlas, const s return LoadFromTextureAtlas( eeNew( cUITheme, ( Name, NameAbbr ) ), TextureAtlas ); } -bool cUITheme::SearchFilesInGroup( cTextureAtlas * SG, std::string Element, Uint32& IsComplex ) { +bool cUITheme::SearchFilesInAtlas( cTextureAtlas * SG, std::string Element, Uint32& IsComplex ) { bool Found = false; Uint32 i = 0, s = 0; std::string ElemName; diff --git a/src/eepp/ui/tools/ctextureatlaseditor.cpp b/src/eepp/ui/tools/ctextureatlaseditor.cpp index 9af872266..9a19e9bda 100644 --- a/src/eepp/ui/tools/ctextureatlaseditor.cpp +++ b/src/eepp/ui/tools/ctextureatlaseditor.cpp @@ -13,7 +13,7 @@ cTextureAtlasEditor::cTextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorC mUIWindow( AttatchTo ), mCloseCb( callback ), mTexturePacker( NULL ), - mTextureGroupLoader( NULL ), + mTextureAtlasLoader( NULL ), mCurSubTexture( NULL ) { if ( NULL == cUIThemeManager::instance()->DefaultTheme() ) { @@ -102,7 +102,7 @@ cTextureAtlasEditor::cTextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorC HBOffsetButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cTextureAtlasEditor::OnHBOffset ) ); HBOffsetButton->Text( "Half-Bottom Offset" ); - mUIWindow->Title( "Texture Group Editor" ); + mUIWindow->Title( "Texture Atlas Editor" ); mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &cTextureAtlasEditor::WindowClose ) ); CreateTGEditor(); @@ -122,7 +122,7 @@ cTextureAtlasEditor::cTextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorC cTextureAtlasEditor::~cTextureAtlasEditor() { eeSAFE_DELETE( mTexturePacker ); - eeSAFE_DELETE( mTextureGroupLoader ); + eeSAFE_DELETE( mTextureAtlasLoader ); if ( !cUIManager::instance()->IsShootingDown() ) { mTGEU->Close(); @@ -236,27 +236,27 @@ void cTextureAtlasEditor::FileMenuClick( const cUIEvent * Event ) { const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "New..." == txt ) { - eeNew( cTextureAtlasNew, ( cb::Make1( this, &cTextureAtlasEditor::OnTextureGroupCreate ) ) ); + eeNew( cTextureAtlasNew, ( cb::Make1( this, &cTextureAtlasEditor::OnTextureAtlasCreate ) ) ); } else if ( "Open..." == txt ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, eeSize(), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, eeSize(), 255, UI_CDL_DEFAULT_FLAGS, "*.etg" ); + cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, eeSize(), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, eeSize(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION ); - TGDialog->Title( "Open Texture Group" ); - TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &cTextureAtlasEditor::OpenTextureGroup ) ); + TGDialog->Title( "Open Texture Atlas" ); + TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &cTextureAtlasEditor::OpenTextureAtlas ) ); TGDialog->Center(); TGDialog->Show(); } else if ( "Save" == txt ) { - if ( NULL != mTextureGroupLoader && mTextureGroupLoader->IsLoaded() ) { - mTextureGroupLoader->UpdateTextureAtlas(); + if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { + mTextureAtlasLoader->UpdateTextureAtlas(); } } else if ( "Close" == txt ) { - if ( NULL != mTextureGroupLoader && mTextureGroupLoader->IsLoaded() ) { - cUIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current texture group?\nAll changes will be lost." ); - MsgBox->AddEventListener( cUIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &cTextureAtlasEditor::OnTextureGroupClose ) ); - MsgBox->Title( "Close Texture Group?" ); + if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { + cUIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current texture atlas?\nAll changes will be lost." ); + MsgBox->AddEventListener( cUIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &cTextureAtlasEditor::OnTextureAtlasClose ) ); + MsgBox->Title( "Close Texture Atlas?" ); MsgBox->Center(); MsgBox->Show(); } else { - OnTextureGroupClose( NULL ); + OnTextureAtlasClose( NULL ); } } else if ( "Quit" == txt ) { if ( mUIWindow == cUIManager::instance()->MainControl() ) { @@ -267,28 +267,28 @@ void cTextureAtlasEditor::FileMenuClick( const cUIEvent * Event ) { } } -void cTextureAtlasEditor::OnTextureGroupCreate( cTexturePacker * TexPacker ) { +void cTextureAtlasEditor::OnTextureAtlasCreate( cTexturePacker * TexPacker ) { eeSAFE_DELETE( mTexturePacker ); mTexturePacker = TexPacker; - eeSAFE_DELETE( mTextureGroupLoader ); + eeSAFE_DELETE( mTextureAtlasLoader ); - std::string FPath( FileSystem::FileRemoveExtension( mTexturePacker->GetFilepath() ) + ".etg" ); + std::string FPath( FileSystem::FileRemoveExtension( mTexturePacker->GetFilepath() + EE_TEXTURE_ATLAS_EXTENSION ) ); - mTextureGroupLoader = eeNew( cTextureAtlasLoader, ( FPath, true, cb::Make1( this, &cTextureAtlasEditor::OnTextureGroupLoaded ) ) ); + mTextureAtlasLoader = eeNew( cTextureAtlasLoader, ( FPath, true, cb::Make1( this, &cTextureAtlasEditor::OnTextureAtlasLoaded ) ) ); } void cTextureAtlasEditor::UpdateControls() { - if ( NULL != mTextureGroupLoader && mTextureGroupLoader->IsLoaded() ) { + if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { FillSubTextureList(); } } void cTextureAtlasEditor::FillSubTextureList() { - if ( NULL == mTextureGroupLoader || NULL == mTextureGroupLoader->GetTextureAtlas() || !mTextureGroupLoader->IsLoaded() ) + if ( NULL == mTextureAtlasLoader || NULL == mTextureAtlasLoader->GetTextureAtlas() || !mTextureAtlasLoader->IsLoaded() ) return; - std::list& Res = mTextureGroupLoader->GetTextureAtlas()->GetResources(); + std::list& Res = mTextureAtlasLoader->GetTextureAtlas()->GetResources(); mSubTextureList->Clear(); @@ -309,8 +309,8 @@ void cTextureAtlasEditor::FillSubTextureList() { } void cTextureAtlasEditor::OnSubTextureChange( const cUIEvent * Event ) { - if ( NULL != mTextureGroupLoader && NULL != mTextureGroupLoader->GetTextureAtlas() ) { - mCurSubTexture = mTextureGroupLoader->GetTextureAtlas()->GetByName( mSubTextureList->GetItemSelectedText() ); + if ( NULL != mTextureAtlasLoader && NULL != mTextureAtlasLoader->GetTextureAtlas() ) { + mCurSubTexture = mTextureAtlasLoader->GetTextureAtlas()->GetByName( mSubTextureList->GetItemSelectedText() ); if ( NULL != mCurSubTexture ) { mSubTextureEditor->SubTexture( mCurSubTexture ); @@ -323,32 +323,32 @@ void cTextureAtlasEditor::OnSubTextureChange( const cUIEvent * Event ) { } void cTextureAtlasEditor::Update() { - if ( NULL != mTextureGroupLoader && !mTextureGroupLoader->IsLoaded() ) { - mTextureGroupLoader->Update(); + if ( NULL != mTextureAtlasLoader && !mTextureAtlasLoader->IsLoaded() ) { + mTextureAtlasLoader->Update(); } } -void cTextureAtlasEditor::OpenTextureGroup( const cUIEvent * Event ) { +void cTextureAtlasEditor::OpenTextureAtlas( const cUIEvent * Event ) { cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); - eeSAFE_DELETE( mTextureGroupLoader ); - mTextureGroupLoader = eeNew( cTextureAtlasLoader, ( CDL->GetFullPath(), true, cb::Make1( this, &cTextureAtlasEditor::OnTextureGroupLoaded ) ) ); + eeSAFE_DELETE( mTextureAtlasLoader ); + mTextureAtlasLoader = eeNew( cTextureAtlasLoader, ( CDL->GetFullPath(), true, cb::Make1( this, &cTextureAtlasEditor::OnTextureAtlasLoaded ) ) ); } -void cTextureAtlasEditor::OnTextureGroupLoaded( cTextureAtlasLoader * TGLoader ) { - if ( NULL != mTextureGroupLoader && mTextureGroupLoader->IsLoaded() ) { +void cTextureAtlasEditor::OnTextureAtlasLoaded( cTextureAtlasLoader * TGLoader ) { + if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { UpdateControls(); } } -void cTextureAtlasEditor::SaveTextureGroup( const cUIEvent * Event ) { - if ( NULL != mTextureGroupLoader && mTextureGroupLoader->IsLoaded() ) { - mTextureGroupLoader->UpdateTextureAtlas(); +void cTextureAtlasEditor::SaveTextureAtlas( const cUIEvent * Event ) { + if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { + mTextureAtlasLoader->UpdateTextureAtlas(); } } -void cTextureAtlasEditor::OnTextureGroupClose( const cUIEvent * Event ) { - eeSAFE_DELETE( mTextureGroupLoader ); +void cTextureAtlasEditor::OnTextureAtlasClose( const cUIEvent * Event ) { + eeSAFE_DELETE( mTextureAtlasLoader ); mSubTextureList->Clear(); mSpinOffX->Value( 0 ); mSpinOffY->Value( 0 ); diff --git a/src/eepp/ui/tools/ctextureatlasnew.cpp b/src/eepp/ui/tools/ctextureatlasnew.cpp index c43299772..7bc37a906 100644 --- a/src/eepp/ui/tools/ctextureatlasnew.cpp +++ b/src/eepp/ui/tools/ctextureatlasnew.cpp @@ -18,7 +18,7 @@ cTextureAtlasNew::cTextureAtlasNew( TGCreateCb NewTGCb ) : mUIWindow = mTheme->CreateWindow( NULL, eeSize( 378, 244 ), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL ); mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &cTextureAtlasNew::WindowClose ) ); - mUIWindow->Title( "New Texture Group" ); + mUIWindow->Title( "New Texture Atlas" ); Int32 PosX = mUIWindow->Container()->Size().Width() - 110; @@ -53,10 +53,10 @@ cTextureAtlasNew::cTextureAtlasNew( TGCreateCb NewTGCb ) : mComboWidth->ListBox()->SetSelected( "512" ); mComboHeight->ListBox()->SetSelected( "512" ); - CreateTxtBox( eeVector2i( 10, 110 ), "Space between sub texturesF (pixels):" ); + CreateTxtBox( eeVector2i( 10, 110 ), "Space between sub textures (pixels):" ); mPixelSpace = mTheme->CreateSpinBox( mUIWindow->Container(), eeSize( 100, 22 ), eeVector2i( PosX, 110 ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_SIZE, 0, false ); - CreateTxtBox( eeVector2i( 10, 140 ), "Texture Group Folder Path:" ); + CreateTxtBox( eeVector2i( 10, 140 ), "Texture Atlas Folder Path:" ); mTGPath = mTheme->CreateTextInput( mUIWindow->Container(), eeSize( mUIWindow->Container()->Size().Width() - 60, 22 ), eeVector2i( 10, 160 ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE , false, 512 ); mTGPath->AllowEditing( false ); @@ -90,8 +90,8 @@ void cTextureAtlasNew::OKClick( const cUIEvent * Event ) { cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, eeSize(), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, eeSize(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*." + ext ); - TGDialog->Title( "Save Texture Group" ); - TGDialog->AddEventListener( cUIEvent::EventSaveFile, cb::Make1( this, &cTextureAtlasNew::TextureGroupSave ) ); + TGDialog->Title( "Save Texture Atlas" ); + TGDialog->AddEventListener( cUIEvent::EventSaveFile, cb::Make1( this, &cTextureAtlasNew::TextureAtlasSave ) ); TGDialog->Center(); TGDialog->Show(); } @@ -108,7 +108,7 @@ static bool IsValidExtension( const std::string& ext ) { return ext == "png" || ext == "bmp" || ext == "dds" || ext == "tga"; } -void cTextureAtlasNew::TextureGroupSave( const cUIEvent * Event ) { +void cTextureAtlasNew::TextureAtlasSave( const cUIEvent * Event ) { cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); std::string FPath( CDL->GetFullPath() ); @@ -153,7 +153,7 @@ void cTextureAtlasNew::OnDialogFolderSelect( const cUIEvent * Event ) { if ( MouseEvent->Flags() & EE_BUTTON_LMASK ) { cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, eeSize(), eeVector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, eeSize(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT, "*" ); - TGDialog->Title( "Create Texture Group ( Select Folder Containing Textures )" ); + TGDialog->Title( "Create Texture Atlas ( Select Folder Containing Textures )" ); TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &cTextureAtlasNew::OnSelectFolder ) ); TGDialog->Center(); TGDialog->Show(); diff --git a/src/eepp/utils/easing.cpp b/src/eepp/utils/easing.cpp deleted file mode 100644 index 3f5fa718d..000000000 --- a/src/eepp/utils/easing.cpp +++ /dev/null @@ -1,310 +0,0 @@ -#include - -namespace EE { namespace Utils { namespace easing { - -easingCbFunc easingCb[] = { - LinearInterpolation, - QuadraticIn, - QuadraticOut, - QuadraticInOut, - SineIn, - SineOut, - SineInOut, - ExponentialIn, - ExponentialOut, - ExponentialInOut, - QuarticIn, - QuarticOut, - QuarticInOut, - QuinticIn, - QuinticOut, - QuinticInOut, - CircularIn, - CircularOut, - CircularInOut, - CubicIn, - CubicOut, - CubicInOut, - BackIn, - BackOut, - BackInOut, - BounceIn, - BounceOut, - BounceInOut, - ElasticIn, - ElasticOut, - ElasticInOut -}; - -eeFloat LinearInterpolation( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return b + t * c / d; -} - -eeFloat QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - return c * t * t + b; -} - -eeFloat QuadraticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - return -c * t * ( t - 2 ) + b; -} - -eeFloat QuadraticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d / 2; - - if ( t < 1 ) - return c / 2 * t * t + b; - - --t; - - return -c / 2 * ( t * ( t - 2 ) - 1 ) + b; -} - -eeFloat SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return -c * eecos( t / d * ( EE_PI / 2 ) ) + c + b; -} - -eeFloat SineOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return c * eesin( t / d * ( EE_PI / 2 ) ) + b; -} - -eeFloat SineInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return -c / 2 * ( eecos( EE_PI * t / d ) - 1 ) + b; -} - -eeFloat ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return t == 0 ? b : c * eepow( 2, 10 * ( t / d - 1 ) ) + b; -} - -eeFloat ExponentialOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return t == d ? b + c : c * ( -eepow( 2, -10 * t / d ) + 1 ) + b; -} - -eeFloat ExponentialInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - if (t == 0) - return b; - - if (t == d) - return b + c; - - if ( ( t /= d / 2 ) < 1 ) - return c / 2 * eepow( 2, 10 * (t - 1) ) + b; - - return c / 2 * ( -eepow( 2, -10 * --t ) + 2 ) + b; -} - -eeFloat QuarticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - return c * t * t * t * t + b; -} - -eeFloat QuarticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t = t / d - 1; - - return -c * ( t * t * t * t - 1 ) + b; -} - -eeFloat QuarticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d / 2; - - if ( t < 1) - return c / 2 * t * t * t * t + b; - - t -= 2; - - return -c / 2 * ( t * t * t * t - 2 ) + b; -} - -eeFloat QuinticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - return c * t * t * t * t * t + b; -} - -eeFloat QuinticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t = t / d - 1; - - return c * ( t * t * t * t * t + 1) + b; -} - -eeFloat QuinticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d / 2; - - if ( t < 1 ) - return c / 2 * t * t * t * t * t + b; - - t -= 2; - - return c / 2 * ( t * t * t * t * t + 2) + b; -} - -eeFloat CircularIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - return -c * ( eesqrt( 1 - t * t ) - 1) + b; -} - -eeFloat CircularOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t = t / d - 1; - - return c * eesqrt( 1 - t * t ) + b; -} - -eeFloat CircularInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d / 2; - - if ( t < 1 ) - return -c / 2 * ( eesqrt( 1 - t * t ) - 1 ) + b; - - t -= 2; - - return c / 2 * ( eesqrt( 1 - t * t ) + 1) + b; -} - -eeFloat CubicIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - return c * t * t * t + b; -} - -eeFloat CubicOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t = t / d - 1; - - return c * ( t * t * t + 1) + b; -} - -eeFloat CubicInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d / 2; - - if ( t < 1 ) - return c / 2 * t * t * t + b; - - t -= 2; - - return c / 2 * ( t * t * t + 2 ) + b; -} - -eeFloat BackIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - eeFloat s = 1.70158f; - - t /= d; - - return c * t * t * ( ( s + 1 ) * t - s) + b; -} - -eeFloat BackOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - eeFloat s = 1.70158f; - - t = t / d - 1; - - return c * ( t * t * ( ( s + 1 ) * t + s ) + 1 ) + b; -} - -eeFloat BackInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - float s = 1.70158f; - - t /= d / 2; - s *= ( 1.525f ); - - if ( t < 1 ) - return c / 2 * ( t * t * ( ( s + 1 ) * t - s ) ) + b; - - t -= 2; - - return c / 2 * ( t * t * ( ( s + 1 ) * t + s ) + 2) + b; -} - -eeFloat BounceOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - t /= d; - - if ( t < ( 1.f / 2.75f ) ) { - return c * ( 7.5625f * t * t ) + b; - } else if ( t < ( 2.f / 2.75f) ) { - t -= ( 1.5f / 2.75f ); - - return c * ( 7.5625f * t * t + 0.75f ) + b; - } else if (t < ( 2.5f / 2.75f ) ) { - t -= ( 2.25f / 2.75f ); - - return c * ( 7.5625f * t * t + 0.9375f ) + b; - } else { - t -= ( 2.625f / 2.75f ); - - return c * ( 7.5625f * t * t + 0.984375f ) + b; - } -} - -eeFloat BounceIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - return c - BounceOut( d - t, 0, c, d ) + b; -} - -eeFloat BounceInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - if ( t < d * 0.5f ) - return BounceIn( t * 2.f, 0.f, c, d ) * 0.5f + b; - - return BounceOut( t * 2.f - d, 0.f, c, d ) * 0.5f + c * 0.5f + b; -} - -eeFloat ElasticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - if ( t == 0.f ) - return b; - - t /= d; - - if ( t == 1.f ) - return b + c; - - eeFloat p = d * 0.3f; - eeFloat s = p / 4.f; - eeFloat a = c; - - t -= 1.f; - - return -( a * eepow( 2.f , 10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) ) + b; -} - -eeFloat ElasticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - if ( t == 0.f ) - return b; - - t /= d; - - if ( t ==1 ) - return b + c; - - eeFloat p = d * 0.3f; - eeFloat s = p / 4.f; - eeFloat a = c; - - return ( a * eepow( 2.f, -10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) + c + b ); -} - -eeFloat ElasticInOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) { - if ( t == 0 ) - return b; - - t /= d / 2; - - if ( t == 2 ) - return b + c; - - eeFloat p = d * ( 0.3f * 1.5f ); - eeFloat a = c; - eeFloat s = p / 4.f; - - if ( t < 1 ) { - t -= 1.f; - - return -0.5f * ( a * eepow( 2.f, 10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) ) + b; - } - - t -= 1.f; - - return a * eepow( 2.f, -10.f * t ) * eesin( ( t * d - s ) * ( 2.f * EE_PI ) / p ) * 0.5f + c + b; -} - -}}} diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index ce30f2c80..6ed282453 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -145,14 +145,14 @@ void cEETest::CreateAquaTextureAtlas() { std::string tgpath( MyPath + "data/aquatg/aqua" ); std::string Path( MyPath + "data/aqua" ); - if ( !FileSystem::FileExists( tgpath + ".etg" ) ) { + if ( !FileSystem::FileExists( tgpath + EE_TEXTURE_ATLAS_EXTENSION ) ) { cTexturePacker tp( 256, 256, true, 2 ); tp.AddTexturesPath( Path ); tp.PackTextures(); tp.Save( tgpath + ".png", EE_SAVE_TYPE_PNG ); } else { cTextureAtlasLoader tgl; - tgl.UpdateTextureAtlas( tgpath + ".etg", Path ); + tgl.UpdateTextureAtlas( tgpath + EE_TEXTURE_ATLAS_EXTENSION, Path ); } } @@ -258,7 +258,7 @@ void cEETest::CreateUI() { //mTheme = cUITheme::LoadFromPath( eeNew( cUIAquaTheme, ( "aqua", "aqua" ) ), MyPath + "data/aqua/" ); - cTextureAtlasLoader tgl( MyPath + "data/aquatg/aqua.etg" ); + cTextureAtlasLoader tgl( MyPath + "data/aquatg/aqua" + EE_TEXTURE_ATLAS_EXTENSION ); tgl.GetTexture()->TextureFilter( TEX_FILTER_NEAREST ); mTheme = cUITheme::LoadFromTextureAtlas( eeNew( cUIAquaTheme, ( "aqua", "aqua" ) ), cTextureAtlasManager::instance()->GetByName( "aqua" ) ); @@ -470,7 +470,7 @@ void cEETest::CreateUI() { Menu->Add( "Open...", mTheme->GetIconByName( "document-open" ) ); Menu->AddSeparator(); Menu->Add( "Map Editor" ); - Menu->Add( "Texture Group Editor" ); + Menu->Add( "Texture Atlas Editor" ); Menu->AddSeparator(); Menu->Add( "Show Screen 1" ); Menu->Add( "Show Screen 2" ); @@ -707,7 +707,7 @@ void cEETest::ItemClick( const cUIEvent * Event ) { mUIWindow->Show(); } else if ( "Map Editor" == txt ) { CreateMapEditor(); - } else if ( "Texture Group Editor" == txt ) { + } else if ( "Texture Atlas Editor" == txt ) { CreateETGEditor(); } else if ( "Multi Viewport" == txt ) { MultiViewportMode = !MultiViewportMode; @@ -902,7 +902,7 @@ void cEETest::LoadTextures() { if ( cImage::GetInfo( MyPath + "data/extra/bnb.png", &x, &y, &c ) ) { - mTGL = eeNew( cTextureAtlasLoader, ( MyPath + "data/extra/bnb.etg" ) ); + mTGL = eeNew( cTextureAtlasLoader, ( MyPath + "data/extra/bnb" + EE_TEXTURE_ATLAS_EXTENSION ) ); } mBlindy.AddFramesByPattern( "rn" );