gui types using image_asset

This commit is contained in:
marauder2k7 2024-12-21 23:02:23 +00:00
parent fa8110ce8f
commit f519cff6ff
25 changed files with 184 additions and 266 deletions

View file

@ -59,10 +59,6 @@ GuiGameSettingsCtrl::GuiGameSettingsCtrl() :
mCallbackOnB = mCallbackOnA;
mCallbackOnX = mCallbackOnA;
mCallbackOnY = mCallbackOnA;
INIT_ASSET(KeybindBitmap);
INIT_ASSET(PreviousBitmap);
INIT_ASSET(NextBitmap);
}
GuiGameSettingsCtrl::~GuiGameSettingsCtrl()
@ -193,7 +189,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
arrowOffset.y = currentOffset.y + arrowOffsetY;
drawer->clearBitmapModulation();
drawer->drawBitmapStretch(mPreviousBitmap, RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
drawer->drawBitmapStretch(getPreviousBitmap(), RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
}
else
{
@ -214,7 +210,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
arrowOffset.y = currentOffset.y + arrowOffsetY;
drawer->clearBitmapModulation();
drawer->drawBitmapStretch(mNextBitmap, RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
drawer->drawBitmapStretch(getNextBitmap(), RectI(arrowOffset, Point2I(mArrowSize, mArrowSize)), GFXBitmapFlip_None, GFXTextureFilterLinear, false);
}
else
{
@ -376,7 +372,7 @@ void GuiGameSettingsCtrl::onRenderKeybindOption(Point2I currentOffset)
{
RectI rect(button, buttonSize);
drawer->clearBitmapModulation();
drawer->drawBitmapStretch(mKeybindBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false);
drawer->drawBitmapStretch(getKeybindBitmap(), rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false);
}
//drawer->drawRectFill(button, ColorI::BLUE);
@ -454,22 +450,11 @@ bool GuiGameSettingsCtrl::onWake()
if( !Parent::onWake() )
return false;
_setNextBitmap(getNextBitmap());
_setPreviousBitmap(getPreviousBitmap());
_setKeybindBitmap(getKeybindBitmap());
return true;
}
void GuiGameSettingsCtrl::onSleep()
{
if (mNextBitmapAsset.notNull())
mNextBitmap = NULL;
if (mPreviousBitmapAsset.notNull())
mPreviousBitmap = NULL;
if (mKeybindBitmapAsset.notNull())
mKeybindBitmap = NULL;
Parent::onSleep();
}
@ -840,9 +825,9 @@ IMPLEMENT_CALLBACK(GuiGameSettingsCtrl, onAxisEvent, void, (const char* device,
void GuiGameSettingsCtrl::initPersistFields()
{
docsURL;
INITPERSISTFIELD_IMAGEASSET(KeybindBitmap, GuiGameSettingsCtrl, "Bitmap used to display the bound key for this keybind option.");
INITPERSISTFIELD_IMAGEASSET(PreviousBitmap, GuiGameSettingsCtrl, "Bitmap used for the previous button when in list mode.");
INITPERSISTFIELD_IMAGEASSET(NextBitmap, GuiGameSettingsCtrl, "Bitmap used for the next button when in list mode.");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(KeybindBitmap, GuiGameSettingsCtrl, "Bitmap used to display the bound key for this keybind option.");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(PreviousBitmap, GuiGameSettingsCtrl, "Bitmap used for the previous button when in list mode.");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(NextBitmap, GuiGameSettingsCtrl, "Bitmap used for the next button when in list mode.");
addField("arrowSize", TypeS32, Offset(mArrowSize, GuiGameSettingsCtrl),
"Size of the arrow buttons' extents");