-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathequipMent.cpp
More file actions
70 lines (59 loc) · 1.78 KB
/
Copy pathequipMent.cpp
File metadata and controls
70 lines (59 loc) · 1.78 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
59
60
61
62
63
64
65
66
67
68
69
70
#include "stdafx.h"
#include "equipMent.h"
HRESULT equipMent::init()
{
for (int i = 0; i < 7; i++) {
inventory_slot* inven = new inventory_slot;
inven->isCheck = false;
inven->_item = tagItem();
inven->x = 364 + i * 80;
inven->y = WINSIZEY / 2 + 15;
inven->count = 0;
inven->_rc = RectMake(inven->x, inven->y, 72, 72);
player_equip.push_back(inven);
}
player_equip[0]->_item = DATABASE->GetItem("pickaxe1");
_targetBox = new targetingBox;
_targetBox->init();
return S_OK;
}
void equipMent::release()
{
for (int i = 0; i < player_equip.size(); i++) {
SAFE_DELETE(player_equip[i]);
player_equip[i] = NULL;
}
player_equip.clear();
}
void equipMent::update()
{
_targetBox->update();
mouse_targetBox();
}
void equipMent::render(HDC hdc)
{
IMAGEMANAGER->alphaRender("inventory_background", hdc, 180);
IMAGEMANAGER->render("inventory_Kinds", hdc, WINSIZEX / 2 - 240, 15);
IMAGEMANAGER->render("Q", hdc, 320, 70);
IMAGEMANAGER->render("E", hdc, 890, 70);
IMAGEMANAGER->render("img_equip_icon", hdc, 411, 30);
IMAGEMANAGER->render("img_equip_slot", hdc, WINSIZEX / 2 - (IMAGEMANAGER->findImage("img_equip_slot")->getWidth() / 2), WINSIZEY / 2);
for (int i = 0; i < player_equip.size(); i++) {
if (player_equip[i]->_item.itemType == ItemType::NONE)continue;
IMAGEMANAGER->render("Img_UI_EquipmentSlotFilled", hdc, player_equip[i]->_rc.left, player_equip[i]->_rc.top);
IMAGEMANAGER->render(player_equip[i]->_item.slotImgKey, hdc, player_equip[i]->_rc.left + 15, player_equip[i]->_rc.top);
}
if (isCheck) {
_targetBox->render(hdc);
}
}
void equipMent::mouse_targetBox()
{
for (int i = 0; i < player_equip.size(); i++) {
if (PtInRect(&player_equip[i]->_rc, _ptMouse)) {
_targetBox->SetTarget(player_equip[i]->_rc, 2, i, 4, false);
isCheck = true;
break;
}
}
}