Fixed all texture atlas references names.

Changed texture atlas binary file extension to "eta" and magic code to EETA ( Entropia Engine Texture Atlas ).
Removed EE::Utils, moved classes to EE::Math and EE::System. Still deciding this, but i need to commit, because of the number of changes, i don't want to lose anything.
And many many changes more.
This commit is contained in:
spartanj@gmail.com
2012-11-30 22:54:42 -03:00
parent 8e1988a392
commit 604b926a7f
65 changed files with 821 additions and 878 deletions

View File

@@ -10,8 +10,8 @@
#include <eepp/system/filesystem.hpp>
using namespace EE::System;
#include <eepp/utils/vector3.hpp>
using namespace EE::Utils;
#include <eepp/math/vector3.hpp>
using namespace EE::Math;
/**
This module is based on the sfml-audio module.

View File

@@ -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

View File

@@ -750,7 +750,6 @@ typedef Utf<32> Utf32;
////////////////////////////////////////////////////////////
/// \class EE::Utf
/// \ingroup system
///
/// Utility class providing generic functions for UTF conversions.
///

View File

@@ -31,14 +31,10 @@
#include "base.hpp"
using namespace EE;
// Utils
#include <eepp/utils.hpp>
using namespace EE::Utils;
using namespace EE::Utils::easing;
// Math
#include <eepp/math.hpp>
using namespace EE::Math;
using namespace EE::Math::easing;
// System
#include <eepp/system.hpp>

View File

@@ -3,14 +3,13 @@
#include <eepp/base.hpp>
#include <eepp/utils/utils.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/colors.hpp>
#include <eepp/utils/rect.hpp>
using namespace EE::Utils;
#include <eepp/math/vector2.hpp>
#include <eepp/math/rect.hpp>
#include <eepp/math/math.hpp>
using namespace EE::Math;
#include <eepp/system/utils.hpp>
#include <eepp/system/colors.hpp>
#include <eepp/system/ciostream.hpp>
#include <eepp/system/ciostreamfile.hpp>
#include <eepp/system/ciostreammemory.hpp>

View File

@@ -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();

View File

@@ -237,15 +237,15 @@
#define EE_QUAD_VERTEX 4
#endif
#include <eepp/utils/colors.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/utils.hpp>
#include <eepp/utils/polygon2.hpp>
using namespace EE::Utils;
#include <eepp/math/rect.hpp>
#include <eepp/math/vector2.hpp>
#include <eepp/math/polygon2.hpp>
#include <eepp/math/math.hpp>
using namespace EE::Math;
#include <eepp/system/colors.hpp>
#include <eepp/system/utils.hpp>
#include <eepp/system/ctimeelapsed.hpp>
#include <eepp/system/tsingleton.hpp>
#include <eepp/system/clog.hpp>

View File

@@ -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)

View File

@@ -3,9 +3,7 @@
#include <eepp/base.hpp>
#include <eepp/utils/colors.hpp>
using namespace EE::Utils;
#include <eepp/system/colors.hpp>
#include <eepp/system/clog.hpp>
#include <eepp/system/cpack.hpp>
#include <eepp/system/cpackmanager.hpp>

View File

@@ -2,8 +2,8 @@
#define EE_GRAPHICSCSHADERPROGRAM_H
#include <eepp/graphics/base.hpp>
#include <eepp/utils/vector3.hpp>
#include <eepp/graphics/cshader.hpp>
#include <eepp/math/vector3.hpp>
namespace EE { namespace Graphics {

View File

@@ -1,5 +1,5 @@
#ifndef EE_GRAPHICSCTEXTUREGROUPLOADER_HPP
#define EE_GRAPHICSCTEXTUREGROUPLOADER_HPP
#ifndef EE_GRAPHICSCTEXTUREATLASLOADER_HPP
#define EE_GRAPHICSCTEXTUREATLASLOADER_HPP
#include <eepp/graphics/base.hpp>
#include <eepp/graphics/packerhelper.hpp>
@@ -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<cTexture*> mTexuresLoaded;
typedef struct sTempTexGroupS {
typedef struct sTempTexAtlasS {
sTextureHdr Texture;
std::vector<sSubTextureHdr> SubTextures;
} sTempTexGroup;
} sTempTexAtlas;
sTextureGroupHdr mTexGrHdr;
std::vector<sTempTexGroup> mTempGroups;
sTextureAtlasHdr mTexGrHdr;
std::vector<sTempTexAtlas> mTempAtlass;
void CreateSubTextures();
};

View File

@@ -22,7 +22,7 @@ class EE_API cTextureAtlasManager : public tResourceManager<cTextureAtlas> {
/** 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<cSubTexture*> GetSubTexturesByPattern( const std::string& name, const std::string& extension = "", cTextureAtlas * SearchInTextureAtlas = NULL );

View File

@@ -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"
}}}

View File

@@ -1,7 +1,20 @@
#ifndef EEPP_MATH_HPP
#define EEPP_MATH_HPP
#include <eepp/math/vector2.hpp>
#include <eepp/math/vector3.hpp>
#include <eepp/math/size.hpp>
#include <eepp/math/line2.hpp>
#include <eepp/math/triangle2.hpp>
#include <eepp/math/quad2.hpp>
#include <eepp/math/polygon2.hpp>
#include <eepp/math/rect.hpp>
#include <eepp/math/cwaypoints.hpp>
#include <eepp/math/cinterpolation.hpp>
#include <eepp/math/cperlinnoise.hpp>
#include <eepp/math/easing.hpp>
#include <eepp/math/math.hpp>
#include <eepp/math/cmtrand.hpp>
#include <eepp/math/easing.hpp>
#endif

View File

@@ -2,16 +2,6 @@
#define EE_MATH_BASE
#include <eepp/base.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/utils/polygon2.hpp>
#include <eepp/utils/colors.hpp>
#include <eepp/utils/utils.hpp>
#include <eepp/utils/size.hpp>
#include <eepp/utils/line2.hpp>
#include <eepp/utils/triangle2.hpp>
#include <eepp/utils/quad2.hpp>
using namespace EE::Utils;
#include <eepp/math/helper.hpp>
#endif

View File

@@ -1,10 +1,10 @@
#ifndef EE_UTILSCINTERPOLATION_H
#define EE_UTILSCINTERPOLATION_H
#ifndef EE_MATHCINTERPOLATION_H
#define EE_MATHCINTERPOLATION_H
#include <eepp/utils/base.hpp>
#include <eepp/math/base.hpp>
#include <vector>
namespace EE { namespace Utils {
namespace EE { namespace Math {
/** @brief The basic 1d point template. */
template <typename T>

View File

@@ -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 <eepp/math/base.hpp>

View File

@@ -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 <eepp/utils/base.hpp>
#include <eepp/declares.hpp>
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;
};
}}

View File

@@ -1,11 +1,11 @@
#ifndef EE_UTILSCWAYPOINTS_H
#define EE_UTILSCWAYPOINTS_H
#ifndef EE_MATHCWAYPOINTS_H
#define EE_MATHCWAYPOINTS_H
#include <eepp/utils/base.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/math/base.hpp>
#include <eepp/math/vector2.hpp>
#include <vector>
namespace EE { namespace Utils {
namespace EE { namespace Math {
/** @brief The basic waypoint class. */
template <typename T>

View File

@@ -0,0 +1,389 @@
#ifndef EE_MATH_EASINGEASING_H
#define EE_MATH_EASINGEASING_H
#include <eepp/declares.hpp>
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 <code>QuadraticIn()</code> method starts motion from a zero velocity
* and then accelerates motion as it executes.
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
inline eeFloat QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) {
t /= d;
return c * t * t + b;
}
/**
* The <code>QuadraticOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
inline eeFloat QuadraticOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) {
t /= d;
return -c * t * ( t - 2 ) + b;
}
/**
* The <code>QuadraticInOut()</code> method combines the motion
* of the <code>QuadraticIn()</code> and <code>QuadraticOut()</code> methods
* to start the motion from a zero velocity,
* accelerate motion, then decelerate to a zero velocity.
*
* @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 <code>SineIn()</code> method starts motion from zero velocity
* and then accelerates motion as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
inline eeFloat SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) {
return -c * eecos( t / d * ( EE_PI / 2 ) ) + c + b;
}
/**
* The <code>easeOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
inline eeFloat SineOut( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) {
return c * eesin( t / d * ( EE_PI / 2 ) ) + b;
}
/**
* The <code>easeInOut()</code> method combines the motion
* of the <code>easeIn()</code> and <code>easeOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @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 <code>ExponentialIn()</code> method starts motion slowly
* and then accelerates motion as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial position of a component.
* @param c Specifies the total change in position of the component.
* @param d Specifies the duration of the effect, in milliseconds.
* @return Number corresponding to the position of the component.
*/
inline eeFloat ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d ) {
return t == 0 ? b : c * eepow( 2, 10 * ( t / d - 1 ) ) + b;
}
/**
* The <code>ExponentialOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
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 <code>ExponentialInOut()</code> method combines the motion
* of the <code>ExponentialIn()</code> and <code>ExponentialOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @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

View File

@@ -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 {

View File

@@ -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 <eepp/math/vector2.hpp>
namespace EE { namespace Math {
template <typename T>
class Line2 {
@@ -36,4 +38,4 @@ typedef Line2<eeFloat> eeLine2f;
}}
#endif
#endif

View File

@@ -1,8 +1,13 @@
#ifndef EECMATH_H
#define EECMATH_H
#ifndef EE_MATH_HPP
#define EE_MATH_HPP
#include <eepp/math/base.hpp>
#include <cmath>
#include <eepp/math/base.hpp>
#include <eepp/math/line2.hpp>
#include <eepp/math/vector2.hpp>
#include <eepp/math/triangle2.hpp>
#include <eepp/math/quad2.hpp>
#include <eepp/math/polygon2.hpp>
namespace EE { namespace Math {

View File

@@ -1,12 +1,12 @@
#ifndef EE_UTILSPOLIGON2_H
#define EE_UTILSPOLIGON2_H
#ifndef EE_MATHPOLIGON2_H
#define EE_MATHPOLIGON2_H
#include <eepp/utils/triangle2.hpp>
#include <eepp/utils/quad2.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/math/triangle2.hpp>
#include <eepp/math/quad2.hpp>
#include <eepp/math/rect.hpp>
#include <vector>
namespace EE { namespace Utils {
namespace EE { namespace Math {
template <typename T>
class Polygon2 {

View File

@@ -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 <eepp/math/vector2.hpp>
namespace EE { namespace Math {
template <typename T>
class Quad2 {

View File

@@ -1,10 +1,10 @@
#ifndef EE_UTILSCRECT_H
#define EE_UTILSCRECT_H
#ifndef EE_MATHCRECT_H
#define EE_MATHCRECT_H
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/size.hpp>
#include <eepp/math/vector2.hpp>
#include <eepp/math/size.hpp>
namespace EE { namespace Utils {
namespace EE { namespace Math {
template <typename T>
class tRECT {

View File

@@ -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 <eepp/math/vector2.hpp>
namespace EE { namespace Math {
template<typename T>
class tSize : public Vector2<T>

View File

@@ -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 <eepp/math/vector2.hpp>
namespace EE { namespace Math {
template <typename T>
class Triangle2 {

View File

@@ -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 <eepp/declares.hpp>
namespace EE { namespace Math {
template <typename T>
class Vector2 {

View File

@@ -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 <eepp/declares.hpp>
namespace EE { namespace Math {
template <typename T>
class Vector3 {

View File

@@ -5,12 +5,13 @@
#include <eepp/helper/chipmunk/chipmunk_private.h>
//! EE includes needed for the wrapper, all templates, so it will be easy to port this.
#include <eepp/base.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/utils/colors.hpp>
using namespace EE::Utils;
#include <eepp/math/vector2.hpp>
#include <eepp/math/rect.hpp>
using namespace EE::Math;
#include <eepp/base.hpp>
#include <eepp/system/colors.hpp>
#include <eepp/system/tsingleton.hpp>
using namespace EE::System;

View File

@@ -1,11 +1,9 @@
#ifndef EE_UTILS_BASE
#define EE_UTILS_BASE
#ifndef EE_SYSTEM_BASE
#define EE_SYSTEM_BASE
#include <eepp/base.hpp>
#include <eepp/utils/utils.hpp>
#include <eepp/utils/vector2.hpp>
using namespace EE::Utils;
#include <eepp/math/vector2.hpp>
using namespace EE::Math;
#endif

View File

@@ -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 <eepp/declares.hpp>
namespace EE { namespace System {
template <typename T>
class tColor {

View File

@@ -3,6 +3,7 @@
#include <eepp/system/base.hpp>
#include <eepp/system/cmutex.hpp>
#include <eepp/system/safedatapointer.hpp>
namespace EE { namespace System {

View File

@@ -2,6 +2,7 @@
#define EE_SYSTEM_FILESYSTEM_HPP
#include <eepp/system/base.hpp>
#include <eepp/system/safedatapointer.hpp>
namespace EE { namespace System {

View File

@@ -1,9 +1,9 @@
#ifndef EE_UTILS_SAFEDATAPOINTER
#define EE_UTILS_SAFEDATAPOINTER
#ifndef EE_SYSTEM_SAFEDATAPOINTER
#define EE_SYSTEM_SAFEDATAPOINTER
#include <eepp/utils/base.hpp>
#include <eepp/declares.hpp>
namespace EE { namespace Utils {
namespace EE { namespace System {
class EE_API SafeDataPointer {
public:

View File

@@ -2,6 +2,7 @@
#define EE_SYSTEMTRESOURCEMANAGER_HPP
#include <eepp/system/base.hpp>
#include <eepp/system/utils.hpp>
#include <list>
namespace EE { namespace System {
@@ -207,4 +208,3 @@ Uint32 tResourceManager<T>::Count( const std::string& Name ) {
}}
#endif

35
include/eepp/system/utils.hpp Executable file
View File

@@ -0,0 +1,35 @@
#ifndef EE_SYSTEMCUTILS_H
#define EE_SYSTEMCUTILS_H
#include <eepp/declares.hpp>
#include <string>
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

View File

@@ -3,17 +3,16 @@
#include <eepp/base.hpp>
#include <eepp/utils/helper.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/utils/utils.hpp>
#include <eepp/utils/colors.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/cinterpolation.hpp>
#include <eepp/utils/cwaypoints.hpp>
using namespace EE::Utils;
#include <eepp/math/helper.hpp>
#include <eepp/math/rect.hpp>
#include <eepp/math/vector2.hpp>
#include <eepp/math/cinterpolation.hpp>
#include <eepp/math/cwaypoints.hpp>
#include <eepp/math/math.hpp>
using namespace EE::Math;
#include <eepp/system/utils.hpp>
#include <eepp/system/colors.hpp>
#include <eepp/system/tsingleton.hpp>
#include <eepp/system/sys.hpp>
using namespace EE::System;

View File

@@ -151,7 +151,7 @@ class EE_API cUITheme : public tResourceManager<cUISkin> {
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 );
};
}}

View File

@@ -1,5 +1,5 @@
#ifndef EE_UITOOLSCTEXTUREGROUPEDITOR_HPP
#define EE_UITOOLSCTEXTUREGROUPEDITOR_HPP
#ifndef EE_UITOOLSCTEXTUREATLASEDITOR_HPP
#define EE_UITOOLSCTEXTUREATLASEDITOR_HPP
#include <eepp/ui/base.hpp>
#include <eepp/ui/tools/ctextureatlassubtextureeditor.hpp>
@@ -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();
};

View File

@@ -1,5 +1,5 @@
#ifndef EE_UITOOLSCTEXTUREGROUPNEW_HPP
#define EE_UITOOLSCTEXTUREGROUPNEW_HPP
#ifndef EE_UITOOLSCTEXTUREATLASNEW_HPP
#define EE_UITOOLSCTEXTUREATLASNEW_HPP
#include <eepp/ui/base.hpp>
#include <eepp/ui/cuiwindow.hpp>
@@ -40,7 +40,7 @@ class EE_API cTextureAtlasNew {
void OnSelectFolder( const cUIEvent * Event );
void TextureGroupSave( const cUIEvent * Event );
void TextureAtlasSave( const cUIEvent * Event );
};
}}}

View File

@@ -1,19 +0,0 @@
#ifndef EEPP_UTILS_HPP
#define EEPP_UTILS_HPP
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/vector3.hpp>
#include <eepp/utils/size.hpp>
#include <eepp/utils/line2.hpp>
#include <eepp/utils/triangle2.hpp>
#include <eepp/utils/quad2.hpp>
#include <eepp/utils/colors.hpp>
#include <eepp/utils/polygon2.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/utils/cwaypoints.hpp>
#include <eepp/utils/cinterpolation.hpp>
#include <eepp/utils/cperlinnoise.hpp>
#include <eepp/utils/utils.hpp>
#include <eepp/utils/easing.hpp>
#endif

View File

@@ -1,7 +0,0 @@
#ifndef EE_UTILS_BASE
#define EE_UTILS_BASE
#include <eepp/base.hpp>
#include <eepp/utils/helper.hpp>
#endif

View File

@@ -1,180 +0,0 @@
#ifndef EE_UTILS_EASINGEASING_H
#define EE_UTILS_EASINGEASING_H
#include <eepp/utils/base.hpp>
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 <code>QuadraticIn()</code> method starts motion from a zero velocity
* and then accelerates motion as it executes.
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API QuadraticIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>QuadraticOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @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 <code>QuadraticInOut()</code> method combines the motion
* of the <code>QuadraticIn()</code> and <code>QuadraticOut()</code> methods
* to start the motion from a zero velocity,
* accelerate motion, then decelerate to a zero velocity.
*
* @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 <code>SineIn()</code> method starts motion from zero velocity
* and then accelerates motion as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial value of the animation property.
* @param c Specifies the total change in the animation property.
* @param d Specifies the duration of the motion.
* @return The value of the interpolated property at the specified time.
*/
eeFloat EE_API SineIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>easeOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @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 <code>easeInOut()</code> method combines the motion
* of the <code>easeIn()</code> and <code>easeOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @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 <code>ExponentialIn()</code> method starts motion slowly
* and then accelerates motion as it executes.
*
* @param t Specifies the current time, between 0 and duration inclusive.
* @param b Specifies the initial position of a component.
* @param c Specifies the total change in position of the component.
* @param d Specifies the duration of the effect, in milliseconds.
* @return Number corresponding to the position of the component.
*/
eeFloat EE_API ExponentialIn( eeFloat t, eeFloat b, eeFloat c, eeFloat d );
/**
* The <code>ExponentialOut()</code> method starts motion fast
* and then decelerates motion to a zero velocity as it executes.
*
* @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 <code>ExponentialInOut()</code> method combines the motion
* of the <code>ExponentialIn()</code> and <code>ExponentialOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @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

View File

@@ -1,36 +0,0 @@
#ifndef EE_UTILSCUTILS_H
#define EE_UTILSCUTILS_H
#include <eepp/utils/base.hpp>
#include <eepp/utils/safedatapointer.hpp>
#include <vector>
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

View File

@@ -3,12 +3,12 @@
#include <eepp/base.hpp>
#include <eepp/utils/colors.hpp>
#include <eepp/utils/rect.hpp>
#include <eepp/utils/vector2.hpp>
#include <eepp/utils/utils.hpp>
using namespace EE::Utils;
#include <eepp/math/rect.hpp>
#include <eepp/math/vector2.hpp>
using namespace EE::Math;
#include <eepp/system/colors.hpp>
#include <eepp/system/utils.hpp>
#include <eepp/system/ctimeelapsed.hpp>
#include <eepp/system/tsingleton.hpp>
#include <eepp/system/clog.hpp>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.6.0, 2012-11-30T01:36:05. -->
<!-- Written by Qt Creator 2.6.0, 2012-11-30T22:40:48. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@@ -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

View File

@@ -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] ) );

View File

@@ -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<cUIMenuItem*> ( 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<cUICommonDialog*> ( Event->Ctrl() );
std::string sgname = FileSystem::FileRemoveExtension( FileSystem::FileNameFromPath( CDL->GetFullPath() ) );

View File

@@ -1,5 +1,5 @@
#include <eepp/graphics/cprimitives.hpp>
#include <eepp/utils/polygon2.hpp>
#include <eepp/math/polygon2.hpp>
namespace EE { namespace Graphics {

View File

@@ -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<char*> (&mTexGrHdr), sizeof(sTextureGroupHdr) );
fs.Write( reinterpret_cast<char*> (&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<char*> ( tTexHdr ), sizeof(sTextureHdr) );
fs.Write( reinterpret_cast<char*> ( &tTexGroup->SubTextures[0] ), sizeof(sSubTextureHdr) * (std::streamsize)tTexGroup->SubTextures.size() );
fs.Write( reinterpret_cast<char*> ( &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<std::string> 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<const char*> (&mTexGrHdr), sizeof(sTextureGroupHdr) );
fs.Write( reinterpret_cast<const char*> (&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<const char*> (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<const char*> (&tTexGroup->SubTextures[0]), sizeof(sSubTextureHdr) * tTexHdr->SubTextureCount );
fs.Write( reinterpret_cast<const char*> (&tTexAtlas->SubTextures[0]), sizeof(sSubTextureHdr) * tTexHdr->SubTextureCount );
Img.SaveToFile( tapath, (EE_SAVE_TYPE)mTexGrHdr.Format );

View File

@@ -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<sTextureHdr> TexHdr( TexGrHdr.TextureCount );
@@ -592,11 +592,11 @@ void cTexturePacker::SaveSubTextures() {
std::vector<sSubTextureHdr> 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<const char*> (&TexGrHdr), sizeof(sTextureGroupHdr) );
fs.Write( reinterpret_cast<const char*> (&TexGrHdr), sizeof(sTextureAtlasHdr) );
fs.Write( reinterpret_cast<const char*> (&TexHdr[ 0 ]), sizeof(sTextureHdr) );

View File

@@ -1,8 +1,8 @@
#include <eepp/utils/cinterpolation.hpp>
#include <eepp/utils/easing.hpp>
using namespace EE::Utils::easing;
#include <eepp/math/cinterpolation.hpp>
#include <eepp/math/easing.hpp>
using namespace EE::Math::easing;
namespace EE { namespace Utils {
namespace EE { namespace Math {
cInterpolation::cInterpolation() :
mType(LINEAR),

View File

@@ -1,6 +1,6 @@
#include <eepp/utils/cperlinnoise.hpp>
#include <eepp/math/cperlinnoise.hpp>
namespace EE { namespace Utils {
namespace EE { namespace Math {
cPerlinNoise::cPerlinNoise() {
Init();

View File

@@ -1,8 +1,8 @@
#include <eepp/utils/cwaypoints.hpp>
#include <eepp/utils/easing.hpp>
using namespace EE::Utils::easing;
#include <eepp/math/cwaypoints.hpp>
#include <eepp/math/easing.hpp>
using namespace EE::Math::easing;
namespace EE { namespace Utils {
namespace EE { namespace Math {
cWaypoints::cWaypoints() :
mType(LINEAR),

39
src/eepp/math/easing.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include <eepp/math/easing.hpp>
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
};
}}}

View File

@@ -1,6 +1,8 @@
#include <eepp/utils/safedatapointer.hpp>
#include <eepp/system/safedatapointer.hpp>
#include <eepp/base/memorymanager.hpp>
#include <cstddef>
namespace EE { namespace Utils {
namespace EE { namespace System {
SafeDataPointer::SafeDataPointer() :
Data( NULL ),

View File

@@ -1,6 +1,6 @@
#include <eepp/utils/utils.hpp>
#include <eepp/system/utils.hpp>
namespace EE { namespace Utils {
namespace EE { namespace System {
Uint32 MakeHash( const std::string& str ) {
return MakeHash( reinterpret_cast<const Uint8*>( &str[0] ) );

View File

@@ -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;

View File

@@ -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<cUIMenuItem*> ( 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<cSubTexture*>& Res = mTextureGroupLoader->GetTextureAtlas()->GetResources();
std::list<cSubTexture*>& 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<cUICommonDialog*> ( 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 );

View File

@@ -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<cUICommonDialog*> ( 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();

View File

@@ -1,310 +0,0 @@
#include <eepp/utils/easing.hpp>
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;
}
}}}

View File

@@ -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" );