-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.cpp
More file actions
51 lines (41 loc) · 906 Bytes
/
Copy pathButton.cpp
File metadata and controls
51 lines (41 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "stdafx.h"
Button::Button()
{
}
Button::~Button()
{
}
void Button::Render()
{
m_Sprite.OnRender();
}
void Button::Update(float deltatime)
{
Vector3 vPoint = KeyManager::GetInstance()->vMouse;
Vector3 vDelta = m_Sprite.m_Position - vPoint;
if (D3DXVec3Length(&vDelta) < m_fDataSize)
{
m_bIn = true;
if (m_bSizeUp == true)
{
m_Sprite.m_Scale = Vector2(1.5f, 1.5f);
m_Sprite.m_ScalePivot = Vector2((float)(m_Sprite.m_Texture.info.Width * 1.5), (float)(m_Sprite.m_Texture.info.Height * 1.5));
}
if (KeyManager::GetInstance()->GetKeyState(VK_LBUTTON) == EKEY_DOWN)
{
m_bIsDown = true;
}
else
m_bIsDown = false;
}
else
{
m_bIn = false;
m_bIsDown = false;
if (m_bSizeUp == true)
{
m_Sprite.m_Scale = Vector2(1.0f, 1.0f);
m_Sprite.m_ScalePivot = Vector2((float)(m_Sprite.m_Texture.info.Width), (float)(m_Sprite.m_Texture.info.Height));
}
}
}