forked from Breeze-del/C-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.cpp
67 lines (58 loc) · 1.27 KB
/
Card.cpp
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
// Card.cpp: implementation of the CCard class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Resource.h"
#include "Card.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCard::CCard()
{
}
CCard::~CCard()
{
}
void CCard::Draw(IplImage *bg, int sunnum)
{
for (int k = 0; k < 6; k++) {
if (m_card[k].m_isCd) {
m_card[k].Draw(bg, 0.7, 0.3, (double)m_card[k].Getm_timer() /(double) m_card[k].Getm_timerate());
}
else {
if (m_cost[k] <= sunnum) {
m_card[k].Draw(bg, 1);
}
else {
m_card[k].Draw(bg, 0.2);
}
}
}
}
void CCard::Init() //初始化卡片位置、冷却时间、花费.
{
int start_x = 89;
int start_y = 8;
for (int i = 0; i < 6; i++) {
m_card[i].m_img = CResource::m_cards[i];
m_card[i].m_isCd = false;
m_card[i].SetPos(start_x, start_y);
start_x += 51;
}
m_card[0].SetTimer(550);
m_card[1].SetTimer(500);
m_card[2].SetTimer(500);
m_card[3].SetTimer(350);
m_card[4].SetTimer(450);
m_card[5].SetTimer(600);
m_cost[0] = 175;
m_cost[1] = 50;
m_cost[2] = 100;
m_cost[3] = 50;
m_cost[4] = 50;
m_cost[5] = 150;
}
int CCard::Getm_cost(int num)
{
return m_cost[num];
}