[Add] 이동하면 트레일 생성

This commit is contained in:
qordlsgur
2025-12-21 00:26:45 +09:00
parent e622256743
commit 97c69d018d
22 changed files with 760 additions and 195 deletions
@@ -66,11 +66,15 @@ Texture2D g_MaskingTexture;
int g_iHover;
int g_iClick;
int g_iColor;
int g_Count;
int g_iStep1 = 0;
int g_iStep2 = 0;
int g_iStep3 = 0;
float2 g_Trail[1000];
struct VS_IN
{
float3 vPosition : POSITION;
@@ -1795,33 +1799,45 @@ PS_OUT PS_SpellLearnColor(PS_IN In)
Color = tex;
Color.rgb *= tex1.rgb;
float2 rectPos = g_fPosition;
float2 rectPos = g_fPosition - float2(256.f,259.f);
float2 rectSize = g_fCurrent_Size;
float2 itemPos = g_fItemPosition1;
float2 itemSize = g_fItemImageSizes1;
float x0 = max(rectPos.x, itemPos.x);
float x1 = min(rectPos.x + rectSize.x, itemPos.x + itemSize.x);
float y0 = max(rectPos.y, itemPos.y);
float y1 = min(rectPos.y + rectSize.y, itemPos.y + itemSize.y);
float2 pixelPos;
pixelPos.x = rectPos.x + In.vTexcoord.x * rectSize.x;
pixelPos.y = rectPos.y + (1.0f - In.vTexcoord.y) * rectSize.y;
float uMin = (x0 - rectPos.x) / rectSize.x;
float uMax = (x1 - rectPos.x) / rectSize.x;
float vMin = (y0 - rectPos.y) / rectSize.y;
float vMax = (y1 - rectPos.y) / rectSize.y;
vMin = 1.0f - vMin;
vMax = 1.0f - vMax;
if (In.vTexcoord.x >= min(uMin, uMax) && In.vTexcoord.x <= max(uMin, uMax) &&
In.vTexcoord.y >= min(vMin, vMax) && In.vTexcoord.y <= max(vMin, vMax))
if (pixelPos.x >= itemPos.x &&
pixelPos.x <= itemPos.x + itemSize.x &&
pixelPos.y >= itemPos.y &&
pixelPos.y <= itemPos.y + itemSize.y)
{
Color.rgb = float3(0.f, 0.f, 1.f);
}
Color.a *= Alpha;
for (int i = 0; i < g_Count; ++i)
{
float2 trailTopLeft = g_Trail[i];
float2 trailCenter = trailTopLeft + itemSize / 2.0f;
float halfWidth = itemSize.x / 2.0f + 6.f;
float halfHeight = itemSize.y / 2.0f + 6.f;
if (pixelPos.x >= trailCenter.x - halfWidth &&
pixelPos.x <= trailCenter.x + halfWidth &&
pixelPos.y >= trailCenter.y - halfHeight &&
pixelPos.y <= trailCenter.y + halfHeight)
{
Color.rgb = float3(0.f, 144.f, 248.f) / 255.f;
break;
}
}
Color.
a *= Alpha;
Out.vColor = Color;
return Out;
}
@@ -57,7 +57,7 @@ void CSpellLearn_MovePointer::Set_SpellLearn(_int Index)
m_fY = m_pInfoInstance->Get_SpellLearn(Index).fStartPosition.y;
}
void CSpellLearn_MovePointer::Line(_float fTime)
void CSpellLearn_MovePointer::Line(_float fTime, _float2 fMouse)
{
m_vLerp_Position = m_MoveLine[m_iCurrentLine];
@@ -116,6 +116,17 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta)
}
}
POINT ptMouse{};
GetCursorPos(&ptMouse);
ScreenToClient(g_hWnd, &ptMouse);
_float2 fMouse{};
fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f);
fMouse.y = -ptMouse.y + (g_iWinSizeY * 0.5f);
_float2 fFinalMouse{};
fFinalMouse.x = fMouse.x - m_fX;
fFinalMouse.y = fMouse.y - m_fY;
if (m_pGameInstance->Key_Down(DIK_L))
{
m_bMoveStart = true;
@@ -123,21 +134,10 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta)
if (m_bMoveStart == true)
{
Line(fTimeDelta);
Line(fTimeDelta, fMouse);
}
POINT ptMouse{};
GetCursorPos(&ptMouse);
ScreenToClient(g_hWnd, &ptMouse);
_float2 fMouse;
fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f);
fMouse.y = -ptMouse.y + (g_iWinSizeY * 0.5f);
fMouse.x = fMouse.x - m_fX;
fMouse.y = fMouse.y - m_fY;
m_fAngle = atan2(-fMouse.x, fMouse.y);
m_fAngle = atan2(-fFinalMouse.x, fFinalMouse.y);
m_fTime += fTimeDelta * m_fTimeMult;
__super::Update(fTimeDelta);
@@ -34,7 +34,7 @@ class CSpellLearn_MovePointer final : public CElementObject
public:
void Set_SpellLearn(_int Index);
private:
void Line(_float fTime);
void Line(_float fTime, _float2 fMouse);
private:
@@ -2,24 +2,225 @@
<SpellLearnData>
<Name SpellName="봄바르다" ImageName="Bombarda" Size="550" x="730" y="200">
<Position>
<Pos x="625" y="60"/>
<Pos x="730" y="200"/>
</Position>
<Position>
<Pos x="810" y="-185"/>
<Pos x="707" y="170"/>
</Position>
<Position>
<Pos x="395" y="-185"/>
<Pos x="683.5" y="140"/>
</Position>
<Position>
<Pos x="515" y="-45"/>
<Pos x="668" y="120"/>
</Position>
<Position>
<Pos x="652.5" y="100"/>
</Position>
<Position>
<Pos x="636" y="80"/>
</Position>
<Position>
<Pos x="622" y="60"/>
</Position>
<Position>
<Pos x="636.5" y="40"/>
</Position>
<Position>
<Pos x="652" y="20"/>
</Position>
<Position>
<Pos x="666.5" y="0"/>
</Position>
<Position>
<Pos x="682.5" y="-20"/>
</Position>
<Position>
<Pos x="698" y="-40"/>
</Position>
<Position>
<Pos x="713.5" y="-60"/>
</Position>
<Position>
<Pos x="728.5" y="-80"/>
</Position>
<Position>
<Pos x="744" y="-100"/>
</Position>
<Position>
<Pos x="759" y="-120"/>
</Position>
<Position>
<Pos x="774.5" y="-140"/>
</Position>
<Position>
<Pos x="790" y="-160"/>
</Position>
<Position>
<Pos x="805.5" y="-180"/>
</Position>
<Position>
<Pos x="811.5" y="-189"/>
</Position>
<Position>
<Pos x="790" y="-187"/>
</Position>
<Position>
<Pos x="760" y="-187"/>
</Position>
<Position>
<Pos x="730" y="-187"/>
</Position>
<Position>
<Pos x="700" y="-187"/>
</Position>
<Position>
<Pos x="670" y="-187"/>
</Position>
<Position>
<Pos x="640" y="-187"/>
</Position>
<Position>
<Pos x="610" y="-187"/>
</Position>
<Position>
<Pos x="580" y="-187"/>
</Position>
<Position>
<Pos x="550" y="-187"/>
</Position>
<Position>
<Pos x="520" y="-187"/>
</Position>
<Position>
<Pos x="490" y="-187"/>
</Position>
<Position>
<Pos x="460" y="-187"/>
</Position>
<Position>
<Pos x="430" y="-187"/>
</Position>
<Position>
<Pos x="400" y="-187"/>
</Position>
<Position>
<Pos x="390" y="-187"/>
</Position>
<Position>
<Pos x="416" y="-157"/>
</Position>
<Position>
<Pos x="441.5" y="-130"/>
</Position>
<Position>
<Pos x="468" y="-100"/>
</Position>
<Position>
<Pos x="496" y="-70"/>
</Position>
<Position>
<Pos x="516" y="-50"/>
</Position>
<Position>
<Pos x="522" y="-42"/>
</Position>
</Name>
<Name SpellName="루모스" ImageName="Lumos" Size="520" x="410" y="-210">
<Name SpellName="루모스" ImageName="Lumos" Size="520" x="408.5" y="-218">
<Position>
<Pos x="600" y="200"/>
<Pos x="408.5" y="-218"/>
</Position>
<Position>
<Pos x="790" y="-230"/>
<Pos x="420" y="-192"/>
</Position>
<Position>
<Pos x="434.5" y="-160"/>
</Position>
<Position>
<Pos x="448" y="-130"/>
</Position>
<Position>
<Pos x="461.5" y="-100"/>
</Position>
<Position>
<Pos x="475" y="-70"/>
</Position>
<Position>
<Pos x="488.5" y="-40"/>
</Position>
<Position>
<Pos x="501.5" y="-10"/>
</Position>
<Position>
<Pos x="515" y="20"/>
</Position>
<Position>
<Pos x="529" y="50"/>
</Position>
<Position>
<Pos x="542" y="80"/>
</Position>
<Position>
<Pos x="556" y="110"/>
</Position>
<Position>
<Pos x="565" y="130"/>
</Position>
<Position>
<Pos x="574" y="150"/>
</Position>
<Position>
<Pos x="587" y="180"/>
</Position>
<Position>
<Pos x="598.5" y="205"/>
</Position>
<Position>
<Pos x="609.5" y="180"/>
</Position>
<Position>
<Pos x="622.5" y="150"/>
</Position>
<Position>
<Pos x="630.5" y="130"/>
</Position>
<Position>
<Pos x="640" y="110"/>
</Position>
<Position>
<Pos x="653.5" y="80"/>
</Position>
<Position>
<Pos x="666.5" y="50"/>
</Position>
<Position>
<Pos x="679.5" y="20"/>
</Position>
<Position>
<Pos x="693" y="-10"/>
</Position>
<Position>
<Pos x="706" y="-40"/>
</Position>
<Position>
<Pos x="719.5" y="-70"/>
</Position>
<Position>
<Pos x="732.5" y="-100"/>
</Position>
<Position>
<Pos x="746" y="-130"/>
</Position>
<Position>
<Pos x="759" y="-160"/>
</Position>
<Position>
<Pos x="772.5" y="-190"/>
</Position>
<Position>
<Pos x="785.5" y="-220"/>
</Position>
<Position>
<Pos x="791.5" y="-235"/>
</Position>
</Name>
<Name SpellName="아씨오" ImageName="Accio" Size="520" x="852" y="-120">
@@ -66,11 +66,15 @@ Texture2D g_MaskingTexture;
int g_iHover;
int g_iClick;
int g_iColor;
int g_Count;
int g_iStep1 = 0;
int g_iStep2 = 0;
int g_iStep3 = 0;
float2 g_Trail[1000];
struct VS_IN
{
float3 vPosition : POSITION;
@@ -1795,33 +1799,45 @@ PS_OUT PS_SpellLearnColor(PS_IN In)
Color = tex;
Color.rgb *= tex1.rgb;
float2 rectPos = g_fPosition;
float2 rectPos = g_fPosition - float2(256.f,259.f);
float2 rectSize = g_fCurrent_Size;
float2 itemPos = g_fItemPosition1;
float2 itemSize = g_fItemImageSizes1;
float x0 = max(rectPos.x, itemPos.x);
float x1 = min(rectPos.x + rectSize.x, itemPos.x + itemSize.x);
float y0 = max(rectPos.y, itemPos.y);
float y1 = min(rectPos.y + rectSize.y, itemPos.y + itemSize.y);
float2 pixelPos;
pixelPos.x = rectPos.x + In.vTexcoord.x * rectSize.x;
pixelPos.y = rectPos.y + (1.0f - In.vTexcoord.y) * rectSize.y;
float uMin = (x0 - rectPos.x) / rectSize.x;
float uMax = (x1 - rectPos.x) / rectSize.x;
float vMin = (y0 - rectPos.y) / rectSize.y;
float vMax = (y1 - rectPos.y) / rectSize.y;
vMin = 1.0f - vMin;
vMax = 1.0f - vMax;
if (In.vTexcoord.x >= min(uMin, uMax) && In.vTexcoord.x <= max(uMin, uMax) &&
In.vTexcoord.y >= min(vMin, vMax) && In.vTexcoord.y <= max(vMin, vMax))
if (pixelPos.x >= itemPos.x &&
pixelPos.x <= itemPos.x + itemSize.x &&
pixelPos.y >= itemPos.y &&
pixelPos.y <= itemPos.y + itemSize.y)
{
Color.rgb = float3(0.f, 0.f, 1.f);
}
Color.a *= Alpha;
for (int i = 0; i < g_Count; ++i)
{
float2 trailTopLeft = g_Trail[i];
float2 trailCenter = trailTopLeft + itemSize / 2.0f;
float halfWidth = itemSize.x / 2.0f + 6.f;
float halfHeight = itemSize.y / 2.0f + 6.f;
if (pixelPos.x >= trailCenter.x - halfWidth &&
pixelPos.x <= trailCenter.x + halfWidth &&
pixelPos.y >= trailCenter.y - halfHeight &&
pixelPos.y <= trailCenter.y + halfHeight)
{
Color.rgb = float3(0.f, 144.f, 248.f) / 255.f;
break;
}
}
Color.
a *= Alpha;
Out.vColor = Color;
return Out;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@@ -197,7 +197,7 @@ call Update_Shaders.bat
<ClInclude Include="..\public\Quest_Slot.h" />
<ClInclude Include="..\public\Quest_Status.h" />
<ClInclude Include="..\Public\Skill_Data.h" />
<ClInclude Include="..\public\SPellLeam_SpeedPointer.h" />
<ClInclude Include="..\public\SPellLeam_ChaserPointer.h" />
<ClInclude Include="..\Public\SpellLearn.h" />
<ClInclude Include="..\public\SpellLearn_Canvas.h" />
<ClInclude Include="..\public\SpellLearn_Data.h" />
@@ -422,7 +422,7 @@ call Update_Shaders.bat
<ClCompile Include="..\private\Quest_Slot.cpp" />
<ClCompile Include="..\private\Quest_Status.cpp" />
<ClCompile Include="..\Private\Skill_Data.cpp" />
<ClCompile Include="..\private\SPellLeam_SpeedPointer.cpp" />
<ClCompile Include="..\private\SPellLeam_ChaserPointer.cpp" />
<ClCompile Include="..\Private\SpellLearn.cpp" />
<ClCompile Include="..\private\SpellLearn_Canvas.cpp" />
<ClCompile Include="..\private\SpellLearn_Data.cpp" />
@@ -627,11 +627,11 @@
</Filter>
<Filter Include="80.State\Focus\Slide">
<UniqueIdentifier>{eef1db06-8a9f-42b4-93e2-cc29de2b275d}</UniqueIdentifier>
</Filter>
</Filter>
<Filter Include="50.UI\SpellLearn_Data">
<UniqueIdentifier>{6e769435-83c4-4f64-b306-1b8c5f2d228d}</UniqueIdentifier>
</Filter>
<Filter Include="50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_SpeedPointer">
<Filter Include="50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer">
<UniqueIdentifier>{54a92f0d-26f1-49bf-a13b-ab11995968c7}</UniqueIdentifier>
</Filter>
</ItemGroup>
@@ -1260,8 +1260,8 @@
<ClInclude Include="..\public\SpellLearn_Data.h">
<Filter>50.UI\SpellLearn_Data</Filter>
</ClInclude>
<ClInclude Include="..\public\SPellLeam_SpeedPointer.h">
<Filter>50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_SpeedPointer</Filter>
<ClInclude Include="..\public\SPellLeam_ChaserPointer.h">
<Filter>50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
@@ -1891,8 +1891,8 @@
<ClCompile Include="..\private\SpellLearn_Data.cpp">
<Filter>50.UI\SpellLearn_Data</Filter>
</ClCompile>
<ClCompile Include="..\private\SPellLeam_SpeedPointer.cpp">
<Filter>50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_SpeedPointer</Filter>
<ClCompile Include="..\private\SPellLeam_ChaserPointer.cpp">
<Filter>50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
@@ -118,6 +118,7 @@
#include "SpellLearn_Name.h"
#include "SpellLearn.h"
#include "SpellLearn_MovePointer.h"
#include "SPellLeam_ChaserPointer.h"
#include "IMGUIUI.h"
@@ -1233,6 +1234,10 @@ HRESULT CLoader::Loading_For_UI()
{
return E_FAIL;
}
if (FAILED(m_pGameInstance->Add_Prototype<CSPellLeam_ChaserPointer>(g_iStaticLevel, CSPellLeam_ChaserPointer::Create(m_pDevice, m_pContext))))
{
return E_FAIL;
}
if (FAILED(m_pGameInstance->Add_Prototype<CIMGUIUI>(g_iStaticLevel, CIMGUIUI::Create(m_pDevice, m_pContext))))
{
@@ -0,0 +1,302 @@
#include "pch.h"
#include "SPellLeam_ChaserPointer.h"
#include "GameInstance.h"
#include "SpellLearn_MovePointer.h"
CSPellLeam_ChaserPointer::CSPellLeam_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
:CElementObject(pDevice, pContext)
{
}
CSPellLeam_ChaserPointer::CSPellLeam_ChaserPointer(const CSPellLeam_ChaserPointer& rhs)
:CElementObject(rhs)
{
}
HRESULT CSPellLeam_ChaserPointer::Initialize_Prototype()
{
return S_OK;
}
HRESULT CSPellLeam_ChaserPointer::Initialize(void* pArg)
{
CUIObject::UIOBJECT_DESC Desc{};
Desc.fX = 476.f;
Desc.fY = -253.f;
Desc.fSizeX = 32.f;
Desc.fSizeY = 32.f;
m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) };
if (FAILED(__super::Initialize(&Desc)))
{
return E_FAIL;
}
if (FAILED(Ready_Components(pArg)))
{
return E_FAIL;
}
m_fTimeMult = 3.f;
m_fAlpha = 1.f;
m_fAlphaTime = 5.f;
m_fMoveSpeed = 140.f;
Set_SpellLearn(0);
Visible(false);
return S_OK;
}
void CSPellLeam_ChaserPointer::Priority_Update(_float fTimeDelta)
{
if (!__super::Chack_Visible())
{
return;
}
__super::Priority_Update(fTimeDelta);
}
void CSPellLeam_ChaserPointer::Update(_float fTimeDelta)
{
if (!__super::Chack_Visible())
{
return;
}
if (m_bFadeIn == true)
{
if (m_fAlpha <= 1.f)
{
m_fAlpha += fTimeDelta * m_fAlphaTime;
}
if (m_fAlpha >= 1.f)
{
m_bFadeIn = false;
m_fAlpha = 1.f;
}
}
if (m_bFadeOut == true)
{
if (m_fAlpha >= 0.f)
m_fAlpha -= fTimeDelta * m_fAlphaTime;;
if (m_fAlpha <= 0.f)
{
m_bFadeOut = false;
m_fAlpha = 0.f;
}
}
POINT ptMouse{};
GetCursorPos(&ptMouse);
ScreenToClient(g_hWnd, &ptMouse);
_float2 fMouse{};
fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f);
fMouse.y = -ptMouse.y + (g_iWinSizeY * 0.5f);
_float2 fFinalMouse{};
fFinalMouse.x = fMouse.x - m_fX;
fFinalMouse.y = fMouse.y - m_fY;
if (m_pGameInstance->Key_Down(DIK_L))
{
m_bMoveStart = true;
}
if (m_bMoveStart == true)
{
m_fTime += fTimeDelta * m_fTimeMult;
if (m_fTime >= 1.f)
{
m_bHover = true;
Line(fTimeDelta);
}
}
if (m_bHover == true)
{
_float Dir = XMVectorGetX(
XMVector3Length(
XMVectorSubtract(m_pPointer->Get_Current_Position(), m_fCurrent_Position)));
if (Dir <= 16.f)
{
_int a = 10;
}
}
m_fAngle = atan2(-fFinalMouse.x, fFinalMouse.y);
__super::Update(fTimeDelta);
}
void CSPellLeam_ChaserPointer::Late_Update(_float fTimeDelta)
{
if (!__super::Chack_Visible())
{
return;
}
if (m_bVisible) {
if (m_bHover == true)
{
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
}
__super::Late_Update(fTimeDelta);
}
}
HRESULT CSPellLeam_ChaserPointer::Render()
{
if (FAILED(Bind_ShaderResources())) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DEFAULT)))) {
return E_FAIL;
}
if (FAILED(m_pVIBufferCom->Bind_Resources())) {
return E_FAIL;
}
if (FAILED(m_pVIBufferCom->Render())) {
return E_FAIL;
}
return S_OK;
}
_vector CSPellLeam_ChaserPointer::Get_WorldPostion()
{
return m_pTransformCom->Get_State(STATE::POSITION);
}
void CSPellLeam_ChaserPointer::Set_SpellLearn(_int Index)
{
m_bHover = false;
m_bMoveStart = false;
m_fTime = 0.f;
m_iLineIndex = _int(static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).Lines.size());
m_MoveLine = static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).Lines;
m_iCurrentLine = 0;
m_fX = static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).fStartPosition.x;
m_fY = static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).fStartPosition.y;
}
void CSPellLeam_ChaserPointer::Set_Pointer(CSpellLearn_MovePointer* Pointer)
{
m_pPointer = Pointer;
}
void CSPellLeam_ChaserPointer::Line(_float fTime)
{
m_vLerp_Position = m_MoveLine[m_iCurrentLine];
if (Start_Lerp(fTime) == true)
{
if (m_iCurrentLine < m_iLineIndex - 1)
{
++m_iCurrentLine;
}
else
{
m_bMoveStart = false;
}
}
}
HRESULT CSPellLeam_ChaserPointer::Bind_ShaderResources()
{
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix")))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix)))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix)))
{
return E_FAIL;
}
if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float))))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTime, sizeof(_float))))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fAlpha", &m_fAlpha, sizeof(_float))))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fOwnerAlpha", &m_fOwnerAlpha, sizeof(_float))))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fCanvasAlpha", &m_fCanvasAlpha, sizeof(_float))))
{
return E_FAIL;
}
return S_OK;
}
HRESULT CSPellLeam_ChaserPointer::Ready_Components(void* pArg)
{
if (FAILED(Add_Component<CVIBuffer_Rect>(g_iStaticLevel, &m_pVIBufferCom)))
{
return E_FAIL;
}
if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_SpellMinigame_SpeedBurstDropBack"), reinterpret_cast<CComponent**>(&m_pDiffuse_TextureCom), nullptr)))
{
return E_FAIL;
}
if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr)))
{
return E_FAIL;
}
return S_OK;
}
CSPellLeam_ChaserPointer* CSPellLeam_ChaserPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CSPellLeam_ChaserPointer* pInstance = new CSPellLeam_ChaserPointer(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CSPellLeam_ChaserPointer");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CSPellLeam_ChaserPointer::Clone(void* pArg, CGameObject* pOwner)
{
CSPellLeam_ChaserPointer* pInstance = new CSPellLeam_ChaserPointer(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CSPellLeam_ChaserPointer");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CSPellLeam_ChaserPointer::Free()
{
__super::Free();
SAFE_RELEASE(m_pDiffuse_TextureCom);
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pVIBufferCom);
}
void CSPellLeam_ChaserPointer::Describe_Entity()
{
}
@@ -1,96 +0,0 @@
#include "pch.h"
#include "SPellLeam_SpeedPointer.h"
#include "GameInstance.h"
CSPellLeam_SpeedPointer::CSPellLeam_SpeedPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
:CElementObject(pDevice, pContext)
{
}
CSPellLeam_SpeedPointer::CSPellLeam_SpeedPointer(const CSPellLeam_SpeedPointer& rhs)
:CElementObject(rhs)
{
}
HRESULT CSPellLeam_SpeedPointer::Initialize_Prototype()
{
return S_OK;
}
HRESULT CSPellLeam_SpeedPointer::Initialize(void* pArg)
{
CUIObject::UIOBJECT_DESC Desc{};
Desc.fX = 476.f;
Desc.fY = -253.f;
Desc.fSizeX = 32.f;
Desc.fSizeY = 32.f;
m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) };
if (FAILED(__super::Initialize(&Desc)))
{
return E_FAIL;
}
if (FAILED(Ready_Components(pArg)))
{
return E_FAIL;
}
m_fTimeMult = 3.f;
m_fAlpha = 1.f;
m_fAlphaTime = 5.f;
m_fMoveSpeed = 15.f;
m_fAngle = XMConvertToRadians(0);
Visible(false);
return S_OK;
}
void CSPellLeam_SpeedPointer::Priority_Update(_float fTimeDelta)
{
}
void CSPellLeam_SpeedPointer::Update(_float fTimeDelta)
{
}
void CSPellLeam_SpeedPointer::Late_Update(_float fTimeDelta)
{
}
HRESULT CSPellLeam_SpeedPointer::Render()
{
return S_OK;
}
_vector CSPellLeam_SpeedPointer::Get_WorldPostion()
{
return _vector();
}
HRESULT CSPellLeam_SpeedPointer::Bind_ShaderResources()
{
return S_OK;
}
HRESULT CSPellLeam_SpeedPointer::Ready_Components(void* pArg)
{
return S_OK;
}
CSPellLeam_SpeedPointer* CSPellLeam_SpeedPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
return nullptr;
}
CGameObject* CSPellLeam_SpeedPointer::Clone(void* pArg, CGameObject* pOwner)
{
return nullptr;
}
void CSPellLeam_SpeedPointer::Free()
{
}
void CSPellLeam_SpeedPointer::Describe_Entity()
{
}
+39 -8
View File
@@ -40,6 +40,7 @@ HRESULT CSpellLearn::Initialize(void* pArg)
m_fTimeMult = 3.f;
m_fAlpha = 1.f;
m_fAlphaTime = 5.f;
m_iTrailIndex = 0;
Change_Image(0);
Visible(false);
return S_OK;
@@ -86,7 +87,27 @@ void CSpellLearn::Update(_float fTimeDelta)
}
}
m_fTime += fTimeDelta * m_fTimeMult;
if (m_pPointer != nullptr)
{
if (m_pPointer->Get_bMoveStart() == true)
{
m_vPointerPosition = m_pPointer->Get_Position();
m_vPointerScale = m_pPointer->Get_Current_Size();
m_fTime += fTimeDelta * m_fTimeMult;
if (m_fTime >= 1.f)
{
m_Trail.push_back(m_vPointerPosition);
m_iTrailIndex++;
}
}
else
{
}
}
__super::Update(fTimeDelta);
}
@@ -98,11 +119,7 @@ void CSpellLearn::Late_Update(_float fTimeDelta)
}
if (m_bVisible) {
if (m_pPointer != nullptr)
{
m_vPointerPosition = m_pPointer->Get_Position();
m_vPointerScale = m_pPointer->Get_Current_Size();
}
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
__super::Late_Update(fTimeDelta);
}
}
@@ -188,7 +205,18 @@ HRESULT CSpellLearn::Bind_ShaderResources()
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_Trail", m_Trail.data(), sizeof(_float2) * _uint(m_Trail.size()))))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_Count", &m_iTrailIndex, sizeof(_int))))
{
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_iHover", &m_bHover, sizeof(_bool))))
{
return E_FAIL;
}
return S_OK;
}
@@ -216,9 +244,12 @@ HRESULT CSpellLearn::Ready_Components(void* pArg)
HRESULT CSpellLearn::Change_Image(_int SpellID)
{
m_Trail.clear();
m_Trail.push_back(_float2(0.f,0.f));
m_iTrailIndex = 0;
_wstring pName = TEXT("Prototype_Texture_");
_wstring pImageName = pName + static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(SpellID).pImageName;
m_MoveLine = static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(SpellID).Lines;
if (m_pDiffuse_TextureCom)
{
Remove_Component<CTexture>();
@@ -39,7 +39,7 @@ HRESULT CSpellLearn_MovePointer::Initialize(void* pArg)
m_fTimeMult = 3.f;
m_fAlpha = 1.f;
m_fAlphaTime = 5.f;
m_fMoveSpeed = 15.f;
m_fMoveSpeed = 130.f;
Set_SpellLearn(0);
m_fAngle = XMConvertToRadians(0);
Visible(false);
@@ -48,6 +48,7 @@ HRESULT CSpellLearn_MovePointer::Initialize(void* pArg)
void CSpellLearn_MovePointer::Set_SpellLearn(_int Index)
{
m_bMoveStart = false;
m_iLineIndex = _int(static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).Lines.size());
m_MoveLine = static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).Lines;
m_iCurrentLine = 0;
@@ -55,15 +56,26 @@ void CSpellLearn_MovePointer::Set_SpellLearn(_int Index)
m_fY = static_cast<CUIObject*>(m_pOwner)->Get_Learninfo(Index).fStartPosition.y;
}
void CSpellLearn_MovePointer::Line(_float fTime)
_int CSpellLearn_MovePointer::Get_SpellTrail()
{
return m_iCurrentLine;
}
_bool CSpellLearn_MovePointer::Get_bMoveStart()
{
return m_bMoveStart;
}
void CSpellLearn_MovePointer::Line(_float fTime, _float2 fMouse)
{
m_vLerp_Position = m_MoveLine[m_iCurrentLine];
if (Start_Lerp(m_fMoveSpeed * fTime) == true)
if (Start_Lerp_Speed(fTime, fMouse) == true)
{
if (m_iCurrentLine < m_iLineIndex - 1)
{
++m_iCurrentLine;
m_fPerPosition = _float2(m_MoveLine[m_iCurrentLine - 1].m128_f32[0], m_MoveLine[m_iCurrentLine - 1].m128_f32[1]);
}
else
{
@@ -114,6 +126,17 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta)
}
}
POINT ptMouse{};
GetCursorPos(&ptMouse);
ScreenToClient(g_hWnd, &ptMouse);
_float2 fMouse{};
fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f);
fMouse.y = -ptMouse.y + (g_iWinSizeY * 0.5f);
_float2 fFinalMouse{};
fFinalMouse.x = fMouse.x - m_fX;
fFinalMouse.y = fMouse.y - m_fY;
if (m_pGameInstance->Key_Down(DIK_L))
{
m_bMoveStart = true;
@@ -121,21 +144,10 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta)
if (m_bMoveStart == true)
{
Line(fTimeDelta);
Line(fTimeDelta, fMouse);
}
POINT ptMouse{};
GetCursorPos(&ptMouse);
ScreenToClient(g_hWnd, &ptMouse);
_float2 fMouse;
fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f);
fMouse.y = -ptMouse.y + (g_iWinSizeY * 0.5f);
fMouse.x = fMouse.x - m_fX;
fMouse.y = fMouse.y - m_fY;
m_fAngle = atan2(-fMouse.x, fMouse.y);
m_fAngle = atan2(-fFinalMouse.x, fFinalMouse.y);
m_fTime += fTimeDelta * m_fTimeMult;
__super::Update(fTimeDelta);
@@ -4,6 +4,7 @@
#include "SpellLearn_Name.h"
#include "SpellLearn.h"
#include "SpellLearn_MovePointer.h"
#include "SPellLeam_ChaserPointer.h"
#include "SpellLearn_Data.h"
CSpellLearn_Panel::CSpellLearn_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
@@ -46,6 +47,7 @@ HRESULT CSpellLearn_Panel::Initialize(void* pArg)
m_fSortZ = 0.05f;
m_fDelayTime = 1.f;
static_cast<CSpellLearn*>(m_pSpellLearn)->Set_Pointer(static_cast<CSpellLearn_MovePointer*>(m_pSpellLearn_MovePointer));
static_cast<CSPellLeam_ChaserPointer*>(m_pSPellLeam_ChaserPointer)->Set_Pointer(static_cast<CSpellLearn_MovePointer*>(m_pSpellLearn_MovePointer));
Visible(true);
ElementAllVisible(true);
return S_OK;
@@ -84,6 +86,7 @@ void CSpellLearn_Panel::Update(_float fTimeDelta)
}
static_cast<CSpellLearn*>(m_pSpellLearn)->Change_Image(Index);
static_cast<CSpellLearn_MovePointer*>(m_pSpellLearn_MovePointer)->Set_SpellLearn(Index);
static_cast<CSPellLeam_ChaserPointer*>(m_pSPellLeam_ChaserPointer)->Set_SpellLearn(Index);
static_cast<CSpellLearn_Name*>(m_pSpellLearn_Name)->Set_Name(Index);
}
@@ -213,6 +216,12 @@ HRESULT CSpellLearn_Panel::Ready_Element(void* pArg)
}
Add_Element(TEXT("SpellLearn_MovePointer"), m_pSpellLearn_MovePointer);
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CSPellLeam_ChaserPointer>(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast<CSPellLeam_ChaserPointer**>(&m_pSPellLeam_ChaserPointer))))
{
return E_FAIL;
}
Add_Element(TEXT("SPellLeam_ChaserPointer"), m_pSPellLeam_ChaserPointer);
return S_OK;
}
@@ -5,12 +5,12 @@
NS_BEGIN(Editor)
class CSPellLeam_SpeedPointer final : public CElementObject
class CSPellLeam_ChaserPointer final : public CElementObject
{
private:
CSPellLeam_SpeedPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CSPellLeam_SpeedPointer(const CSPellLeam_SpeedPointer& rhs);
virtual ~CSPellLeam_SpeedPointer() = default;
CSPellLeam_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CSPellLeam_ChaserPointer(const CSPellLeam_ChaserPointer& rhs);
virtual ~CSPellLeam_ChaserPointer() = default;
public:
virtual void Priority_Update(_float fTimeDelta);
@@ -25,13 +25,29 @@ class CSPellLeam_SpeedPointer final : public CElementObject
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
public:
void Set_SpellLearn(_int Index);
void Set_Pointer(class CSpellLearn_MovePointer* Pointer);
private:
void Line(_float fTime);
private:
CTexture* m_pDiffuse_TextureCom = { nullptr };
CShader* m_pShaderCom = { nullptr };
CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
class CSpellLearn_MovePointer* m_pPointer = { nullptr };
_bool m_bMoveStart = { false };
_int m_iLineIndex{};
_int m_iCurrentLine{};
vector<_vector> m_MoveLine;
public:
static CSPellLeam_SpeedPointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
static CSPellLeam_ChaserPointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
void Describe_Entity() override;
@@ -38,6 +38,12 @@ class CSpellLearn final : public CElementObject
_float2 m_vPointerPosition{};
_float3 m_vPointerScale{};
_int m_iIndex{};
vector<_float2> m_Trail;
_int m_iTrailIndex{};
vector<_vector> m_MoveLine;
public:
static CSpellLearn* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
@@ -27,9 +27,10 @@ class CSpellLearn_MovePointer final : public CElementObject
public:
void Set_SpellLearn(_int Index);
_int Get_SpellTrail();
_bool Get_bMoveStart();
private:
void Line(_float fTime);
void Line(_float fTime, _float2 fMouse);
private:
@@ -45,6 +45,7 @@ class CSpellLearn_Panel final : public CPanelObject
CGameObject* m_pSpellLearn_Name = { nullptr };
CGameObject* m_pSpellLearn = { nullptr };
CGameObject* m_pSpellLearn_MovePointer = { nullptr };
CGameObject* m_pSPellLeam_ChaserPointer = { nullptr };
CGameObject* m_pSpellLearn_Data = { nullptr };
_int Index{};
@@ -158,6 +158,42 @@ _bool CElementObject::Start_Lerp(_float fTimeDelta)
}
}
_bool CElementObject::Start_Lerp_Speed(_float fTimeDelta, _float2 MousePoint)
{
_vector Mouse = XMVectorSet(MousePoint.x, MousePoint.y, 1.f, 1.f);
_vector Pos = m_fCurrent_Position;
_vector Target = m_vLerp_Position;
_vector Dir = XMVectorSubtract(Target, Pos);
_vector MouseDir = XMVectorSubtract(Mouse, Pos);
_vector NorDir = XMVector3Normalize(Dir);
_vector NorMouse = XMVector3Normalize(MouseDir);
_float SameDir = XMVectorGetX(XMVector3Dot(NorDir, NorMouse));
_float Weight = max(0.5f, SameDir);
_vector LenVec = XMVector3Length(Dir);
_float Distance = XMVectorGetX(LenVec);
_float move = m_fMoveSpeed * fTimeDelta * Weight;
if (Distance <= move)
{
m_fX = m_vLerp_Position.m128_f32[0];
m_fY = m_vLerp_Position.m128_f32[1];
return true;
}
else
{
m_fPerPosition = _float2(m_fX, m_fY);
XMVECTOR DirNorm = XMVector3Normalize(Dir);
m_fX = (Pos + DirNorm * move).m128_f32[0];
m_fY = (Pos + DirNorm * move).m128_f32[1];
return false;
}
}
void CElementObject::Reset_Pos(_float fTimeDelta)
{
_vector Pos = m_fCurrent_Position;
+6 -1
View File
@@ -377,7 +377,7 @@ _bool CUIObject::Start_Lerp(_float fTimeDelta)
return false;
}
_bool CUIObject::Start_Bezier(_float fTimeDelta)
_bool CUIObject::Start_Lerp_Speed(_float fTimeDelta, _float2 Mouse_Point)
{
return _bool();
}
@@ -538,6 +538,11 @@ _float2 CUIObject::Get_Font()
return _float2(m_fFontX, m_fFontY);
}
_float2 CUIObject::Get_PerPosition()
{
return m_fPerPosition;
}
void CUIObject::Free()
{
__super::Free();
@@ -31,6 +31,7 @@ class ENGINE_DLL CElementObject abstract : public CUIObject
virtual _float Get_Nine_Slice_Bottom() override;
virtual _bool Start_Lerp(_float fTimeDelta) override;
virtual _bool Start_Lerp_Speed(_float fTimeDelta, _float2 MousePoint) override;
virtual void Reset_Pos(_float fTimeDelta)override;
virtual void Start_Size_Lerp(_float fTimeDelta) override;
virtual void Reset_Size_Lerp(_float fTimeDelta) override;
+4 -1
View File
@@ -152,7 +152,7 @@ typedef struct tagSpellLearnInfo
virtual void Lerp_PosX(_float PosX);
virtual void Lerp_PosY(_float PosY);
virtual _bool Start_Lerp(_float fTimeDelta);
virtual _bool Start_Bezier(_float fTimeDelta);
virtual _bool Start_Lerp_Speed(_float fTimeDelta, _float2 Mouse_Point);
virtual void Reset_Pos(_float fTimeDelta);
virtual void Start_Size_Lerp(_float fTimeDelta);
virtual void Reset_Size_Lerp(_float fTimeDelta);
@@ -190,6 +190,7 @@ typedef struct tagSpellLearnInfo
virtual void Set_FontX(_float fFontX);
virtual void Set_FontY(_float fFontY);
virtual _float2 Get_Font();
virtual _float2 Get_PerPosition();
protected:
_vector m_fOrigin_Position_vector{};
_float2 m_fOrigin_Position{};
@@ -246,6 +247,8 @@ typedef struct tagSpellLearnInfo
_float m_fFontX{};
_float m_fFontY{};
_float m_fFontOffSet{};
_float2 m_fPerPosition{};
protected:
virtual HRESULT Initialize_Prototype();
virtual HRESULT Initialize(void* pArg);