mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-23 21:35:34 +00:00
gui types using image_asset
This commit is contained in:
parent
fa8110ce8f
commit
f519cff6ff
25 changed files with 184 additions and 266 deletions
|
|
@ -67,7 +67,7 @@ void GuiChunkedBitmapCtrl::initPersistFields()
|
|||
{
|
||||
docsURL;
|
||||
addGroup("GuiChunkedBitmapCtrl");
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiChunkedBitmapCtrl, "This is the bitmap to render to the control.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiChunkedBitmapCtrl, "This is the bitmap to render to the control.");
|
||||
|
||||
addField( "useVariable", TypeBool, Offset( mUseVariable, GuiChunkedBitmapCtrl ), "This decides whether to use the \"bitmap\" file "
|
||||
"or a bitmap stored in \"variable\"");
|
||||
|
|
@ -88,8 +88,6 @@ DefineEngineMethod( GuiChunkedBitmapCtrl, setBitmap, void, (const char* filename
|
|||
|
||||
GuiChunkedBitmapCtrl::GuiChunkedBitmapCtrl()
|
||||
{
|
||||
INIT_ASSET(Bitmap);
|
||||
|
||||
mUseVariable = false;
|
||||
mTile = false;
|
||||
}
|
||||
|
|
@ -112,16 +110,6 @@ bool GuiChunkedBitmapCtrl::onWake()
|
|||
if(!Parent::onWake())
|
||||
return false;
|
||||
|
||||
if( !mBitmap
|
||||
&& ( ( mBitmapName && mBitmapName[ 0 ] )
|
||||
|| ( mUseVariable && mConsoleVariable && mConsoleVariable[ 0 ] ) ) )
|
||||
{
|
||||
if ( mUseVariable )
|
||||
mBitmap.set( Con::getVariable( mConsoleVariable ), &GFXDefaultGUIProfile, avar("%s() - mTexHandle (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mBitmap.set( mBitmapName, &GFXDefaultGUIProfile, avar("%s() - mTexHandle (line %d)", __FUNCTION__, __LINE__) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -167,10 +155,10 @@ void GuiChunkedBitmapCtrl::renderRegion(const Point2I &offset, const Point2I &ex
|
|||
void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||
{
|
||||
|
||||
if( mBitmap )
|
||||
if( mBitmapAsset.notNull() )
|
||||
{
|
||||
RectI boundsRect( offset, getExtent());
|
||||
GFX->getDrawUtil()->drawBitmapStretch(mBitmap, boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear );
|
||||
GFX->getDrawUtil()->drawBitmapStretch(getBitmap(), boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear);
|
||||
}
|
||||
|
||||
renderChildControls(offset, updateRect);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ private:
|
|||
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET(GuiChunkedBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
|
||||
DECLARE_ASSET_SETGET(GuiChunkedBitmapCtrl, Bitmap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(GuiChunkedBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||
|
||||
bool mUseVariable;
|
||||
bool mTile;
|
||||
|
|
@ -38,6 +37,4 @@ public:
|
|||
void setBitmap(const char *name);
|
||||
|
||||
void onRender(Point2I offset, const RectI &updateRect) override;
|
||||
|
||||
void onImageChanged() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ GuiProgressBitmapCtrl::GuiProgressBitmapCtrl()
|
|||
mNumberOfBitmaps(0),
|
||||
mDim(0)
|
||||
{
|
||||
INIT_ASSET(Bitmap);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -132,7 +131,7 @@ GuiProgressBitmapCtrl::GuiProgressBitmapCtrl()
|
|||
void GuiProgressBitmapCtrl::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiProgressBitmapCtrl, "Bitmap file to use for rendering the progress bar.\n\n"
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Bitmap, GuiProgressBitmapCtrl, "Bitmap file to use for rendering the progress bar.\n\n"
|
||||
"If the profile assigned to the control already has a bitmap assigned, this property need not be "
|
||||
"set in which case the bitmap from the profile is used.");
|
||||
|
||||
|
|
|
|||
|
|
@ -47,21 +47,12 @@ class GuiProgressBitmapCtrl : public GuiTextCtrl
|
|||
|
||||
F32 mProgress;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiProgressBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
|
||||
DECLARE_ASSET_SETGET(GuiProgressBitmapCtrl, Bitmap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(GuiProgressBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||
|
||||
bool mUseVariable;
|
||||
bool mTile;
|
||||
S32 mNumberOfBitmaps;
|
||||
S32 mDim;
|
||||
|
||||
static bool _setBitmap( void* object, const char* index, const char* data )
|
||||
{
|
||||
static_cast< GuiProgressBitmapCtrl* >( object )->setBitmap( data );
|
||||
return false;
|
||||
}
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue