Removed eeRGB and eeRGBA from the projects, and removed the parameter ColorKey in favor to the use of CreateMaskFromColor or setting the color key manually in the cTextureLoader.

Now the user can add new theme elements to search on the theme loading ( to be able to expand the themes without touching the source code of the library ).
This commit is contained in:
spartanj
2010-12-19 05:02:39 -03:00
parent ba14875bec
commit f7ffec103f
25 changed files with 193 additions and 268 deletions
+17 -3
View File
@@ -55,7 +55,7 @@ LIBSIV = -lX11 -lXcursor
OTHERINC = -I/usr/include/freetype2
else
ifeq ($(OS), darwin)
LIBS = -lfreetype -lSDL -lSDLmain -lsndfile -framework OpenGL -framework GLUT -framework OpenAL -framework Cocoa -framework CoreFoundation
LIBS = -lfreetype -lSDL -lSDLmain -lsndfile -framework OpenGL -framework GLUT -framework OpenAL -framework Cocoa -framework CoreFoundation -framework AGL
LIBSIV =
OTHERINC = -I/usr/include/freetype2
endif
@@ -63,6 +63,7 @@ endif
EXE = eetest-$(RELEASETYPE)
EXEIV = eeiv-$(RELEASETYPE)
EXEFLUID = eefluid-$(RELEASETYPE)
SRCGLEW = $(wildcard ./src/helper/glew/*.c)
SRCSOIL = $(wildcard ./src/helper/SOIL/*.c)
@@ -83,6 +84,7 @@ SRCWINDOW = $(wildcard ./src/window/*.cpp)
SRCTEST = $(wildcard ./src/test/*.cpp)
SRCEEIV = $(wildcard ./src/eeiv/*.cpp)
SRCFLUID = $(wildcard ./src/fluid/*.cpp)
SRCHELPERS = $(SRCGLEW) $(SRCSOIL) $(SRCSTBVORBIS) $(SRCZLIB) $(SRCLIBZIP)
SRCMODULES = $(SRCHAIKUTTF) $(SRCBASE) $(SRCAUDIO) $(SRCGAMING) $(SRCGRAPHICS) $(SRCMATH) $(SRCSYSTEM) $(SRCUI) $(SRCUTILS) $(SRCWINDOW)
@@ -112,6 +114,7 @@ OBJMODULES = $(OBJHAIKUTTF) $(OBJBASE) $(OBJUTILS) $(OBJMATH) $(OBJSYSTEM) $(O
OBJTEST = $(SRCTEST:.cpp=.o)
OBJEEIV = $(SRCEEIV:.cpp=.o)
OBJFLUID = $(SRCFLUID:.cpp=.o)
OBJDIR = obj/$(OS)/$(RELEASETYPE)/
@@ -120,8 +123,9 @@ FOBJMODULES = $(patsubst ./%, $(OBJDIR)%, $(OBJHAIKUTTF) $(OBJBASE) $(OBJUTILS
FOBJTEST = $(patsubst ./%, $(OBJDIR)%, $(SRCTEST:.cpp=.o) )
FOBJEEIV = $(patsubst ./%, $(OBJDIR)%, $(SRCEEIV:.cpp=.o) )
FOBJFLUID = $(patsubst ./%, $(OBJDIR)%, $(SRCFLUID:.cpp=.o) )
FOBJEEPP = $(FOBJMODULES) $(FOBJTEST) $(FOBJEEIV)
FOBJEEPP = $(FOBJMODULES) $(FOBJTEST) $(FOBJEEIV) $(FOBJFLUID)
FOBJALL = $(FOBJHELPERS) $(FOBJEEPP)
DEPSEEPP = $(FOBJEEPP:.o=.d)
@@ -148,6 +152,7 @@ dirs:
@mkdir -p $(OBJDIR)/src/window
@mkdir -p $(OBJDIR)/src/test
@mkdir -p $(OBJDIR)/src/eeiv
@mkdir -p $(OBJDIR)/src/fluid
lib: dirs $(LIB)
@@ -157,7 +162,7 @@ $(FOBJMODULES):
$(FOBJHELPERS):
$(CC) -o $@ -c $(patsubst $(OBJDIR)%.o,%.c,$@) $(CFLAGSEXT) -DSTBI_FAILURE_USERMSG
@$(CC) -MT $@ -MM $(patsubst $(OBJDIR)%.o,%.c,$@) -DSTBI_FAILURE_USERMSG > $(patsubst %.o,%.d,$@)
@$(CC) -MT $@ -MM $(patsubst $(OBJDIR)%.o,%.c,$@) -DSTBI_FAILURE_USERMSG > $(patsubst %.o,%.d,$@)
$(FOBJTEST):
$(CPP) -o $@ -c $(patsubst $(OBJDIR)%.o,%.cpp,$@) $(CFLAGS) $(OTHERINC)
@@ -167,6 +172,13 @@ $(FOBJEEIV):
$(CPP) -o $@ -c $(patsubst $(OBJDIR)%.o,%.cpp,$@) $(CFLAGS) $(OTHERINC)
@$(CPP) -MT $@ -MM $(patsubst $(OBJDIR)%.o,%.cpp,$@) $(OTHERINC) > $(patsubst %.o,%.d,$@)
$(FOBJFLUID):
$(CPP) -o $@ -c $(patsubst $(OBJDIR)%.o,%.cpp,$@) $(CFLAGS) $(OTHERINC)
@$(CPP) -MT $@ -MM $(patsubst $(OBJDIR)%.o,%.cpp,$@) $(OTHERINC) > $(patsubst %.o,%.d,$@)
$(EXEFLUID): $(FOBJHELPERS) $(FOBJMODULES) $(FOBJFLUID)
$(CPP) -o ./$(EXEFLUID) $(FOBJHELPERS) $(FOBJMODULES) $(FOBJFLUID) $(LDFLAGS) $(LIBS)
$(EXEIV): $(FOBJHELPERS) $(FOBJMODULES) $(FOBJEEIV)
$(CPP) -o ./$(EXEIV) $(FOBJHELPERS) $(FOBJMODULES) $(FOBJEEIV) $(LDFLAGS) $(LIBS) $(LIBSIV)
@@ -186,6 +198,8 @@ test: dirs $(EXE)
eeiv: dirs $(EXEIV)
fluid: dirs $(EXEFLUID)
docs:
doxygen ./Doxyfile
+10 -14
View File
@@ -24,23 +24,11 @@ cConsole::~cConsole() {
cInput::instance()->PopCallback( mMyCallback );
}
void cConsole::Create( cFont* Font, const bool& MakeDefaultCommands, const eeUint& MaxLogLines, const Uint32& TextureId, const eeRGBA& ConsoleColor, const eeRGBA& ConsoleLineColor, const eeRGBA& FontColor, const eeRGBA& FontLineColor ) {
void cConsole::Create( cFont* Font, const bool& MakeDefaultCommands, const eeUint& MaxLogLines, const Uint32& TextureId ) {
mFont = Font;
mFontSize = (eeFloat)mFont->GetFontSize();
if ( !FontColor.voidRGB )
mFontColor = FontColor;
if ( !FontLineColor.voidRGB )
mFontLineColor = FontLineColor;
if ( !ConsoleColor.voidRGB )
mConColor = ConsoleColor;
if ( !ConsoleLineColor.voidRGB )
mConLineColor = ConsoleLineColor;
if ( TextureId > 0 )
mTexId = TextureId;
@@ -88,7 +76,7 @@ void cConsole::Draw() {
mPri.SetColor( eeColorA( mConColor.R(), mConColor.G(), mConColor.B(), static_cast<Uint8>(mA) ) );
mPri.DrawRectangle( 0.0f, 0.0f, mWidth, mY );
} else {
eeRGBA C( mConColor.R(), mConColor.G(), mConColor.B(), static_cast<Uint8>(mA) );
eeColorA C( mConColor.R(), mConColor.G(), mConColor.B(), static_cast<Uint8>(mA) );
cTexture * Tex = cTextureFactory::instance()->GetTexture( mTexId );
@@ -669,4 +657,12 @@ void cConsole::IgnoreCharOnPrompt( const Uint32& ch ) {
mTBuf.PushIgnoredChar( ch );
}
const bool& cConsole::IsShowingFps() const {
return mShowFps;
}
void cConsole::ShowFps( const bool& Show ) {
mShowFps = Show;
}
}}
+16 -10
View File
@@ -32,28 +32,28 @@ class EE_API cConsole{
Uint32 TextureId() const { return mTexId; }
/** Set the Console Background Color */
void BackgroundColor( const eeRGBA& BackColor ) { mConColor = BackColor; }
void BackgroundColor( const eeColorA& BackColor ) { mConColor = BackColor; }
/** Get the Console Background Color */
eeRGBA BackgroundColor() const { return mConColor; }
const eeColorA& BackgroundColor() const { return mConColor; }
/** Set the Console Border Line Background Color */
void BackgroundLineColor( const eeRGBA& BackColor ) { mConLineColor = BackColor; }
void BackgroundLineColor( const eeColorA& BackColor ) { mConLineColor = BackColor; }
/** Get the Console Border Line Background Color */
eeRGBA BackgroundLineColor() const { return mConLineColor; }
const eeColorA& BackgroundLineColor() const { return mConLineColor; }
/** Set the Console Font Color */
void FontColor( const eeRGBA& FntColor ) { mFontColor = FntColor; }
void FontColor( const eeColorA& FntColor ) { mFontColor = FntColor; }
/** Get the Console Font Color */
eeRGBA FontColor() const { return mFontColor; }
const eeColorA& FontColor() const { return mFontColor; }
/** Set the Console Client Input ( Writeable Line ) Font Color */
void FontLineColor( const eeRGBA& FntColor ) { mFontLineColor = FntColor; }
void FontLineColor( const eeColorA& FntColor ) { mFontLineColor = FntColor; }
/** Get the Console Client Input ( Writeable Line ) Font Color */
eeRGBA FontLineColor() const { return mFontLineColor; }
const eeColorA& FontLineColor() const { return mFontLineColor; }
/** Toogle the console between visible and hided with Fade In or Fade Out effect. */
void Toggle();
@@ -89,7 +89,7 @@ class EE_API cConsole{
* @param FontColor The Console Font Color
* @param FontLineColor The Console Line Font Color ( The Client Input )
*/
void Create( cFont* Font, const bool& MakeDefaultCommands = true, const eeUint& MaxLogLines = 1024, const Uint32& TextureId = 0, const eeRGBA& ConsoleColor = eeRGBA(true), const eeRGBA& ConsoleLineColor = eeRGBA(true), const eeRGBA& FontColor = eeRGBA(true), const eeRGBA& FontLineColor = eeRGBA(true) );
void Create( cFont* Font, const bool& MakeDefaultCommands = true, const eeUint& MaxLogLines = 1024, const Uint32& TextureId = 0 );
/** Add Text to Console */
void PushText( const std::wstring& str );
@@ -120,6 +120,12 @@ class EE_API cConsole{
/** Use this if you need to ignore some char to activate the console, for example '~'. A common char to activate a console. */
void IgnoreCharOnPrompt( const Uint32& ch );
/** @return If the console is rendering the FPS count. */
const bool& IsShowingFps() const;
/** Activate/Deactive fps rendering */
void ShowFps( const bool& Show );
protected:
std::map < std::wstring, ConsoleCallback > mCallbacks;
std::deque < std::wstring > mCmdLog;
@@ -128,7 +134,7 @@ class EE_API cConsole{
eeInt mLastLogPos;
bool mEnabled, mVisible, mFadeIn, mFadeOut, mExpand, mFading, mShowFps;
eeRGBA mConColor, mConLineColor, mFontColor, mFontLineColor;
eeColorA mConColor, mConLineColor, mFontColor, mFontLineColor;
eeFloat mWidth, mHeight, mHeightMin, mCurHeight, mY, mA, mMaxAlpha, mTempY, mFontSize, mFadeSpeed;
Uint32 mMyCallback, mEx, mMaxLogLines;
+4 -2
View File
@@ -25,8 +25,10 @@ cFont::~cFont() {
void cFont::SetText( const std::wstring& Text ) {
if ( mText.size() != Text.size() ) {
mRenderCoords.resize( Text.size() * EE_QUAD_VERTEX );
mColors.resize( Text.size() * EE_QUAD_VERTEX, mColor );
Int32 size = Text.size() * EE_QUAD_VERTEX;
mRenderCoords.resize( size );
mColors.resize( size, mColor );
}
mText = Text;
+2 -2
View File
@@ -11,7 +11,7 @@ cScrollParallax::cScrollParallax() :
cScrollParallax::~cScrollParallax() {}
cScrollParallax::cScrollParallax( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeRGBA& Color, const EE_PRE_BLEND_FUNC& Blend ) {
cScrollParallax::cScrollParallax( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color, const EE_PRE_BLEND_FUNC& Blend ) {
Create( Shape, DestX, DestY, DestWidth, DestHeight, Speed, Color, Blend );
}
@@ -39,7 +39,7 @@ void cScrollParallax::SetAABB() {
mAABB = eeRectf( mInitPos.x, mInitPos.y, mInitPos.x + mSize.Width(), mInitPos.y + mSize.Height() );
}
bool cScrollParallax::Create( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeRGBA& Color, const EE_PRE_BLEND_FUNC& Blend ) {
bool cScrollParallax::Create( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color, const EE_PRE_BLEND_FUNC& Blend ) {
mShape = Shape;
mPos = eeVector2f( DestX, DestY );
mSize = eeSizef( DestWidth, DestHeight );
+2 -2
View File
@@ -13,7 +13,7 @@ class EE_API cScrollParallax {
~cScrollParallax();
/** Constructor that create's the Scroll Parallax */
cScrollParallax( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeRGBA& Color = eeRGBA(255, 255, 255, 255), const EE_PRE_BLEND_FUNC& Blend = ALPHA_NORMAL );
cScrollParallax( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color = eeColorA(), const EE_PRE_BLEND_FUNC& Blend = ALPHA_NORMAL );
/** Create's the Scroll Parallax
* @param Shape The Shape to Draw
@@ -26,7 +26,7 @@ class EE_API cScrollParallax {
* @param Effect The Blend Mode ( default ALPHA_NORMAL )
* @return True if success
*/
bool Create( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeRGBA& Color = eeRGBA(255, 255, 255, 255), const EE_PRE_BLEND_FUNC& Blend = ALPHA_NORMAL );
bool Create( cShape * Shape, const eeFloat& DestX, const eeFloat& DestY, const eeFloat& DestWidth, const eeFloat& DestHeight, const eeVector2f& Speed, const eeColorA& Color = eeColorA(), const EE_PRE_BLEND_FUNC& Blend = ALPHA_NORMAL );
/** Set the Color */
void Color( const eeColorA& Color ) { mColor = Color; }
+1 -1
View File
@@ -226,7 +226,7 @@ void cSprite::DisableVertexColors() {
eeSAFE_DELETE_ARRAY( mVertexColors );
}
void cSprite::Update( const eeFloat& x, const eeFloat& y, const eeFloat& Scale, const eeFloat& Angle, const Uint8& Alpha, const eeRGBA& Color ) {
void cSprite::Update( const eeFloat& x, const eeFloat& y, const eeFloat& Scale, const eeFloat& Angle, const Uint8& Alpha, const eeColorA& Color ) {
mPos.x = x;
mPos.y = y;
mScale = Scale;
+1 -1
View File
@@ -160,7 +160,7 @@ class EE_API cSprite {
* @param Alpha Set the Color Alpha
* @param Color Set the Color
*/
void Update( const eeFloat& x, const eeFloat& y, const eeFloat& Scale = 1.0f, const eeFloat& Angle = 0.0f, const Uint8& Alpha = 255, const eeRGBA& Color = eeRGBA(255,255,255,255) );
void Update( const eeFloat& x, const eeFloat& y, const eeFloat& Scale = 1.0f, const eeFloat& Angle = 0.0f, const Uint8& Alpha = 255, const eeColorA& Color = eeColorA() );
/** Get the internal texture id from a frame number and a sub frame number
* @param FrameNum The Frame Number
+3 -7
View File
@@ -11,7 +11,6 @@ cTexture::cTexture() :
mImgWidth(0),
mImgHeight(0),
mFlags(0),
mColorKey(eeRGB(true)),
mClampMode( EE_CLAMP_TO_EDGE ),
mFilter( TEX_FILTER_LINEAR )
{
@@ -24,7 +23,6 @@ cTexture::cTexture( const cTexture& Copy ) :
mImgWidth( Copy.mImgWidth ),
mImgHeight( Copy.mImgHeight ),
mFlags( Copy.mFlags ),
mColorKey( Copy.mColorKey ),
mClampMode( Copy.mClampMode ),
mFilter( Copy.mFilter )
{
@@ -53,7 +51,6 @@ cTexture& cTexture::operator =(const cTexture& Other) {
std::swap(mImgWidth, Temp.mImgWidth);
std::swap(mImgHeight, Temp.mImgHeight);
std::swap(mFlags, Temp.mFlags);
std::swap(mColorKey, Temp.mColorKey);
std::swap(mFilter, Temp.mFilter);
std::swap(mClampMode, Temp.mClampMode);
@@ -74,11 +71,11 @@ void cTexture::DeleteTexture() {
}
}
cTexture::cTexture( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize, const Uint8* data ) {
Create( texture, width, height, imgwidth, imgheight, UseMipmap, Channels, filepath, ColorKey, ClampMode, CompressedTexture, MemSize, data );
cTexture::cTexture( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize, const Uint8* data ) {
Create( texture, width, height, imgwidth, imgheight, UseMipmap, Channels, filepath, ClampMode, CompressedTexture, MemSize, data );
}
void cTexture::Create( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize, const Uint8* data ) {
void cTexture::Create( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize, const Uint8* data ) {
mFilepath = filepath;
mId = MakeHash( mFilepath );
mTexture = texture;
@@ -88,7 +85,6 @@ void cTexture::Create( const Uint32& texture, const eeUint& width, const eeUint&
mImgWidth = imgwidth;
mImgHeight = imgheight;
mSize = MemSize;
mColorKey = ColorKey;
mClampMode = ClampMode;
mFilter = TEX_FILTER_LINEAR;
+2 -9
View File
@@ -16,7 +16,7 @@ class EE_API cTexture : public cImage {
public:
cTexture();
cTexture( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize = 0, const Uint8* data = NULL );
cTexture( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize = 0, const Uint8* data = NULL );
cTexture( const cTexture& Copy );
@@ -38,7 +38,7 @@ class EE_API cTexture : public cImage {
* @param CompressedTexture The Texture was compressed on loading
* @param data The Texture (raw texture)
*/
void Create( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize = 0, const Uint8* data = NULL );
void Create( const Uint32& texture, const eeUint& width, const eeUint& height, const eeUint& imgwidth, const eeUint& imgheight, const bool& UseMipmap, const eeUint& Channels, const std::string& filepath, const EE_CLAMP_MODE& ClampMode, const bool& CompressedTexture, const Uint32& MemSize = 0, const Uint8* data = NULL );
/** Set the OpenGL Texture Id (texture handle) */
void Handle( const Uint32& texture ) { mTexture = texture; }
@@ -67,12 +67,6 @@ class EE_API cTexture : public cImage {
/** @return If the texture use Mipmaps */
bool Mipmap() const;
/** Set the Texture Color Key */
void ColorKey( const eeRGB& colorkey ) { mColorKey = colorkey; }
/** @return The Texture Color Key */
eeRGB ColorKey() const { return mColorKey; }
/** Set the Texture Clamp Mode */
void ClampMode( const EE_CLAMP_MODE& clampmode );
@@ -226,7 +220,6 @@ class EE_API cTexture : public cImage {
eeUint mImgHeight;
Uint32 mFlags;
eeRGB mColorKey;
EE_CLAMP_MODE mClampMode;
EE_TEX_FILTER mFilter;
+11 -14
View File
@@ -23,34 +23,34 @@ cTextureFactory::~cTextureFactory() {
Uint32 cTextureFactory::CreateEmptyTexture( const eeUint& Width, const eeUint& Height, const eeColorA& DefaultColor, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
std::vector<eeColorA> tmpTex( Width * Height, DefaultColor );
return LoadFromPixels( reinterpret_cast<unsigned char*> ( &tmpTex[0] ), Width, Height, 4, Mipmap, eeRGB(true), ClampMode, CompressTexture, KeepLocalCopy );
return LoadFromPixels( reinterpret_cast<unsigned char*> ( &tmpTex[0] ), Width, Height, 4, Mipmap, ClampMode, CompressTexture, KeepLocalCopy );
}
Uint32 cTextureFactory::LoadFromPixels( const unsigned char * Pixels, const eeUint& Width, const eeUint& Height, const eeUint& Channels, const bool& Mipmap, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy, const std::string& FileName ) {
cTextureLoader myTex( Pixels, Width, Height, Channels, Mipmap, ColorKey, ClampMode, CompressTexture, KeepLocalCopy, FileName );
Uint32 cTextureFactory::LoadFromPixels( const unsigned char * Pixels, const eeUint& Width, const eeUint& Height, const eeUint& Channels, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy, const std::string& FileName ) {
cTextureLoader myTex( Pixels, Width, Height, Channels, Mipmap, ClampMode, CompressTexture, KeepLocalCopy, FileName );
myTex.Load();
return myTex.Id();
}
Uint32 cTextureFactory::LoadFromPack( cPack* Pack, const std::string& FilePackPath, const bool& Mipmap, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
cTextureLoader myTex( Pack, FilePackPath, Mipmap, ColorKey, ClampMode, CompressTexture, KeepLocalCopy );
Uint32 cTextureFactory::LoadFromPack( cPack* Pack, const std::string& FilePackPath, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
cTextureLoader myTex( Pack, FilePackPath, Mipmap, ClampMode, CompressTexture, KeepLocalCopy );
myTex.Load();
return myTex.Id();
}
Uint32 cTextureFactory::LoadFromMemory( const unsigned char * ImagePtr, const eeUint& Size, const bool& Mipmap, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
cTextureLoader myTex( ImagePtr, Size, Mipmap, ColorKey, ClampMode, CompressTexture, KeepLocalCopy );
Uint32 cTextureFactory::LoadFromMemory( const unsigned char * ImagePtr, const eeUint& Size, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
cTextureLoader myTex( ImagePtr, Size, Mipmap, ClampMode, CompressTexture, KeepLocalCopy );
myTex.Load();
return myTex.Id();
}
Uint32 cTextureFactory::Load( const std::string& Filepath, const bool& Mipmap, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
cTextureLoader myTex( Filepath, Mipmap, ColorKey, ClampMode, CompressTexture, KeepLocalCopy );
Uint32 cTextureFactory::Load( const std::string& Filepath, const bool& Mipmap, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& KeepLocalCopy ) {
cTextureLoader myTex( Filepath, Mipmap, ClampMode, CompressTexture, KeepLocalCopy );
myTex.Load();
return myTex.Id();
}
Uint32 cTextureFactory::PushTexture( const std::string& Filepath, const Uint32& TexId, const eeUint& Width, const eeUint& Height, const eeUint& ImgWidth, const eeUint& ImgHeight, const bool& Mipmap, const eeUint& Channels, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& LocalCopy, const Uint32& MemSize ) {
Uint32 cTextureFactory::PushTexture( const std::string& Filepath, const Uint32& TexId, const eeUint& Width, const eeUint& Height, const eeUint& ImgWidth, const eeUint& ImgHeight, const bool& Mipmap, const eeUint& Channels, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& LocalCopy, const Uint32& MemSize ) {
Lock();
cTexture * Tex = NULL;
@@ -68,12 +68,9 @@ Uint32 cTextureFactory::PushTexture( const std::string& Filepath, const Uint32&
Pos = FindFreeSlot();
Tex = mTextures[ Pos ] = eeNew( cTexture, () );
Tex->Create( TexId, Width, Height, MyWidth, MyHeight, Mipmap, Channels, FPath, ColorKey, ClampMode, CompressTexture, MemSize );
Tex->Create( TexId, Width, Height, MyWidth, MyHeight, Mipmap, Channels, FPath, ClampMode, CompressTexture, MemSize );
Tex->Id( Pos );
if ( !ColorKey.voidRGB )
Tex->CreateMaskFromColor( eeColor( ColorKey.R(), ColorKey.G(), ColorKey.B() ) , 0 );
if ( LocalCopy ) {
Tex->Lock();
Tex->Unlock( true, false );
+5 -8
View File
@@ -34,14 +34,13 @@ class EE_API cTextureFactory: public tSingleton<cTextureFactory>, protected cMut
* @param Height Texture Height
* @param Channels Texture Number of Channels (in bytes)
* @param Mipmap Create Mipmap?
* @param ColorKey Color key for the texture ( eeRGB(true) for none )
* @param ClampMode Defines the CLAMP MODE
* @param CompressTexture If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 )
* @param KeepLocalCopy Keep the array data copy. ( usefull if want to reload the texture )
* @param FileName A filename to recognize the texture ( the path in case that was loaded from outside the texture factory ).
* @return Internal Texture Id
*/
Uint32 LoadFromPixels( const unsigned char * Pixels, const eeUint& Width, const eeUint& Height, const eeUint& Channels, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") );
Uint32 LoadFromPixels( const unsigned char * Pixels, const eeUint& Width, const eeUint& Height, const eeUint& Channels, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") );
/** Load a texture from Pack
* @param Pack Pointer to the pack instance
@@ -52,30 +51,28 @@ class EE_API cTextureFactory: public tSingleton<cTextureFactory>, protected cMut
* @param KeepLocalCopy Keep the array data copy. ( usefull if want to reload the texture )
* @return Internal Texture Id
*/
Uint32 LoadFromPack( cPack* Pack, const std::string& FilePackPath, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
Uint32 LoadFromPack( cPack* Pack, const std::string& FilePackPath, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
/** Load a texture from memory (RGBA Format)
* @param ImagePtr The image data in RAM just as if it were still in a file
* @param Size The size of the texture ( Width * Height * BytesPerPixel )
* @param Mipmap Use mipmaps?
* @param ColorKey The ColorKey for the texture
* @param ClampMode Defines the CLAMP MODE
* @param CompressTexture If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 )
* @param KeepLocalCopy Keep the array data copy. ( usefull if want to reload the texture )
* @return The internal Texture Id
*/
Uint32 LoadFromMemory( const unsigned char* ImagePtr, const eeUint& Size, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
Uint32 LoadFromMemory( const unsigned char* ImagePtr, const eeUint& Size, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
/** Load a Texture from a file path
* @param filepath The path for the texture
* @param mipmap Use mipmaps?
* @param ColorKey The ColorKey for the texture
* @param ClampMode Defines the CLAMP MODE
* @param CompressTexture If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 )
* @param KeepLocalCopy Keep the array data copy. ( usefull if want to reload the texture )
* @return The internal Texture Id
*/
Uint32 Load( const std::string& Filepath, const bool& mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
Uint32 Load( const std::string& Filepath, const bool& mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
/** Remove and Unload the Texture Id
* @param TexId
@@ -196,7 +193,7 @@ class EE_API cTextureFactory: public tSingleton<cTextureFactory>, protected cMut
* @param LocalCopy If keep a local copy in memory of the texture
* @param MemSize The size of the texture in memory ( just if you need to specify the real size in memory, just usefull to calculate the total texture memory ).
*/
Uint32 PushTexture( const std::string& Filepath, const Uint32& TexId, const eeUint& Width, const eeUint& Height, const eeUint& ImgWidth, const eeUint& ImgHeight, const bool& Mipmap, const eeUint& Channels, const eeRGB& ColorKey, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& LocalCopy = false, const Uint32& MemSize = 0 );
Uint32 PushTexture( const std::string& Filepath, const Uint32& TexId, const eeUint& Width, const eeUint& Height, const eeUint& ImgWidth, const eeUint& ImgHeight, const bool& Mipmap, const eeUint& Channels, const EE_CLAMP_MODE& ClampMode, const bool& CompressTexture, const bool& LocalCopy = false, const Uint32& MemSize = 0 );
/** Return a texture by it file path name
* @param Name File path name
+13 -9
View File
@@ -11,7 +11,6 @@ namespace EE { namespace Graphics {
cTextureLoader::cTextureLoader( const std::string& Filepath,
const bool& Mipmap,
const eeRGB& ColorKey,
const EE_CLAMP_MODE& ClampMode,
const bool& CompressTexture,
const bool& KeepLocalCopy
@@ -26,13 +25,13 @@ cTextureLoader::cTextureLoader( const std::string& Filepath,
mHeight(0),
mMipmap(Mipmap),
mChannels(0),
mColorKey(ColorKey),
mClampMode(ClampMode),
mCompressTexture(CompressTexture),
mLocalCopy(KeepLocalCopy),
mPack(NULL),
mImagePtr(NULL),
mSize(0),
mColorKey(NULL),
mTexLoaded(false),
mIsDDS(false),
mIsDDSCompressed(0)
@@ -42,7 +41,6 @@ cTextureLoader::cTextureLoader( const std::string& Filepath,
cTextureLoader::cTextureLoader( const unsigned char * ImagePtr,
const eeUint& Size,
const bool& Mipmap,
const eeRGB& ColorKey,
const EE_CLAMP_MODE& ClampMode,
const bool& CompressTexture,
const bool& KeepLocalCopy
@@ -57,13 +55,13 @@ cTextureLoader::cTextureLoader( const unsigned char * ImagePtr,
mHeight(0),
mMipmap(Mipmap),
mChannels(0),
mColorKey(ColorKey),
mClampMode(ClampMode),
mCompressTexture(CompressTexture),
mLocalCopy(KeepLocalCopy),
mPack(NULL),
mImagePtr(ImagePtr),
mSize(Size),
mColorKey(NULL),
mTexLoaded(false),
mIsDDS(false),
mIsDDSCompressed(0)
@@ -73,7 +71,6 @@ cTextureLoader::cTextureLoader( const unsigned char * ImagePtr,
cTextureLoader::cTextureLoader( cPack * Pack,
const std::string& FilePackPath,
const bool& Mipmap ,
const eeRGB& ColorKey,
const EE_CLAMP_MODE& ClampMode,
const bool& CompressTexture,
const bool& KeepLocalCopy
@@ -88,13 +85,13 @@ cTextureLoader::cTextureLoader( cPack * Pack,
mHeight(0),
mMipmap(Mipmap),
mChannels(0),
mColorKey(ColorKey),
mClampMode(ClampMode),
mCompressTexture(CompressTexture),
mLocalCopy(KeepLocalCopy),
mPack(Pack),
mImagePtr(NULL),
mSize(0),
mColorKey(NULL),
mTexLoaded(false),
mIsDDS(false),
mIsDDSCompressed(0)
@@ -106,7 +103,6 @@ cTextureLoader::cTextureLoader( const unsigned char * Pixels,
const eeUint& Height,
const eeUint& Channels,
const bool& Mipmap,
const eeRGB& ColorKey,
const EE_CLAMP_MODE& ClampMode,
const bool& CompressTexture,
const bool& KeepLocalCopy,
@@ -122,13 +118,13 @@ cTextureLoader::cTextureLoader( const unsigned char * Pixels,
mHeight(0),
mMipmap(Mipmap),
mChannels(Channels),
mColorKey(ColorKey),
mClampMode(ClampMode),
mCompressTexture(CompressTexture),
mLocalCopy(KeepLocalCopy),
mPack(NULL),
mImagePtr(NULL),
mSize(0),
mColorKey(NULL),
mTexLoaded(false),
mIsDDS(false),
mIsDDSCompressed(0)
@@ -234,7 +230,10 @@ void cTextureLoader::LoadFromPixels() {
else
mSize = mWidth * mHeight * mChannels;
mTexId = cTextureFactory::instance()->PushTexture( mFilepath, tTexId, mImgWidth, mImgHeight, width, height, mMipmap, mChannels, mColorKey, mClampMode, mCompressTexture || mIsDDSCompressed, mLocalCopy, mSize );
mTexId = cTextureFactory::instance()->PushTexture( mFilepath, tTexId, mImgWidth, mImgHeight, width, height, mMipmap, mChannels, mClampMode, mCompressTexture || mIsDDSCompressed, mLocalCopy, mSize );
if ( NULL != mColorKey && 0 != mTexId )
cTextureFactory::instance()->GetTexture( mTexId )->CreateMaskFromColor( eeColorA( mColorKey->R(), mColorKey->G(), mColorKey->B(), 255 ), 0 );
}
if ( TEX_LT_PIXELS != mLoadType ) {
@@ -262,5 +261,10 @@ const Uint32& cTextureLoader::Id() const {
return mTexId;
}
void cTextureLoader::SetColorKey( eeColor Color ) {
eeSAFE_DELETE( mColorKey );
mColorKey = eeNew( eeColor, ( Color.R(), Color.G(), Color.B() ) );
}
}}
+8 -6
View File
@@ -13,16 +13,18 @@ namespace EE { namespace Graphics {
class EE_API cTextureLoader : public cObjectLoader {
public:
cTextureLoader( const std::string& Filepath, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
cTextureLoader( const std::string& Filepath, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
cTextureLoader( const unsigned char * ImagePtr, const eeUint& Size, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
cTextureLoader( const unsigned char * ImagePtr, const eeUint& Size, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
cTextureLoader( cPack * Pack, const std::string& FilePackPath, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
cTextureLoader( cPack * Pack, const std::string& FilePackPath, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
cTextureLoader( const unsigned char * Pixels, const eeUint& Width, const eeUint& Height, const eeUint& Channels, const bool& Mipmap = false, const eeRGB& ColorKey = eeRGB(true), const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") );
cTextureLoader( const unsigned char * Pixels, const eeUint& Width, const eeUint& Height, const eeUint& Channels, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = EE_CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") );
~cTextureLoader();
void SetColorKey( eeColor Color );
void Update();
const std::string& Filepath() const { return mFilepath; }
@@ -40,7 +42,6 @@ class EE_API cTextureLoader : public cObjectLoader {
eeUint mHeight;
bool mMipmap;
Int32 mChannels;
eeRGB mColorKey;
EE_CLAMP_MODE mClampMode;
bool mCompressTexture;
bool mLocalCopy;
@@ -49,6 +50,8 @@ class EE_API cTextureLoader : public cObjectLoader {
const Uint8 * mImagePtr;
Uint32 mSize;
eeColor * mColorKey;
void Start();
private:
bool mTexLoaded;
@@ -64,4 +67,3 @@ class EE_API cTextureLoader : public cObjectLoader {
}}
#endif
+1 -1
View File
@@ -264,7 +264,7 @@ void cTTFFont::UpdateLoading() {
if ( mTexReady && NULL != mPixels ) {
std::string name( FileRemoveExtension( FileNameFromPath( mFilepath ) ) );
mTexId = cTextureFactory::instance()->LoadFromPixels( reinterpret_cast<unsigned char *> ( &mPixels[0] ), (Uint32)mTexWidth, (Uint32)mTexHeight, 4, false, eeRGB(true), EE_CLAMP_TO_EDGE, false, false, name );
mTexId = cTextureFactory::instance()->LoadFromPixels( reinterpret_cast<unsigned char *> ( &mPixels[0] ), (Uint32)mTexWidth, (Uint32)mTexHeight, 4, false, EE_CLAMP_TO_EDGE, false, false, name );
eeSAFE_DELETE_ARRAY( mPixels );
+13 -9
View File
@@ -345,7 +345,10 @@ void cEETest::Init() {
}
void cEETest::LoadFonts() {
mFontLoader.Add( eeNew( cTextureFontLoader, ( "conchars", eeNew( cTextureLoader, ( &PAK, "conchars.png", false, eeRGB(0,0,0) ) ), (eeUint)32 ) ) );
cTextureLoader * tl = eeNew( cTextureLoader, ( &PAK, "conchars.png" ) );
tl->SetColorKey( eeColor(0,0,0) );
mFontLoader.Add( eeNew( cTextureFontLoader, ( "conchars", tl, (eeUint)32 ) ) );
mFontLoader.Add( eeNew( cTextureFontLoader, ( "ProggySquareSZ", eeNew( cTextureLoader, ( &PAK, "ProggySquareSZ.png" ) ), &PAK, "ProggySquareSZ.dat" ) ) );
mFontLoader.Add( eeNew( cTTFFontLoader, ( "arial", &PAK, "arial.ttf", 12, EE_TTF_STYLE_NORMAL, false, 256, eeColor(255,255,255) ) ) );
mFontLoader.Add( eeNew( cTTFFontLoader, ( "arialb", &PAK, "arial.ttf", 12, EE_TTF_STYLE_NORMAL, false, 256, eeColor(255,255,255), 1, eeColor(0,0,0), true ) ) );
@@ -780,7 +783,7 @@ void cEETest::LoadTextures() {
TNP.resize(12);
for ( i = 0; i <= 7; i++ ) {
TN[i] = TF->LoadFromPack( &PAK, "t" + toStr(i+1) + ".png", ( (i+1) == 7 ) ? true : false, eeRGB(true), ( (i+1) == 4 ) ? EE_CLAMP_REPEAT : EE_CLAMP_TO_EDGE );
TN[i] = TF->LoadFromPack( &PAK, "t" + toStr(i+1) + ".png", ( (i+1) == 7 ) ? true : false, ( (i+1) == 4 ) ? EE_CLAMP_REPEAT : EE_CLAMP_TO_EDGE );
TNP[i] = TF->GetTexture( TN[i] );
}
@@ -794,7 +797,8 @@ void cEETest::LoadTextures() {
}
Tiles[6] = SG->Add( TF->LoadFromPack( &PAK, "objects/1.png" ), "7" );
Tiles[7] = SG->Add( TF->LoadFromPack( &PAK, "objects/2.png", false, eeColor(0,0,0) ), "8" );
Tiles[7] = SG->Add( TF->LoadFromPack( &PAK, "objects/2.png" ), "8" );
Tiles[7]->GetTexture()->CreateMaskFromColor( eeColorA(0,0,0,255), 0 );
eeInt w, h;
@@ -842,7 +846,7 @@ void cEETest::LoadTextures() {
CL1.Scale( 0.5f );
CL2.AddFrame(TN[0], 96, 96);
CL2.Color( eeRGBA( 255, 255, 255, 255 ) );
CL2.Color( eeColorA( 255, 255, 255, 255 ) );
mTGL = eeNew( cTextureGroupLoader, ( MyPath + "data/bnb/bnb.etg" ) );
@@ -1019,15 +1023,15 @@ void cEETest::Screen2() {
CL1.SetRenderType( RN_ISOMETRIC );
if (IntersectRectCircle( CL1.GetAABB(), Mousef.x, Mousef.y, 80.f ))
CL1.Color( eeRGBA(255, 0, 0, 200) );
CL1.Color( eeColorA(255, 0, 0, 200) );
else
CL1.Color( eeRGBA(255, 255, 255, 200) );
CL1.Color( eeColorA(255, 255, 255, 200) );
if ( IntersectQuad2( CL1.GetQuad() , CL2.GetQuad() ) ) {
CL1.Color( eeRGBA(0, 255, 0, 255) );
CL2.Color( eeRGBA(0, 255, 0, 255) );
CL1.Color( eeColorA(0, 255, 0, 255) );
CL2.Color( eeColorA(0, 255, 0, 255) );
} else
CL2.Color( eeRGBA(255, 255, 255, 255) );
CL2.Color( eeColorA(255, 255, 255, 255) );
CL1.Angle(ang);
CL1.Scale(scale * 0.5f);
+3 -6
View File
@@ -13,10 +13,7 @@ cUIGfx::cUIGfx( const cUIGfx::CreateParams& Params ) :
if ( NULL != mShape && ( ( Flags() & UI_AUTO_SIZE ) || ( Params.Size.x == -1 && Params.Size.y == -1 ) ) )
Size( mShape->Size() );
if ( mColor.voidRGB ) {
mColor.Alpha = (Uint8)mAlpha;
mColor.voidRGB = false;
}
mColor.Alpha = (Uint8)mAlpha;
}
cUIGfx::~cUIGfx() {
@@ -52,11 +49,11 @@ cShape * cUIGfx::Shape() const {
return mShape;
}
const eeRGBA& cUIGfx::Color() const {
const eeColorA& cUIGfx::Color() const {
return mColor;
}
void cUIGfx::Color( const eeRGBA& color ) {
void cUIGfx::Color( const eeColorA& color ) {
mColor = color;
Alpha( color.A() );
}
+5 -5
View File
@@ -11,14 +11,14 @@ class EE_API cUIGfx : public cUIControlAnim {
public:
inline CreateParams() : cUIControl::CreateParams() {
Shape = NULL;
ShapeColor = eeRGBA( true );
ShapeColor = eeColorA();
ShapeRender = RN_NORMAL;
}
inline ~CreateParams() {}
cShape * Shape;
eeRGBA ShapeColor;
eeColorA ShapeColor;
EE_RENDERTYPE ShapeRender;
};
@@ -34,16 +34,16 @@ class EE_API cUIGfx : public cUIControlAnim {
void Shape( cShape * shape );
const eeRGBA& Color() const;
const eeColorA& Color() const;
void Color( const eeRGBA& color );
void Color( const eeColorA& color );
const EE_RENDERTYPE& RenderType() const;
void RenderType( const EE_RENDERTYPE& render );
protected:
cShape * mShape;
eeRGBA mColor;
eeColorA mColor;
EE_RENDERTYPE mRender;
virtual void OnSizeChange();
+3 -3
View File
@@ -48,14 +48,14 @@ cSprite * cUISprite::Sprite() const {
return mSprite;
}
eeRGBA cUISprite::Color() const {
eeColorA cUISprite::Color() const {
if ( NULL != mSprite )
return mSprite->Color();
return eeRGBA();
return eeColorA();
}
void cUISprite::Color( const eeRGBA& color ) {
void cUISprite::Color( const eeColorA& color ) {
if ( NULL != mSprite )
mSprite->Color( color );
+2 -2
View File
@@ -32,9 +32,9 @@ class EE_API cUISprite : public cUIControlAnim {
void Sprite( cSprite * sprite );
eeRGBA Color() const;
eeColorA Color() const;
void Color( const eeRGBA& color );
void Color( const eeColorA& color );
const EE_RENDERTYPE& RenderType() const;
+61 -48
View File
@@ -6,54 +6,65 @@
namespace EE { namespace UI {
static const char * UI_THEME_ELEMENTS[] = {
"control",
"button",
"textinput",
"checkbox",
"checkbox_active",
"checkbox_inactive",
"button",
"radiobutton",
"radiobutton_active",
"radiobutton_inactive",
"hslider",
"hslider_bg",
"hslider_button",
"vslider",
"vslider_bg",
"vslider_button",
"spinbox",
"spinbox_input",
"spinbox_btnup",
"spinbox_btndown",
"hscrollbar",
"hscrollbar_slider",
"hscrollbar_bg",
"hscrollbar_button",
"hscrollbar_btnup",
"hscrollbar_btndown",
"vscrollbar",
"vscrollbar_slider",
"vscrollbar_bg",
"vscrollbar_button",
"vscrollbar_btnup",
"vscrollbar_btndown",
"progressbar",
"progressbar_filler",
"listbox",
"listboxitem",
"dropdownlist",
"combobox",
"menu",
"menuitem",
"separator",
"menucheckbox_active",
"menucheckbox_inactive",
"menuarrow"
};
static std::vector<std::string> UI_THEME_ELEMENTS;
static void LoadThemeElements() {
if ( !UI_THEME_ELEMENTS.size() ) {
UI_THEME_ELEMENTS.reserve( 50 );
UI_THEME_ELEMENTS.push_back( "control" );
UI_THEME_ELEMENTS.push_back( "button" );
UI_THEME_ELEMENTS.push_back( "textinput" );
UI_THEME_ELEMENTS.push_back( "checkbox" );
UI_THEME_ELEMENTS.push_back( "checkbox_active" );
UI_THEME_ELEMENTS.push_back( "checkbox_inactive" );
UI_THEME_ELEMENTS.push_back( "button" );
UI_THEME_ELEMENTS.push_back( "radiobutton" );
UI_THEME_ELEMENTS.push_back( "radiobutton_active" );
UI_THEME_ELEMENTS.push_back( "radiobutton_inactive" );
UI_THEME_ELEMENTS.push_back( "hslider" );
UI_THEME_ELEMENTS.push_back( "hslider_bg" );
UI_THEME_ELEMENTS.push_back( "hslider_button" );
UI_THEME_ELEMENTS.push_back( "vslider" );
UI_THEME_ELEMENTS.push_back( "vslider_bg" );
UI_THEME_ELEMENTS.push_back( "vslider_button" );
UI_THEME_ELEMENTS.push_back( "spinbox" );
UI_THEME_ELEMENTS.push_back( "spinbox_input" );
UI_THEME_ELEMENTS.push_back( "spinbox_btnup" );
UI_THEME_ELEMENTS.push_back( "spinbox_btndown" );
UI_THEME_ELEMENTS.push_back( "hscrollbar" );
UI_THEME_ELEMENTS.push_back( "hscrollbar_slider" );
UI_THEME_ELEMENTS.push_back( "hscrollbar_bg" );
UI_THEME_ELEMENTS.push_back( "hscrollbar_button" );
UI_THEME_ELEMENTS.push_back( "hscrollbar_btnup" );
UI_THEME_ELEMENTS.push_back( "hscrollbar_btndown" );
UI_THEME_ELEMENTS.push_back( "vscrollbar" );
UI_THEME_ELEMENTS.push_back( "vscrollbar_slider" );
UI_THEME_ELEMENTS.push_back( "vscrollbar_bg" );
UI_THEME_ELEMENTS.push_back( "vscrollbar_button" );
UI_THEME_ELEMENTS.push_back( "vscrollbar_btnup" );
UI_THEME_ELEMENTS.push_back( "vscrollbar_btndown" );
UI_THEME_ELEMENTS.push_back( "progressbar" );
UI_THEME_ELEMENTS.push_back( "progressbar_filler" );
UI_THEME_ELEMENTS.push_back( "listbox" );
UI_THEME_ELEMENTS.push_back( "listboxitem" );
UI_THEME_ELEMENTS.push_back( "dropdownlist" );
UI_THEME_ELEMENTS.push_back( "combobox" );
UI_THEME_ELEMENTS.push_back( "menu" );
UI_THEME_ELEMENTS.push_back( "menuitem" );
UI_THEME_ELEMENTS.push_back( "separator" );
UI_THEME_ELEMENTS.push_back( "menucheckbox_active" );
UI_THEME_ELEMENTS.push_back( "menucheckbox_inactive" );
UI_THEME_ELEMENTS.push_back( "menuarrow" );
}
}
void cUITheme::AddThemeElement( const std::string& Element ) {
UI_THEME_ELEMENTS.push_back( Element );
}
cUITheme * cUITheme::LoadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt ) {
LoadThemeElements();
Uint32 i;
bool Found;
std::string Element;
@@ -71,7 +82,7 @@ cUITheme * cUITheme::LoadFromPath( const std::string& Path, const std::string& N
cUITheme * tTheme = eeNew( cUITheme, ( Name, NameAbbr ) );
Uint32 Count = eeARRAY_SIZE( UI_THEME_ELEMENTS );
Uint32 Count = UI_THEME_ELEMENTS.size();
for ( i = 0; i < Count; i++ ) {
Uint32 IsComplex = 0;
@@ -102,6 +113,8 @@ cUITheme * cUITheme::LoadFromPath( const std::string& Path, const std::string& N
}
cUITheme * cUITheme::LoadFromShapeGroup( cShapeGroup * ShapeGroup, const std::string& Name, const std::string NameAbbr ) {
LoadThemeElements();
Uint32 i;
bool Found;
std::string Element;
@@ -110,7 +123,7 @@ cUITheme * cUITheme::LoadFromShapeGroup( cShapeGroup * ShapeGroup, const std::st
cUITheme * tTheme = eeNew( cUITheme, ( Name, NameAbbr ) );
Uint32 Count = eeARRAY_SIZE( UI_THEME_ELEMENTS );
Uint32 Count = UI_THEME_ELEMENTS.size();
for ( i = 0; i < Count; i++ ) {
Uint32 IsComplex = 0;
+2
View File
@@ -14,6 +14,8 @@ class EE_API cUITheme : public tResourceManager<cUISkin> {
static cUITheme * LoadFromShapeGroup( cShapeGroup * ShapeGroup, const std::string& Name, const std::string NameAbbr );
static void AddThemeElement( const std::string& Element );
cUITheme( const std::string& Name, const std::string& Abbr, cFont * DefaultFont = NULL );
virtual ~cUITheme();
-104
View File
@@ -135,114 +135,10 @@ bool tColorA<T>::operator!= ( const tColorA<T>& Col ) const {
return !( Red == Col.R() && Green == Col.G() && Blue == Col.B() && Alpha == Col.A() );
}
template <typename T>
class cColor : public tColor<T> {
public:
using tColor<T>::Red;
using tColor<T>::Green;
using tColor<T>::Blue;
bool voidRGB;
cColor();
cColor( T r, T g, T b );
cColor( bool voidrgb );
cColor( const tColor<T>& Col );
bool operator==(cColor<T>& Col);
bool operator!=(cColor<T>& Col);
};
template <typename T>
cColor<T>::cColor( bool voidrgb ) : tColor<T>(), voidRGB(voidrgb) {}
template <typename T>
cColor<T>::cColor() : tColor<T>(), voidRGB(false) {}
template <typename T>
cColor<T>::cColor(T r, T g, T b) : tColor<T>(r, g, b), voidRGB(false) {}
template <typename T>
cColor<T>::cColor( const tColor<T>& Col ) {
Red = Col.R(); Green = Col.G(); Blue = Col.B(); voidRGB = false;
}
template <typename T>
bool cColor<T>::operator== (cColor<T>& Col) {
return ( Red == Col.R() && Green == Col.G() && Blue == Col.B() );
}
template <typename T>
bool cColor<T>::operator!= (cColor<T>& Col) {
return !( Red == Col.R() && Green == Col.G() && Blue == Col.B() );
}
template <typename T>
class cColorA : public tColorA<T> {
public:
using tColorA<T>::Red;
using tColorA<T>::Green;
using tColorA<T>::Blue;
using tColorA<T>::Alpha;
bool voidRGB;
cColorA();
cColorA( T r, T g, T b, T a) ;
cColorA( const tColor<T>& Col );
cColorA( const tColorA<T>& Col );
cColorA( const bool& voidrgb );
cColorA( const Uint32& Color );
bool operator==( cColorA<T>& Col );
bool operator!=( cColorA<T>& Col );
static const cColorA<T> Black; ///< Black predefined color
};
template <typename T>
const cColorA<T> cColorA<T>::Black = cColorA<T>(0,0,0,0);
template <typename T>
cColorA<T>::cColorA( const Uint32& Color ) : tColorA<T>( Color ) {
voidRGB = false;
}
template <typename T>
cColorA<T>::cColorA( const bool& voidrgb ) : tColorA<T>() {
voidRGB = voidrgb;
}
template <typename T>
cColorA<T>::cColorA() : tColorA<T>(), voidRGB(false) {}
template <typename T>
cColorA<T>::cColorA(T r, T g, T b, T a) : tColorA<T>(r, g, b, a), voidRGB(false) {}
template <typename T>
cColorA<T>::cColorA( const tColor<T>& Col ) {
Red = Col.R(); Green = Col.G(); Blue = Col.B(); Alpha = 255;
}
template <typename T>
cColorA<T>::cColorA( const tColorA<T>& Col ) {
Red = Col.R(); Green = Col.G(); Blue = Col.B(); Alpha = Col.A();
}
template <typename T>
bool cColorA<T>::operator== (cColorA<T>& Col) {
return ( Red == Col.R() && Green == Col.G() && Blue == Col.B() && Alpha == Col.A() );
}
template <typename T>
bool cColorA<T>::operator!= (cColorA<T>& Col) {
return !( Red == Col.R() && Green == Col.G() && Blue == Col.B() && Alpha == Col.A() );
}
typedef tColor<Uint8> eeColor;
typedef tColor<eeFloat> eeColorf;
typedef tColorA<Uint8> eeColorA;
typedef tColorA<eeFloat> eeColorAf;
typedef cColor<Uint8> eeRGB;
typedef cColorA<Uint8> eeRGBA;
}}
+6 -2
View File
@@ -218,8 +218,7 @@ void cInput::Update() {
case SDL_VIDEORESIZE:
EE->ChangeRes(mEvent.resize.w, mEvent.resize.h, EE->Windowed() );
if ( mVRCall.IsSet() )
mVRCall();
CallVideoResize();
break;
case SDL_QUIT:
@@ -233,6 +232,11 @@ void cInput::Update() {
}
}
void cInput::CallVideoResize() {
if ( mVRCall.IsSet() )
mVRCall();
}
bool cInput::GetKey( Uint8 * Key, Uint8 Pos ) {
if ( ( * Key ) & ( 1 << Pos ) )
return true;
+2
View File
@@ -429,6 +429,8 @@ class EE_API cInput : public tSingleton<cInput> {
void DoubleClickInterval( const Uint32& Interval );
~cInput();
void CallVideoResize();
protected:
cInput();