mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
blatantly ganked from T2D; adds rotation as an option for drawbitmap
demonstrates a bit of usage in guibitmapctrl. (do note, gui elements may need followup via altering thier clip rect depending on how folks want to end up using this)
This commit is contained in:
parent
14ebeaf3eb
commit
d07d113246
4 changed files with 55 additions and 27 deletions
|
|
@ -58,6 +58,7 @@ ConsoleDocClass( GuiBitmapCtrl,
|
|||
GuiBitmapCtrl::GuiBitmapCtrl(void)
|
||||
: mStartPoint( 0, 0 ),
|
||||
mColor(ColorI::WHITE),
|
||||
mRotation(0),
|
||||
mWrap( false )
|
||||
{
|
||||
INIT_ASSET(Bitmap);
|
||||
|
|
@ -83,6 +84,8 @@ void GuiBitmapCtrl::initPersistFields()
|
|||
addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl),"color mul");
|
||||
addField( "wrap", TypeBool, Offset( mWrap, GuiBitmapCtrl ),
|
||||
"If true, the bitmap is tiled inside the control rather than stretched to fit." );
|
||||
|
||||
addField("rotation", TypeF32, Offset(mRotation, GuiBitmapCtrl), "rotation");
|
||||
|
||||
endGroup( "Bitmap" );
|
||||
|
||||
|
|
@ -187,14 +190,14 @@ void GuiBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
((texture->mBitmapSize.y*y)+offset.y)-yshift,
|
||||
texture->mBitmapSize.x,
|
||||
texture->mBitmapSize.y);
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(texture,dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear);
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear, mRotation);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RectI rect(offset, getExtent());
|
||||
GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false);
|
||||
GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false, mRotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ class GuiBitmapCtrl : public GuiControl
|
|||
|
||||
Point2I mStartPoint;
|
||||
ColorI mColor;
|
||||
|
||||
F32 mRotation;
|
||||
|
||||
/// If true, bitmap tiles inside control. Otherwise stretches.
|
||||
bool mWrap;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue