-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoor.cpp
More file actions
58 lines (52 loc) · 1.03 KB
/
door.cpp
File metadata and controls
58 lines (52 loc) · 1.03 KB
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
52
53
54
55
56
57
58
#include "stdafx.h"
#include "door.h"
HRESULT door::init()
{
_name = "door";
_image = IMAGEMANAGER->addFrameImage("door", L"images/object/door.png", 4, 2);
_rc.update(_position, _image->getFrameSize(), pivot::CENTER);
_moveRect.update(_position + Vector2(0, 20), Vector2(50, 50), pivot::CENTER);
_frameX = 0;
_isOpen = false;
_frameCount = 0;
switch (_type)
{
case 0:
//_nextSceneName = ""
break;
case 1:
break;
}
return S_OK;
}
void door::release()
{
}
void door::update()
{
_frameCount++;
if (_isOpen)
{
// 여기서 갈 수 있다면 프레임 렌더! 문 열리게끔
if (_frameCount % 5 == 0)
{
if (_frameX < _image->getMaxFrameX() - 1) ++_frameX;
_frameCount = 0;
}
}
else
{
if (_frameCount % 5 == 0)
{
if (_frameX != 0)
--_frameX;
_frameCount = 0;
}
}
}
void door::render()
{
if (_type == 1) _image->setAlpha(0.5f);
_image->frameRender(CAMERA->getRelativeVector2(_position), _frameX, _type);
//D2DRENDERER->DrawRotationFillRectangle(CAMERA->getRelativeRect(_moveRect), D2D1::ColorF::Beige, 0);
}