mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 07:20:40 +00:00
Converts all game, gui editor, and system classes to utilize assets
Processed core, tools and default modules to utilize assets Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption Removed unneeded MainEditor mockup module Removed some unused/duplicate image assets from the tools
This commit is contained in:
parent
83b0432283
commit
5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions
|
|
@ -30,6 +30,9 @@
|
|||
#include "gui/core/guiDefaultControlRender.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
#include "gui/editor/inspector/group.h"
|
||||
#include "gui/editor/inspector/field.h"
|
||||
#include "gui/editor/guiInspector.h"
|
||||
|
||||
|
||||
ImplementEnumType( GuiBitmapMode,
|
||||
|
|
@ -208,7 +211,7 @@ bool GuiBitmapButtonCtrl::_setAutoFitExtents( void *object, const char *index, c
|
|||
bool GuiBitmapButtonCtrl::_setBitmap( void *object, const char *index, const char *data )
|
||||
{
|
||||
GuiBitmapButtonCtrl* ctrl = reinterpret_cast< GuiBitmapButtonCtrl* >( object );
|
||||
ctrl->setBitmap( data );
|
||||
ctrl->setBitmap( StringTable->insert(data) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +222,7 @@ DefineEngineMethod( GuiBitmapButtonCtrl, setBitmap, void, ( const char* path ),,
|
|||
"Set the bitmap to show on the button.\n"
|
||||
"@param path Path to the texture file in any of the supported formats.\n" )
|
||||
{
|
||||
object->setBitmap( path );
|
||||
object->setBitmap( StringTable->insert(path) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -253,7 +256,7 @@ void GuiBitmapButtonCtrl::inspectPostApply()
|
|||
}
|
||||
}
|
||||
|
||||
setBitmap( path.getFullPath() );
|
||||
setBitmap( StringTable->insert(path.getFullPath().c_str()) );
|
||||
|
||||
// if the extent is set to (0,0) in the gui editor and appy hit, this control will
|
||||
// set it's extent to be exactly the size of the normal bitmap (if present)
|
||||
|
|
@ -275,7 +278,7 @@ void GuiBitmapButtonCtrl::setAutoFitExtents( bool state )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiBitmapButtonCtrl::setBitmap( const String& name )
|
||||
void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
||||
{
|
||||
PROFILE_SCOPE( GuiBitmapButtonCtrl_setBitmap );
|
||||
|
||||
|
|
@ -283,7 +286,7 @@ void GuiBitmapButtonCtrl::setBitmap( const String& name )
|
|||
if( !isAwake() )
|
||||
return;
|
||||
|
||||
if( !mBitmapName.isEmpty() )
|
||||
if( mBitmapName != StringTable->EmptyString())
|
||||
{
|
||||
if( dStricmp( mBitmapName, "texhandle" ) != 0 )
|
||||
{
|
||||
|
|
@ -329,8 +332,8 @@ void GuiBitmapButtonCtrl::setBitmap( const String& name )
|
|||
|
||||
if( i == 0 && mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull() )
|
||||
{
|
||||
Con::warnf( "GuiBitmapButtonCtrl::setBitmap - Unable to load texture: %s", mBitmapName.c_str() );
|
||||
this->setBitmap( GFXTextureManager::getUnavailableTexturePath() );
|
||||
Con::warnf( "GuiBitmapButtonCtrl::setBitmap - Unable to load texture: %s", mBitmapName );
|
||||
this->setBitmap( StringTable->insert(GFXTextureManager::getUnavailableTexturePath().c_str()) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -375,7 +378,7 @@ void GuiBitmapButtonCtrl::setBitmapHandles(GFXTexHandle normal, GFXTexHandle hig
|
|||
if (mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull())
|
||||
{
|
||||
Con::warnf("GuiBitmapButtonCtrl::setBitmapHandles() - Invalid texture handles");
|
||||
setBitmap( GFXTextureManager::getUnavailableTexturePath() );
|
||||
setBitmap( StringTable->insert(GFXTextureManager::getUnavailableTexturePath().c_str()) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
|||
BitmapMode mBitmapMode;
|
||||
|
||||
/// File name for bitmap.
|
||||
String mBitmapName;
|
||||
StringTableEntry mBitmapName;
|
||||
|
||||
/// alpha masking
|
||||
bool mMasked;
|
||||
|
|
@ -154,7 +154,7 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
|||
GuiBitmapButtonCtrl();
|
||||
|
||||
void setAutoFitExtents( bool state );
|
||||
void setBitmap( const String& name );
|
||||
void setBitmap( StringTableEntry name );
|
||||
void setBitmapHandles( GFXTexHandle normal, GFXTexHandle highlighted, GFXTexHandle depressed, GFXTexHandle inactive );
|
||||
|
||||
//Parent methods
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
xOffset = mProfile->mBitmapArrayRects[0].extent.x + 2 + mIndent;
|
||||
S32 y = (getHeight() - mProfile->mBitmapArrayRects[0].extent.y) / 2;
|
||||
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]);
|
||||
GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmapResource(), offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]);
|
||||
}
|
||||
|
||||
if(mButtonText[0] != '\0')
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ ConsoleDocClass( GuiIconButtonCtrl,
|
|||
|
||||
GuiIconButtonCtrl::GuiIconButtonCtrl()
|
||||
{
|
||||
mBitmapName = StringTable->EmptyString();
|
||||
INIT_IMAGEASSET(Bitmap);
|
||||
mTextLocation = TextLocLeft;
|
||||
mIconLocation = IconLocLeft;
|
||||
mTextMargin = 4;
|
||||
|
|
@ -94,9 +94,6 @@ GuiIconButtonCtrl::GuiIconButtonCtrl()
|
|||
mFitBitmapToButton = false;
|
||||
mMakeIconSquare = false;
|
||||
|
||||
mErrorBitmapName = StringTable->EmptyString();
|
||||
mErrorTextureHandle = NULL;
|
||||
|
||||
mAutoSize = false;
|
||||
|
||||
setExtent(140, 30);
|
||||
|
|
@ -125,7 +122,10 @@ EndImplementEnumType;
|
|||
void GuiIconButtonCtrl::initPersistFields()
|
||||
{
|
||||
addField( "buttonMargin", TypePoint2I, Offset( mButtonMargin, GuiIconButtonCtrl ),"Margin area around the button.\n");
|
||||
addField( "iconBitmap", TypeFilename, Offset( mBitmapName, GuiIconButtonCtrl ),"Bitmap file for the icon to display on the button.\n");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n");
|
||||
addProtectedField( "iconBitmap", TypeImageFilename, Offset( mBitmapName, GuiIconButtonCtrl ), &_setBitmapData, &defaultProtectedGetFn, "Bitmap file for the icon to display on the button.\n", AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
||||
addField( "iconLocation", TYPEID< IconLocation >(), Offset( mIconLocation, GuiIconButtonCtrl ),"Where to place the icon on the control. Options are 0 (None), 1 (Left), 2 (Right), 3 (Center).\n");
|
||||
addField( "sizeIconToButton", TypeBool, Offset( mFitBitmapToButton, GuiIconButtonCtrl ),"If true, the icon will be scaled to be the same size as the button.\n");
|
||||
addField( "makeIconSquare", TypeBool, Offset( mMakeIconSquare, GuiIconButtonCtrl ),"If true, will make sure the icon is square.\n");
|
||||
|
|
@ -152,7 +152,6 @@ bool GuiIconButtonCtrl::onWake()
|
|||
|
||||
void GuiIconButtonCtrl::onSleep()
|
||||
{
|
||||
mTextureNormal = NULL;
|
||||
Parent::onSleep();
|
||||
}
|
||||
|
||||
|
|
@ -176,8 +175,8 @@ bool GuiIconButtonCtrl::resize(const Point2I &newPosition, const Point2I &newExt
|
|||
|
||||
if ( mIconLocation != IconLocNone )
|
||||
{
|
||||
autoExtent.y = mTextureNormal.getHeight() + mButtonMargin.y * 2;
|
||||
autoExtent.x = mTextureNormal.getWidth() + mButtonMargin.x * 2;
|
||||
autoExtent.y = mBitmap.getHeight() + mButtonMargin.y * 2;
|
||||
autoExtent.x = mBitmap.getWidth() + mButtonMargin.x * 2;
|
||||
}
|
||||
|
||||
if ( mTextLocation != TextLocNone && mButtonText && mButtonText[0] )
|
||||
|
|
@ -201,18 +200,10 @@ bool GuiIconButtonCtrl::resize(const Point2I &newPosition, const Point2I &newExt
|
|||
|
||||
void GuiIconButtonCtrl::setBitmap(const char *name)
|
||||
{
|
||||
mBitmapName = Platform::makeRelativePathName(name, NULL);
|
||||
if(!isAwake())
|
||||
return;
|
||||
|
||||
if (*mBitmapName)
|
||||
{
|
||||
mTextureNormal = GFXTexHandle(mBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTextureNormal = NULL;
|
||||
}
|
||||
_setBitmap(getBitmap());
|
||||
|
||||
// So that extent is recalculated if autoSize is set.
|
||||
resize( getPosition(), getExtent() );
|
||||
|
|
@ -279,7 +270,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
|||
RectI iconRect( 0, 0, 0, 0 );
|
||||
|
||||
// Render the icon
|
||||
if ( mTextureNormal && mIconLocation != GuiIconButtonCtrl::IconLocNone )
|
||||
if ( mBitmap && mIconLocation != GuiIconButtonCtrl::IconLocNone )
|
||||
{
|
||||
// Render the normal bitmap
|
||||
drawer->clearBitmapModulation();
|
||||
|
|
@ -287,7 +278,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
|||
// Maintain the bitmap size or fill the button?
|
||||
if ( !mFitBitmapToButton )
|
||||
{
|
||||
Point2I textureSize( mTextureNormal->getWidth(), mTextureNormal->getHeight() );
|
||||
Point2I textureSize(mBitmap->getWidth(), mBitmap->getHeight() );
|
||||
iconRect.set( offset + mButtonMargin, textureSize );
|
||||
|
||||
if ( mIconLocation == IconLocRight )
|
||||
|
|
@ -306,7 +297,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
|||
iconRect.point.y = offset.y + ( getHeight() - textureSize.y ) / 2;
|
||||
}
|
||||
|
||||
drawer->drawBitmapStretch( mTextureNormal, iconRect );
|
||||
drawer->drawBitmapStretch(mBitmap, iconRect );
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -322,7 +313,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
|||
iconRect.extent.x = iconRect.extent.y;
|
||||
}
|
||||
|
||||
drawer->drawBitmapStretch( mTextureNormal, iconRect );
|
||||
drawer->drawBitmapStretch( mBitmap, iconRect );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -339,7 +330,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
|||
if ( mTextLocation == TextLocRight )
|
||||
{
|
||||
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
||||
if ( mTextureNormal && mIconLocation != IconLocNone )
|
||||
if (mBitmap && mIconLocation != IconLocNone )
|
||||
{
|
||||
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
|
||||
}
|
||||
|
|
@ -357,7 +348,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
|||
if ( mTextLocation == TextLocCenter )
|
||||
{
|
||||
Point2I start;
|
||||
if ( mTextureNormal && mIconLocation == IconLocLeft )
|
||||
if (mBitmap && mIconLocation == IconLocLeft )
|
||||
{
|
||||
start.set( ( getWidth() - textWidth - iconRect.extent.x ) / 2 + iconRect.extent.x,
|
||||
( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
||||
|
|
@ -421,19 +412,4 @@ void GuiIconButtonCtrl::renderBitmapArray(RectI &bounds, S32 state)
|
|||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiIconButtonCtrl, setBitmap, void, (const char* buttonFilename),,
|
||||
"@brief Set the bitmap to use for the button portion of this control.\n\n"
|
||||
"@param buttonFilename Filename for the image\n"
|
||||
"@tsexample\n"
|
||||
"// Define the button filename\n"
|
||||
"%buttonFilename = \"pearlButton\";\n\n"
|
||||
"// Inform the GuiIconButtonCtrl control to update its main button graphic to the defined bitmap\n"
|
||||
"%thisGuiIconButtonCtrl.setBitmap(%buttonFilename);\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n"
|
||||
"@see GuiButtonCtrl\n\n")
|
||||
{
|
||||
char* argBuffer = Con::getArgBuffer( 512 );
|
||||
Platform::makeFullPathName( buttonFilename, argBuffer, 512 );
|
||||
object->setBitmap( argBuffer );
|
||||
}
|
||||
DEF_IMAGEASSET_BINDS(GuiIconButtonCtrl, Bitmap);
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
#include "gfx/gfxTextureManager.h"
|
||||
#endif
|
||||
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
/// The GuiIconButtonCtrl draws an icon and text caption within a normal
|
||||
/// button control with several layout options.
|
||||
|
|
@ -41,8 +42,9 @@ private:
|
|||
|
||||
protected:
|
||||
|
||||
StringTableEntry mBitmapName;
|
||||
GFXTexHandle mTextureNormal;
|
||||
DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, onImageChanged, GFXTexturePersistentSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiIconButtonCtrl, Bitmap);
|
||||
|
||||
S32 mIconLocation;
|
||||
S32 mTextLocation;
|
||||
S32 mTextMargin;
|
||||
|
|
@ -57,10 +59,6 @@ protected:
|
|||
/// Calculate extent based on icon size, text width, and layout options.
|
||||
bool mAutoSize;
|
||||
|
||||
// Optional bitmap to be displayed when the proper bitmap cannot be found
|
||||
StringTableEntry mErrorBitmapName;
|
||||
GFXTexHandle mErrorTextureHandle;
|
||||
|
||||
void renderButton( Point2I &offset, const RectI& updateRect);
|
||||
|
||||
enum
|
||||
|
|
@ -114,6 +112,8 @@ public:
|
|||
void setErrorBitmap(const char *name);
|
||||
|
||||
void onRender(Point2I offset, const RectI &updateRect);
|
||||
|
||||
void onImageChanged() {}
|
||||
};
|
||||
|
||||
typedef GuiIconButtonCtrl::TextLocation GuiIconButtonTextLocation;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,10 @@ ConsoleDocClass( GuiToolboxButtonCtrl,
|
|||
//-------------------------------------
|
||||
GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
|
||||
{
|
||||
mNormalBitmapName = StringTable->EmptyString();
|
||||
mLoweredBitmapName = StringTable->insert("sceneeditor/client/images/buttondown");
|
||||
mHoverBitmapName = StringTable->insert("sceneeditor/client/images/buttonup");
|
||||
INIT_IMAGEASSET(NormalBitmap);
|
||||
INIT_IMAGEASSET(LoweredBitmap);
|
||||
INIT_IMAGEASSET(HoverBitmap);
|
||||
|
||||
setMinExtent(Point2I(16,16));
|
||||
setExtent(48, 48);
|
||||
mButtonType = ButtonTypeRadio;
|
||||
|
|
@ -57,9 +58,10 @@ GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
|
|||
//-------------------------------------
|
||||
void GuiToolboxButtonCtrl::initPersistFields()
|
||||
{
|
||||
addField("normalBitmap", TypeFilename, Offset(mNormalBitmapName, GuiToolboxButtonCtrl));
|
||||
addField("loweredBitmap", TypeFilename, Offset(mLoweredBitmapName, GuiToolboxButtonCtrl));
|
||||
addField("hoverBitmap", TypeFilename, Offset(mHoverBitmapName, GuiToolboxButtonCtrl));
|
||||
INITPERSISTFIELD_IMAGEASSET(NormalBitmap, GuiToolboxButtonCtrl, "");
|
||||
INITPERSISTFIELD_IMAGEASSET(LoweredBitmap, GuiToolboxButtonCtrl, "");
|
||||
INITPERSISTFIELD_IMAGEASSET(HoverBitmap, GuiToolboxButtonCtrl, "");
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
@ -72,9 +74,9 @@ bool GuiToolboxButtonCtrl::onWake()
|
|||
|
||||
setActive( true );
|
||||
|
||||
setNormalBitmap( mNormalBitmapName );
|
||||
setLoweredBitmap( mLoweredBitmapName );
|
||||
setHoverBitmap( mHoverBitmapName );
|
||||
setNormalBitmap( getNormalBitmap() );
|
||||
setLoweredBitmap( getLoweredBitmap() );
|
||||
setHoverBitmap( getHoverBitmap() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -83,30 +85,9 @@ bool GuiToolboxButtonCtrl::onWake()
|
|||
//-------------------------------------
|
||||
void GuiToolboxButtonCtrl::onSleep()
|
||||
{
|
||||
mTextureNormal = NULL;
|
||||
mTextureLowered = NULL;
|
||||
mTextureHover = NULL;
|
||||
Parent::onSleep();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiToolboxButtonCtrl, setNormalBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is active")
|
||||
{
|
||||
object->setNormalBitmap(name);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiToolboxButtonCtrl, setLoweredBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled")
|
||||
{
|
||||
object->setLoweredBitmap(name);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiToolboxButtonCtrl, setHoverBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled")
|
||||
{
|
||||
object->setHoverBitmap(name);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
void GuiToolboxButtonCtrl::inspectPostApply()
|
||||
{
|
||||
|
|
@ -114,9 +95,9 @@ void GuiToolboxButtonCtrl::inspectPostApply()
|
|||
// set it's extent to be exactly the size of the normal bitmap (if present)
|
||||
Parent::inspectPostApply();
|
||||
|
||||
if ((getWidth() == 0) && (getHeight() == 0) && mTextureNormal)
|
||||
if ((getWidth() == 0) && (getHeight() == 0) && mNormalBitmap)
|
||||
{
|
||||
setExtent( mTextureNormal->getWidth(), mTextureNormal->getHeight());
|
||||
setExtent(mNormalBitmap->getWidth(), mNormalBitmap->getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,46 +105,31 @@ void GuiToolboxButtonCtrl::inspectPostApply()
|
|||
//-------------------------------------
|
||||
void GuiToolboxButtonCtrl::setNormalBitmap( StringTableEntry bitmapName )
|
||||
{
|
||||
mNormalBitmapName = StringTable->insert( bitmapName );
|
||||
_setNormalBitmap(bitmapName);
|
||||
|
||||
if(!isAwake())
|
||||
return;
|
||||
|
||||
if ( *mNormalBitmapName )
|
||||
mTextureNormal = GFXTexHandle( mNormalBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mTextureNormal = NULL;
|
||||
|
||||
setUpdate();
|
||||
}
|
||||
|
||||
void GuiToolboxButtonCtrl::setLoweredBitmap( StringTableEntry bitmapName )
|
||||
{
|
||||
mLoweredBitmapName = StringTable->insert( bitmapName );
|
||||
_setLoweredBitmap(bitmapName);
|
||||
|
||||
if(!isAwake())
|
||||
return;
|
||||
|
||||
if ( *mLoweredBitmapName )
|
||||
mTextureLowered = GFXTexHandle( mLoweredBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureLowered (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mTextureLowered = NULL;
|
||||
|
||||
setUpdate();
|
||||
}
|
||||
|
||||
void GuiToolboxButtonCtrl::setHoverBitmap( StringTableEntry bitmapName )
|
||||
{
|
||||
mHoverBitmapName = StringTable->insert( bitmapName );
|
||||
_setHoverBitmap(bitmapName);
|
||||
|
||||
if(!isAwake())
|
||||
return;
|
||||
|
||||
if ( *mHoverBitmapName )
|
||||
mTextureHover = GFXTexHandle( mHoverBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureHover (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mTextureHover = NULL;
|
||||
|
||||
setUpdate();
|
||||
}
|
||||
|
||||
|
|
@ -177,15 +143,15 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
|
|||
{
|
||||
RectI r(offset, getExtent());
|
||||
if ( mDepressed || mStateOn )
|
||||
renderStateRect( mTextureLowered , r );
|
||||
renderStateRect( mLoweredBitmap , r );
|
||||
else if ( mMouseOver )
|
||||
renderStateRect( mTextureHover , r );
|
||||
renderStateRect( mHoverBitmap , r );
|
||||
}
|
||||
|
||||
// Now render the image
|
||||
if( mTextureNormal )
|
||||
if( mNormalBitmap )
|
||||
{
|
||||
renderButton( mTextureNormal, offset, updateRect );
|
||||
renderButton(mNormalBitmap, offset, updateRect );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -226,3 +192,7 @@ void GuiToolboxButtonCtrl::renderButton(GFXTexHandle &texture, Point2I &offset,
|
|||
renderChildControls( offset, updateRect);
|
||||
}
|
||||
}
|
||||
|
||||
DEF_IMAGEASSET_BINDS(GuiToolboxButtonCtrl, NormalBitmap);
|
||||
DEF_IMAGEASSET_BINDS(GuiToolboxButtonCtrl, LoweredBitmap);
|
||||
DEF_IMAGEASSET_BINDS(GuiToolboxButtonCtrl, HoverBitmap);
|
||||
|
|
|
|||
|
|
@ -30,23 +30,29 @@
|
|||
#include "gfx/gfxTextureManager.h"
|
||||
#endif
|
||||
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
class GuiToolboxButtonCtrl : public GuiButtonCtrl
|
||||
{
|
||||
private:
|
||||
typedef GuiButtonCtrl Parent;
|
||||
|
||||
protected:
|
||||
StringTableEntry mNormalBitmapName;
|
||||
StringTableEntry mLoweredBitmapName;
|
||||
StringTableEntry mHoverBitmapName;
|
||||
|
||||
GFXTexHandle mTextureNormal;
|
||||
GFXTexHandle mTextureLowered;
|
||||
GFXTexHandle mTextureHover;
|
||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, onNormalImageChanged, GFXTexturePersistentSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiToolboxButtonCtrl, NormalBitmap);
|
||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, onLoweredImageChanged, GFXTexturePersistentSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiToolboxButtonCtrl, LoweredBitmap);
|
||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, onHoverImageChanged, GFXTexturePersistentSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiToolboxButtonCtrl, HoverBitmap);
|
||||
|
||||
void renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect);
|
||||
void renderStateRect( GFXTexHandle &texture, const RectI& rect );
|
||||
|
||||
void onNormalImageChanged() {}
|
||||
void onLoweredImageChanged() {}
|
||||
void onHoverImageChanged() {}
|
||||
|
||||
public:
|
||||
DECLARE_CONOBJECT(GuiToolboxButtonCtrl);
|
||||
GuiToolboxButtonCtrl();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue