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,8 +59,6 @@ ConsoleDocClass( GuiMissionAreaCtrl,
GuiMissionAreaCtrl::GuiMissionAreaCtrl()
{
INIT_ASSET(HandleBitmap);
mHandleTextureSize = Point2I::Zero;
mHandleTextureHalfSize = Point2F::Zero;
@ -90,7 +88,7 @@ void GuiMissionAreaCtrl::initPersistFields()
docsURL;
addField( "squareBitmap", TypeBool, Offset(mSquareBitmap, GuiMissionAreaCtrl));
INITPERSISTFIELD_IMAGEASSET(HandleBitmap, GuiMissionAreaCtrl, "Bitmap for the mission area handles.\n");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(HandleBitmap, GuiMissionAreaCtrl, "Bitmap for the mission area handles.\n");
addField( "missionBoundsColor", TypeColorI, Offset(mMissionBoundsColor, GuiMissionAreaCtrl));
addField( "cameraColor", TypeColorI, Offset(mCameraColor, GuiMissionAreaCtrl));
@ -114,9 +112,9 @@ bool GuiMissionAreaCtrl::onAdd()
desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
mBlendStateBlock = GFX->createStateBlock( desc );
if (!mHandleBitmap.isNull())
if (!mHandleBitmapAsset.isNull())
{
mHandleTextureSize = Point2I(mHandleBitmap->getWidth(), mHandleBitmap->getHeight() );
mHandleTextureSize = Point2I(getHandleBitmap()->getWidth(), getHandleBitmap()->getHeight());
mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
}
else
@ -418,7 +416,7 @@ void GuiMissionAreaCtrl::setArea(const RectI & area)
void GuiMissionAreaCtrl::drawHandle(const Point2F & pos)
{
Point2F pnt(pos.x-mHandleTextureHalfSize.x, pos.y-mHandleTextureHalfSize.y);
GFX->getDrawUtil()->drawBitmap(mHandleBitmap, pnt);
GFX->getDrawUtil()->drawBitmap(getHandleBitmap(), pnt);
}
void GuiMissionAreaCtrl::drawHandles(RectI & box)

View file

@ -63,8 +63,7 @@ protected:
GFXStateBlockRef mBlendStateBlock;
GFXStateBlockRef mSolidStateBlock;
DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXDefaultGUIProfile);
DECLARE_ASSET_SETGET(GuiMissionAreaCtrl, HandleBitmap);
DECLARE_IMAGEASSET_REFACTOR(GuiMissionAreaCtrl, HandleBitmap, GFXDefaultGUIProfile)
Point2I mHandleTextureSize;
Point2F mHandleTextureHalfSize;
@ -110,8 +109,6 @@ protected:
bool testWithinHandle(const Point2I & testPoint, S32 handleX, S32 handleY);
S32 getHitHandles(const Point2I & mousePnt, const RectI & box);
void onHandleBitmapChanged() {}
public:
GuiMissionAreaCtrl();
virtual ~GuiMissionAreaCtrl();

View file

@ -1817,9 +1817,9 @@ WorldEditor::WorldEditor()
mPopupBackgroundColor.set(100,100,100);
mPopupTextColor.set(255,255,0);
mSelectHandleAssetId = StringTable->insert("ToolsModule:SelectHandle");
mDefaultHandleAssetId = StringTable->insert("ToolsModule:DefaultHandle");
mLockedHandleAssetId = StringTable->insert("ToolsModule:LockedHandle");
mSelectHandleAsset = StringTable->insert("ToolsModule:SelectHandle_image");
mDefaultHandleAsset = StringTable->insert("ToolsModule:DefaultHandle_image");
mLockedHandleAsset = StringTable->insert("ToolsModule:LockedHandle_image");
mObjectTextColor.set(255,255,255);
mObjectsUseBoxCenter = true;
@ -1905,9 +1905,9 @@ bool WorldEditor::onAdd()
// create the default class entry
mDefaultClassEntry.mName = 0;
mDefaultClassEntry.mIgnoreCollision = false;
mDefaultClassEntry.mDefaultHandle = mDefaultHandle;
mDefaultClassEntry.mSelectHandle = mSelectHandle;
mDefaultClassEntry.mLockedHandle = mLockedHandle;
mDefaultClassEntry.mDefaultHandle = getDefaultHandle();
mDefaultClassEntry.mSelectHandle = getSelectHandle();
mDefaultClassEntry.mLockedHandle = getLockedHandle();
if(!(mDefaultClassEntry.mDefaultHandle && mDefaultClassEntry.mSelectHandle && mDefaultClassEntry.mLockedHandle))
return false;
@ -2839,9 +2839,9 @@ void WorldEditor::initPersistFields()
addField( "renderObjHandle", TypeBool, Offset(mRenderObjHandle, WorldEditor) );
addField( "renderSelectionBox", TypeBool, Offset(mRenderSelectionBox, WorldEditor) );
INITPERSISTFIELD_IMAGEASSET(SelectHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET(DefaultHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET(LockedHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(SelectHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(DefaultHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(LockedHandle, WorldEditor, "");
endGroup( "Rendering" );

View file

@ -328,12 +328,9 @@ class WorldEditor : public EditTSCtrl
ColorI mPopupBackgroundColor;
ColorI mPopupTextColor;
DECLARE_IMAGEASSET(WorldEditor, SelectHandle, onSelectHandleChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(WorldEditor, SelectHandle);
DECLARE_IMAGEASSET(WorldEditor, DefaultHandle, onDefaultHandleChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(WorldEditor, DefaultHandle);
DECLARE_IMAGEASSET(WorldEditor, LockedHandle, onLockedHandleChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(WorldEditor, LockedHandle);
DECLARE_IMAGEASSET_REFACTOR(WorldEditor, SelectHandle, GFXStaticTextureSRGBProfile)
DECLARE_IMAGEASSET_REFACTOR(WorldEditor, DefaultHandle, GFXStaticTextureSRGBProfile)
DECLARE_IMAGEASSET_REFACTOR(WorldEditor, LockedHandle, GFXStaticTextureSRGBProfile)
ColorI mObjectTextColor;
bool mObjectsUseBoxCenter;
@ -425,10 +422,6 @@ class WorldEditor : public EditTSCtrl
void setEditorTool(EditorTool*);
EditorTool* getActiveEditorTool() { return mActiveEditorTool; }
void onSelectHandleChanged() {}
void onDefaultHandleChanged() {}
void onLockedHandleChanged() {}
};
typedef WorldEditor::DropType WorldEditorDropType;