[Add] IMGUI NineSlice를 하기 위한 준비

This commit is contained in:
fbtk
2025-11-13 19:20:04 +09:00
parent 842b025860
commit 5d1e540ea3
7 changed files with 125 additions and 10 deletions
@@ -64,7 +64,7 @@ struct PS_OUT
float4 vColor : SV_Target0; float4 vColor : SV_Target0;
}; };
PS_OUT PS_MAIN(PS_IN In) // ?쇰컲 UI PS_OUT PS_MAIN(PS_IN In) // ??곗뺘 UI
{ {
PS_OUT Out; PS_OUT Out;
@@ -134,6 +134,11 @@ void CIMGUIUI::Update(_float fTimeDelta)
m_bElementFadeOut = static_cast<CElementObject*>(m_pElementObject)->Get_FadeOut(); m_bElementFadeOut = static_cast<CElementObject*>(m_pElementObject)->Get_FadeOut();
m_fAlphaTime = static_cast<CElementObject*>(m_pElementObject)->Get_AlphaTime(); m_fAlphaTime = static_cast<CElementObject*>(m_pElementObject)->Get_AlphaTime();
m_UV = static_cast<CElementObject*>(m_pElementObject)->Get_UV(); m_UV = static_cast<CElementObject*>(m_pElementObject)->Get_UV();
m_fLeft = static_cast<CElementObject*>(m_pElementObject)->Get_Nine_Slice_Left();
m_fRight = static_cast<CElementObject*>(m_pElementObject)->Get_Nine_Slice_Right();
m_fTop = static_cast<CElementObject*>(m_pElementObject)->Get_Nine_Slice_Top();
m_fBottom = static_cast<CElementObject*>(m_pElementObject)->Get_Nine_Slice_Bottom();
} }
GUI::Begin("Current_PanelObject_Info"); GUI::Begin("Current_PanelObject_Info");
if (m_pGamePlay_Canvas != nullptr) if (m_pGamePlay_Canvas != nullptr)
@@ -306,6 +311,7 @@ void CIMGUIUI::Update(_float fTimeDelta)
static_cast<CElementObject*>(m_pElementObject)->SizeUpdate_float(m_fSizeXY); static_cast<CElementObject*>(m_pElementObject)->SizeUpdate_float(m_fSizeXY);
} }
GUI::Text("Time");
if (GUI::DragFloat("EndTime", &m_fEndTime, 0.01f, 0.f, 10.f)) if (GUI::DragFloat("EndTime", &m_fEndTime, 0.01f, 0.f, 10.f))
{ {
static_cast<CElementObject*>(m_pElementObject)->Set_TimeMult(m_fEndTime); static_cast<CElementObject*>(m_pElementObject)->Set_TimeMult(m_fEndTime);
@@ -326,6 +332,7 @@ void CIMGUIUI::Update(_float fTimeDelta)
static_cast<CElementObject*>(m_pElementObject)->Set_AlphaTime(m_fAlphaTime); static_cast<CElementObject*>(m_pElementObject)->Set_AlphaTime(m_fAlphaTime);
} }
GUI::Text("UV");
if (GUI::DragFloat("U", &m_UV.x, 0.01f, 0.f, 10.f)) if (GUI::DragFloat("U", &m_UV.x, 0.01f, 0.f, 10.f))
{ {
static_cast<CElementObject*>(m_pElementObject)->Set_U(m_UV.x); static_cast<CElementObject*>(m_pElementObject)->Set_U(m_UV.x);
@@ -335,6 +342,28 @@ void CIMGUIUI::Update(_float fTimeDelta)
{ {
static_cast<CElementObject*>(m_pElementObject)->Set_V(m_UV.y); static_cast<CElementObject*>(m_pElementObject)->Set_V(m_UV.y);
} }
GUI::Text("Nine_Slice");
if (GUI::DragFloat("Left", &m_fLeft, 0.1f, -m_fSize.x * 0.5f, m_fSize.x * 0.5f))
{
static_cast<CElementObject*>(m_pElementObject)->Nine_Slice_Left(m_fLeft);
}
if (GUI::DragFloat("Right", &m_fRight, 0.1f, -m_fSize.x * 0.5f, m_fSize.x * 0.5f))
{
static_cast<CElementObject*>(m_pElementObject)->Nine_Slice_Right(m_fRight);
}
if (GUI::DragFloat("Top", &m_fTop, 0.1f, -m_fSize.y * 0.5f, m_fSize.y * 0.5f))
{
static_cast<CElementObject*>(m_pElementObject)->Nine_Slice_Top(m_fTop);
}
if (GUI::DragFloat("Bottom", &m_fBottom, 0.1f, -m_fSize.y * 0.5f, m_fSize.y * 0.5f))
{
static_cast<CElementObject*>(m_pElementObject)->Nine_Slice_Bottom(m_fBottom);
}
} }
GUI::End(); GUI::End();
} }
+6
View File
@@ -46,6 +46,12 @@ class CIMGUIUI final : public CGameObject
_float m_fAlpha{}; _float m_fAlpha{};
_float2 m_UV{}; _float2 m_UV{};
_float m_fLeft{};
_float m_fRight{};
_float m_fTop{};
_float m_fBottom{};
_float4 m_fNineSlice{};
_float2 m_fPanelPos{}; _float2 m_fPanelPos{};
_float2 m_fPanelSize{}; _float2 m_fPanelSize{};
_float3 m_fPanelSizeXY{}; _float3 m_fPanelSizeXY{};
@@ -41,6 +41,7 @@ void CElementObject::Update(_float fTimeDelta)
0.f, 1.f)); 0.f, 1.f));
m_fCurrent_Posigion = XMVectorSet(m_fX, m_fY, 0.f, 1.f); m_fCurrent_Posigion = XMVectorSet(m_fX, m_fY, 0.f, 1.f);
m_vNine_Slice = _float4(-m_fSizeX * 0.5f + m_fLeft, m_fSizeX * 0.5f - m_fRight, -m_fSizeY * 0.5f + m_fTop, m_fSizeY * 0.5f - m_fBottom);
} }
void CElementObject::Late_Update(_float fTimeDelta) void CElementObject::Late_Update(_float fTimeDelta)
@@ -79,6 +80,46 @@ _bool CElementObject::Chack_Visible()
return m_bVisible; return m_bVisible;
} }
void CElementObject::Nine_Slice_Left(_float X)
{
m_fLeft = X;
}
void CElementObject::Nine_Slice_Right(_float Y)
{
m_fRight = Y;
}
void CElementObject::Nine_Slice_Top(_float Z)
{
m_fTop = Z;
}
void CElementObject::Nine_Slice_Bottom(_float W)
{
m_fBottom = W;
}
_float CElementObject::Get_Nine_Slice_Left()
{
return m_fLeft;
}
_float CElementObject::Get_Nine_Slice_Right()
{
return m_fRight;
}
_float CElementObject::Get_Nine_Slice_Top()
{
return m_fTop;
}
_float CElementObject::Get_Nine_Slice_Bottom()
{
return m_fBottom;
}
HRESULT CElementObject::Ready_Components(void* pArg) HRESULT CElementObject::Ready_Components(void* pArg)
{ {
return S_OK; return S_OK;
+31 -6
View File
@@ -83,7 +83,12 @@ HRESULT CUIObject::Initialize(void* pArg)
m_bVisible = true; m_bVisible = true;
m_vNine_Slice = XMVectorSet(-m_fSizeX * 0.5f, m_fSizeX * 0.5f, -m_fSizeY * 0.5f, m_fSizeY * 0.5f); m_fLeft = -m_fSizeX * 0.5f;
m_fRight = m_fSizeX * 0.5f;
m_fTop = -m_fSizeY * 0.5f;
m_fBottom = m_fSizeY * 0.5f;
m_vNine_Slice = _float4(m_fLeft, m_fRight, m_fTop, m_fBottom);
return S_OK; return S_OK;
} }
@@ -98,7 +103,7 @@ void CUIObject::Update(_float fTimeDelta)
m_vScale = _float3(m_fSizeX, m_fSizeY, 1.f); m_vScale = _float3(m_fSizeX, m_fSizeY, 1.f);
m_pTransformCom->Set_Scale(m_vScale); m_pTransformCom->Set_Scale(m_vScale);
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(m_fX - m_fWinSizeX * 0.5f,-m_fY + m_fWinSizeY * 0.5f,0.f, 1.f)); m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(m_fX - m_fWinSizeX * 0.5f, -m_fY + m_fWinSizeY * 0.5f, 0.f, 1.f));
m_fCurrent_Posigion = XMVectorSet(m_fX, m_fY, 0.f, 1.f); m_fCurrent_Posigion = XMVectorSet(m_fX, m_fY, 0.f, 1.f);
@@ -275,22 +280,42 @@ _float2 CUIObject::Get_UV()
void CUIObject::Nine_Slice_Left(_float X) void CUIObject::Nine_Slice_Left(_float X)
{ {
XMVectorSetX(m_vNine_Slice, X); m_fLeft = -m_fSizeX * 0.5f + X;
} }
void CUIObject::Nine_Slice_Right(_float Y) void CUIObject::Nine_Slice_Right(_float Y)
{ {
XMVectorSetY(m_vNine_Slice, Y); m_fRight = m_fSizeX * 0.5f - Y;
} }
void CUIObject::Nine_Slice_Top(_float Z) void CUIObject::Nine_Slice_Top(_float Z)
{ {
XMVectorSetZ(m_vNine_Slice, Z); m_fTop = -m_fSizeY * 0.5f + Z;
} }
void CUIObject::Nine_Slice_Bottom(_float W) void CUIObject::Nine_Slice_Bottom(_float W)
{ {
XMVectorSetW(m_vNine_Slice, W); m_fBottom = m_fSizeY * 0.5f - W;
}
_float CUIObject::Get_Nine_Slice_Left()
{
return m_fLeft;
}
_float CUIObject::Get_Nine_Slice_Right()
{
return m_fRight;
}
_float CUIObject::Get_Nine_Slice_Top()
{
return m_fTop;
}
_float CUIObject::Get_Nine_Slice_Bottom()
{
return m_fBottom;
} }
_float2 CUIObject::Get_Origin_Position() _float2 CUIObject::Get_Origin_Position()
@@ -21,7 +21,14 @@ class ENGINE_DLL CElementObject abstract : public CUIObject
public: public:
virtual void Visible(_bool bVisible) override; virtual void Visible(_bool bVisible) override;
virtual _bool Chack_Visible() override; virtual _bool Chack_Visible() override;
virtual void Nine_Slice_Left(_float X) override;
virtual void Nine_Slice_Right(_float Y) override;
virtual void Nine_Slice_Top(_float Z) override;
virtual void Nine_Slice_Bottom(_float W) override;
virtual _float Get_Nine_Slice_Left() override;
virtual _float Get_Nine_Slice_Right() override;
virtual _float Get_Nine_Slice_Top() override;
virtual _float Get_Nine_Slice_Bottom() override;
protected: protected:
virtual HRESULT Initialize_Prototype(); virtual HRESULT Initialize_Prototype();
+9 -2
View File
@@ -63,8 +63,11 @@ class ENGINE_DLL CUIObject abstract : public CGameObject
virtual void Nine_Slice_Right(_float Y); virtual void Nine_Slice_Right(_float Y);
virtual void Nine_Slice_Top(_float Z); virtual void Nine_Slice_Top(_float Z);
virtual void Nine_Slice_Bottom(_float W); virtual void Nine_Slice_Bottom(_float W);
virtual _float Get_Nine_Slice_Left();
virtual _float Get_Nine_Slice_Right();
virtual _float Get_Nine_Slice_Top();
virtual _float Get_Nine_Slice_Bottom();
public:
virtual _float2 Get_Origin_Position(); // Start Position virtual _float2 Get_Origin_Position(); // Start Position
virtual _vector Get_Current_Position(); // Current Position virtual _vector Get_Current_Position(); // Current Position
virtual _float3 Get_Origin_Size(); // Start Size virtual _float3 Get_Origin_Size(); // Start Size
@@ -103,7 +106,11 @@ class ENGINE_DLL CUIObject abstract : public CGameObject
RECT m_pRect{}; RECT m_pRect{};
_vector m_vNine_Slice{}; _float4 m_vNine_Slice{};
_float m_fLeft{};
_float m_fRight{};
_float m_fTop{};
_float m_fBottom{};
protected: protected:
virtual HRESULT Initialize_Prototype(); virtual HRESULT Initialize_Prototype();