mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
moar refactors
This commit is contained in:
parent
4d893f51cf
commit
22037bf94f
10 changed files with 65 additions and 60 deletions
|
|
@ -86,6 +86,26 @@ if (m##name##AssetId != StringTable->EmptyString())\
|
||||||
_set##name(netconn->unpackNetStringHandleU(stream).getString());\
|
_set##name(netconn->unpackNetStringHandleU(stream).getString());\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//network send - datablock
|
||||||
|
#define PACKDATA_ASSET_ARRAY_REFACTOR(name, max)\
|
||||||
|
for (i = 0; i < max; i++)\
|
||||||
|
{\
|
||||||
|
if (stream->writeFlag(m##name##Asset[i].notNull()))\
|
||||||
|
{\
|
||||||
|
stream->writeString(m##name##Asset[i].getAssetId()); \
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
//network recieve - datablock
|
||||||
|
#define UNPACKDATA_ASSET_ARRAY_REFACTOR(name, max)\
|
||||||
|
for (i = 0; i < max; i++)\
|
||||||
|
{\
|
||||||
|
if (stream->readFlag())\
|
||||||
|
{\
|
||||||
|
m##name##Asset[i] = stream->readSTString();\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
|
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
|
||||||
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
|
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
|
||||||
{\
|
{\
|
||||||
|
|
|
||||||
|
|
@ -96,11 +96,6 @@ SplashData::SplashData()
|
||||||
explosionId = 0;
|
explosionId = 0;
|
||||||
|
|
||||||
U32 i;
|
U32 i;
|
||||||
for (i = 0; i < NUM_TEX; i++)
|
|
||||||
{
|
|
||||||
INIT_IMAGEASSET_ARRAY(Texture, GFXStaticTextureSRGBProfile, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i=0; i<NUM_TIME_KEYS; i++ )
|
for( i=0; i<NUM_TIME_KEYS; i++ )
|
||||||
times[i] = 1.0;
|
times[i] = 1.0;
|
||||||
|
|
||||||
|
|
@ -133,7 +128,7 @@ void SplashData::initPersistFields()
|
||||||
addField("times", TypeF32, Offset(times, SplashData), NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" );
|
addField("times", TypeF32, Offset(times, SplashData), NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" );
|
||||||
addField("colors", TypeColorF, Offset(colors, SplashData), NUM_TIME_KEYS, "Color values to set the splash effect, rgba. Up to 4 allowed. Will transition through colors based on values set in the times value. Example: colors[0] = \"0.6 1.0 1.0 0.5\".\n" );
|
addField("colors", TypeColorF, Offset(colors, SplashData), NUM_TIME_KEYS, "Color values to set the splash effect, rgba. Up to 4 allowed. Will transition through colors based on values set in the times value. Example: colors[0] = \"0.6 1.0 1.0 0.5\".\n" );
|
||||||
|
|
||||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n");
|
INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n");
|
||||||
|
|
||||||
addField("texWrap", TypeF32, Offset(texWrap, SplashData), "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n");
|
addField("texWrap", TypeF32, Offset(texWrap, SplashData), "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n");
|
||||||
addField("texFactor", TypeF32, Offset(texFactor, SplashData), "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n");
|
addField("texFactor", TypeF32, Offset(texFactor, SplashData), "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n");
|
||||||
|
|
@ -207,10 +202,7 @@ void SplashData::packData(BitStream* stream)
|
||||||
stream->write( times[i] );
|
stream->write( times[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i=0; i<NUM_TEX; i++ )
|
PACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||||
{
|
|
||||||
PACKDATA_ASSET_ARRAY(Texture, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
@ -263,10 +255,7 @@ void SplashData::unpackData(BitStream* stream)
|
||||||
stream->read( ×[i] );
|
stream->read( ×[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i=0; i<NUM_TEX; i++ )
|
UNPACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||||
{
|
|
||||||
UNPACKDATA_ASSET_ARRAY(Texture, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
@ -299,9 +288,9 @@ bool SplashData::preload(bool server, String &errorStr)
|
||||||
|
|
||||||
for( i=0; i<NUM_TEX; i++ )
|
for( i=0; i<NUM_TEX; i++ )
|
||||||
{
|
{
|
||||||
if (mTexture[i].isNull())
|
if (mTextureAsset[i].isNull())
|
||||||
{
|
{
|
||||||
_setTexture(getTexture(i), i);
|
_setTexture(_getTexture(i), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,7 @@ public:
|
||||||
F32 times[ NUM_TIME_KEYS ];
|
F32 times[ NUM_TIME_KEYS ];
|
||||||
LinearColorF colors[ NUM_TIME_KEYS ];
|
LinearColorF colors[ NUM_TIME_KEYS ];
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX, onTextureChanged);
|
DECLARE_IMAGEASSET_ARRAY_REFACTOR(SplashData, Texture, GFXStaticTextureSRGBProfile, NUM_TEX)
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
|
||||||
void onTextureChanged() {}
|
|
||||||
|
|
||||||
ExplosionData* explosion;
|
ExplosionData* explosion;
|
||||||
S32 explosionId;
|
S32 explosionId;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ ConsoleDocClass( GuiIconButtonCtrl,
|
||||||
|
|
||||||
GuiIconButtonCtrl::GuiIconButtonCtrl()
|
GuiIconButtonCtrl::GuiIconButtonCtrl()
|
||||||
{
|
{
|
||||||
INIT_ASSET(Bitmap);
|
|
||||||
mTextLocation = TextLocLeft;
|
mTextLocation = TextLocLeft;
|
||||||
mIconLocation = IconLocLeft;
|
mIconLocation = IconLocLeft;
|
||||||
mTextMargin = 4;
|
mTextMargin = 4;
|
||||||
|
|
@ -127,8 +126,8 @@ void GuiIconButtonCtrl::initPersistFields()
|
||||||
docsURL;
|
docsURL;
|
||||||
addField( "buttonMargin", TypePoint2I, Offset( mButtonMargin, GuiIconButtonCtrl ),"Margin area around the button.\n");
|
addField( "buttonMargin", TypePoint2I, Offset( mButtonMargin, GuiIconButtonCtrl ),"Margin area around 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);
|
addProtectedField( "iconBitmap", TypeImageFilename, Offset( mBitmapAsset, GuiIconButtonCtrl ), &_setBitmapData, &defaultProtectedGetFn, "Bitmap file for the icon to display on the button.\n", AbstractClassRep::FIELD_HideInInspectors);
|
||||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n");
|
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n");
|
||||||
|
|
||||||
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( "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( "sizeIconToButton", TypeBool, Offset( mFitBitmapToButton, GuiIconButtonCtrl ),"If true, the icon will be scaled to be the same size as the button.\n");
|
||||||
|
|
@ -148,8 +147,6 @@ bool GuiIconButtonCtrl::onWake()
|
||||||
return false;
|
return false;
|
||||||
setActive(true);
|
setActive(true);
|
||||||
|
|
||||||
setBitmap(mBitmapName);
|
|
||||||
|
|
||||||
if( mProfile )
|
if( mProfile )
|
||||||
mProfile->constructBitmapArray();
|
mProfile->constructBitmapArray();
|
||||||
|
|
||||||
|
|
@ -181,8 +178,8 @@ bool GuiIconButtonCtrl::resize(const Point2I &newPosition, const Point2I &newExt
|
||||||
|
|
||||||
if ( mIconLocation != IconLocNone )
|
if ( mIconLocation != IconLocNone )
|
||||||
{
|
{
|
||||||
autoExtent.y = mBitmap.getHeight() + mButtonMargin.y * 2;
|
autoExtent.y = getBitmap().getHeight() + mButtonMargin.y * 2;
|
||||||
autoExtent.x = mBitmap.getWidth() + mButtonMargin.x * 2;
|
autoExtent.x = getBitmap().getWidth() + mButtonMargin.x * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mTextLocation != TextLocNone && mButtonText && mButtonText[0] )
|
if ( mTextLocation != TextLocNone && mButtonText && mButtonText[0] )
|
||||||
|
|
@ -209,7 +206,7 @@ void GuiIconButtonCtrl::setBitmap(const char *name)
|
||||||
if(!isAwake())
|
if(!isAwake())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_setBitmap(getBitmap());
|
_setBitmap(name);
|
||||||
|
|
||||||
// So that extent is recalculated if autoSize is set.
|
// So that extent is recalculated if autoSize is set.
|
||||||
resize( getPosition(), getExtent() );
|
resize( getPosition(), getExtent() );
|
||||||
|
|
@ -299,13 +296,13 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
RectI iconRect( 0, 0, 0, 0 );
|
RectI iconRect( 0, 0, 0, 0 );
|
||||||
|
|
||||||
// Render the icon
|
// Render the icon
|
||||||
if ( mBitmap && mIconLocation != GuiIconButtonCtrl::IconLocNone )
|
if ( mBitmapAsset.notNull() && mIconLocation != GuiIconButtonCtrl::IconLocNone)
|
||||||
{
|
{
|
||||||
// Render the normal bitmap
|
// Render the normal bitmap
|
||||||
drawer->clearBitmapModulation();
|
drawer->clearBitmapModulation();
|
||||||
|
|
||||||
// Size of the bitmap
|
// Size of the bitmap
|
||||||
Point2I textureSize(mBitmap->getWidth(), mBitmap->getHeight());
|
Point2I textureSize(getBitmap()->getWidth(), getBitmap()->getHeight());
|
||||||
|
|
||||||
// Reduce the size with the margin (if set)
|
// Reduce the size with the margin (if set)
|
||||||
textureSize.x = textureSize.x - (mBitmapMargin * 2);
|
textureSize.x = textureSize.x - (mBitmapMargin * 2);
|
||||||
|
|
@ -332,7 +329,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
iconRect.point.y = offset.y + ( getHeight() - textureSize.y ) / 2;
|
iconRect.point.y = offset.y + ( getHeight() - textureSize.y ) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawer->drawBitmapStretch(mBitmap, iconRect );
|
drawer->drawBitmapStretch(getBitmap(), iconRect );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -366,7 +363,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
iconRect.point.y = offset.y + (getHeight() / 2) - (iconRect.extent.y / 2) + mButtonMargin.y;
|
iconRect.point.y = offset.y + (getHeight() / 2) - (iconRect.extent.y / 2) + mButtonMargin.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawer->drawBitmapStretch( mBitmap, iconRect );
|
drawer->drawBitmapStretch(getBitmap(), iconRect );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -383,7 +380,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
if ( mTextLocation == TextLocRight )
|
if ( mTextLocation == TextLocRight )
|
||||||
{
|
{
|
||||||
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
||||||
if (mBitmap && mIconLocation != IconLocNone )
|
if (mBitmapAsset.notNull() && mIconLocation != IconLocNone)
|
||||||
{
|
{
|
||||||
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
|
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
|
||||||
}
|
}
|
||||||
|
|
@ -403,7 +400,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
if ( mTextLocation == TextLocCenter )
|
if ( mTextLocation == TextLocCenter )
|
||||||
{
|
{
|
||||||
Point2I start;
|
Point2I start;
|
||||||
if (mBitmap && mIconLocation == IconLocLeft )
|
if (mBitmapAsset.notNull() && mIconLocation == IconLocLeft )
|
||||||
{
|
{
|
||||||
start.set( ( getWidth() - textWidth - iconRect.extent.x ) / 2 + iconRect.extent.x,
|
start.set( ( getWidth() - textWidth - iconRect.extent.x ) / 2 + iconRect.extent.x,
|
||||||
( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
||||||
|
|
@ -468,4 +465,4 @@ void GuiIconButtonCtrl::renderBitmapArray(RectI &bounds, S32 state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_ASSET_BINDS(GuiIconButtonCtrl, Bitmap);
|
DEF_ASSET_BINDS_REFACTOR(GuiIconButtonCtrl, Bitmap)
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
|
DECLARE_IMAGEASSET_REFACTOR(GuiIconButtonCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||||
DECLARE_ASSET_SETGET(GuiIconButtonCtrl, Bitmap);
|
|
||||||
|
|
||||||
S32 mIconLocation;
|
S32 mIconLocation;
|
||||||
S32 mTextLocation;
|
S32 mTextLocation;
|
||||||
|
|
|
||||||
|
|
@ -278,9 +278,6 @@ GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void)
|
||||||
mBackgroundCancel = false; // Added
|
mBackgroundCancel = false; // Added
|
||||||
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
||||||
|
|
||||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 0);
|
|
||||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 1);
|
|
||||||
|
|
||||||
mBitmapBounds.set(16, 16); // Added
|
mBitmapBounds.set(16, 16); // Added
|
||||||
mIdMax = -1;
|
mIdMax = -1;
|
||||||
mBackground = NULL;
|
mBackground = NULL;
|
||||||
|
|
@ -302,8 +299,7 @@ void GuiPopUpMenuCtrl::initPersistFields(void)
|
||||||
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrl));
|
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrl));
|
||||||
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrl));
|
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrl));
|
||||||
|
|
||||||
addProtectedField("bitmap", TypeImageFilename, Offset(mBitmapName, GuiPopUpMenuCtrl), _setBitmaps, defaultProtectedGetFn, "");
|
addProtectedField("BitmapAsset", TypeImageAssetPtrRefactor, Offset(mBitmapAsset, GuiPopUpMenuCtrl), _setBitmaps, &defaultProtectedGetFn, "@brief ""Bitmap"" ""asset \"\".");
|
||||||
addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiPopUpMenuCtrl), _setBitmaps, defaultProtectedGetFn, "");
|
|
||||||
|
|
||||||
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrl));
|
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrl));
|
||||||
|
|
||||||
|
|
@ -473,9 +469,6 @@ bool GuiPopUpMenuCtrl::onWake()
|
||||||
if ( !Parent::onWake() )
|
if ( !Parent::onWake() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set the bitmap for the popup.
|
|
||||||
setBitmap(getBitmap(Normal));
|
|
||||||
|
|
||||||
// Now update the Form Control's bitmap array, and possibly the child's too
|
// Now update the Form Control's bitmap array, and possibly the child's too
|
||||||
mProfile->constructBitmapArray();
|
mProfile->constructBitmapArray();
|
||||||
|
|
||||||
|
|
@ -592,8 +585,8 @@ void GuiPopUpMenuCtrl::setBitmap( const char *name )
|
||||||
dStrcpy(p, "_d", pLen);
|
dStrcpy(p, "_d", pLen);
|
||||||
_setBitmap((StringTableEntry)buffer, Depressed);
|
_setBitmap((StringTableEntry)buffer, Depressed);
|
||||||
|
|
||||||
if ( !mBitmap[Depressed] )
|
if ( mBitmapAsset[Depressed].isNull() )
|
||||||
mBitmap[Depressed] = mBitmap[Normal];
|
mBitmapAsset[Depressed] = mBitmapAsset[Normal];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -898,17 +891,17 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mBitmap[Depressed] )
|
if ( mBitmapAsset[Depressed].notNull() )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch( mBitmap[Depressed], rect );
|
drawUtil->drawBitmapStretch( getBitmap(Depressed), rect );
|
||||||
}
|
}
|
||||||
else if ( mBitmap[Normal] )
|
else if ( mBitmapAsset[Normal].notNull() )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch( mBitmap[Normal], rect );
|
drawUtil->drawBitmapStretch(getBitmap(Normal), rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
|
|
@ -948,11 +941,11 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mBitmap[Normal] )
|
if ( mBitmapAsset[Normal].notNull() )
|
||||||
{
|
{
|
||||||
RectI rect( offset, mBitmapBounds );
|
RectI rect( offset, mBitmapBounds );
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch( mBitmap[Normal], rect );
|
drawUtil->drawBitmapStretch(getBitmap(Normal) , rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
|
|
@ -984,11 +977,11 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mBitmap[Normal] )
|
if (mBitmapAsset[Normal].notNull())
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapStretch( mBitmap[Normal], rect );
|
drawUtil->drawBitmapStretch( getBitmap(Normal), rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,8 @@ protected:
|
||||||
NumBitmapModes = 2
|
NumBitmapModes = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, NumBitmapModes, onBitmapChanged);
|
DECLARE_IMAGEASSET_ARRAY_REFACTOR(GuiPopUpMenuCtrl, Bitmap, GFXDefaultGUIProfile, NumBitmapModes)
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrl, Bitmap);
|
|
||||||
void onBitmapChanged() {}
|
|
||||||
Point2I mBitmapBounds; // Added
|
Point2I mBitmapBounds; // Added
|
||||||
S32 mIdMax;
|
S32 mIdMax;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void)
|
||||||
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal");
|
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal");
|
||||||
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down");
|
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down");
|
||||||
|
|
||||||
INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(Bitmap, NumBitmapModes, GuiPopUpMenuCtrlEx, "Name of bitmap asset to use")
|
addProtectedField("BitmapAsset", TypeImageAssetPtrRefactor, Offset(mBitmapAsset, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "@brief ""Bitmap"" ""asset \"Name of bitmap asset to use\".");
|
||||||
|
|
||||||
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrlEx), "Boundaries of bitmap displayed");
|
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrlEx), "Boundaries of bitmap displayed");
|
||||||
addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx),
|
addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx),
|
||||||
|
|
@ -782,6 +782,14 @@ static S32 QSORT_CALLBACK idCompare(const void *a,const void *b)
|
||||||
return ( (ea->id < eb->id) ? -1 : ((ea->id > eb->id) ? 1 : 0) );
|
return ( (ea->id < eb->id) ? -1 : ((ea->id > eb->id) ? 1 : 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GuiPopUpMenuCtrlEx::_setBitmaps(void* obj, const char* index, const char* data)
|
||||||
|
{
|
||||||
|
GuiPopUpMenuCtrlEx* object = static_cast<GuiPopUpMenuCtrlEx*>(obj);
|
||||||
|
|
||||||
|
object->setBitmap(data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Added
|
// Added
|
||||||
void GuiPopUpMenuCtrlEx::setBitmap(const char *name)
|
void GuiPopUpMenuCtrlEx::setBitmap(const char *name)
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,8 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
|
||||||
virtual void removeChildren();
|
virtual void removeChildren();
|
||||||
virtual void repositionPopup();
|
virtual void repositionPopup();
|
||||||
|
|
||||||
|
static bool _setBitmaps(void* obj, const char* index, const char* data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiPopUpMenuCtrlEx(void);
|
GuiPopUpMenuCtrlEx(void);
|
||||||
~GuiPopUpMenuCtrlEx();
|
~GuiPopUpMenuCtrlEx();
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ bool GuiInspectorDynamicField::onAdd()
|
||||||
mParent->getId() );
|
mParent->getId() );
|
||||||
|
|
||||||
// FIXME Hardcoded image
|
// FIXME Hardcoded image
|
||||||
mDeleteButton->setField( "Bitmap", "ToolsModule:iconDelete_image" );
|
mDeleteButton->_setBitmap("ToolsModule:iconDelete_image");
|
||||||
mDeleteButton->setField( "Text", "X" );
|
mDeleteButton->setField( "Text", "X" );
|
||||||
mDeleteButton->setField( "Command", szBuffer );
|
mDeleteButton->setField( "Command", szBuffer );
|
||||||
mDeleteButton->setSizing( horizResizeLeft, vertResizeCenter );
|
mDeleteButton->setSizing( horizResizeLeft, vertResizeCenter );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue