-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathAGArea.cpp
125 lines (92 loc) · 1.79 KB
/
AGArea.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// AGArea.cpp
//
// Implementation of AGArea class
#include <windows.h>
#include "Alchemy.h"
#include "DirectXUtil.h"
AGArea::AGArea (void) :
m_pScreen(NULL),
m_pController(NULL),
m_bVisible(true),
m_iEffectCount(0),
m_pEffects(NULL),
m_pParent(NULL)
// AGArea constructor
{
}
AGArea::~AGArea (void)
// AGArea destructor
{
if (m_pEffects)
delete [] m_pEffects;
}
void AGArea::AddEffect (const SEffectDesc &Effect)
// AddEffect
//
// Adds an effect
{
int i;
int iAlloc = m_iEffectCount + 1;
SEffectDesc *pNew = new SEffectDesc [iAlloc];
for (i = 0; i < m_iEffectCount; i++)
pNew[i] = m_pEffects[i];
pNew[i] = Effect;
if (m_pEffects)
delete [] m_pEffects;
m_pEffects = pNew;
m_iEffectCount = iAlloc;
}
void AGArea::AddShadowEffect (void)
// AddShadowEffect
//
// Adds a shadow effect
{
SEffectDesc Effect;
utlMemSet(&Effect, sizeof(Effect), 0);
Effect.iType = effectShadow;
AddEffect(Effect);
}
ALERROR AGArea::Init (AGScreen *pScreen, IAreaContainer *pParent, const RECT &rcRect, DWORD dwTag)
// Init
//
// This is called when the area is added to a screen
{
ASSERT(m_pScreen == NULL);
ASSERT(m_pParent == NULL);
m_pScreen = pScreen;
m_pParent = pParent;
m_dwTag = dwTag;
SetRect(rcRect);
return NOERROR;
}
void AGArea::SetRect (const RECT &rcRect)
// SetRect
//
// Set the rect
{
m_rcRect = rcRect;
OnSetRect();
m_pParent->OnAreaSetRect();
}
void AGArea::SignalAction (DWORD dwData)
// SignalAction
//
// Signals an action for this area
{
if (m_pController)
m_pController->Action(m_dwTag, dwData);
else
m_pScreen->GetController()->Action(m_dwTag, dwData);
}
void AGArea::ShowHide (bool bShow)
// ShowHide
//
// Shows or hides the area
{
if (bShow != m_bVisible)
{
m_bVisible = bShow;
Invalidate();
OnShowHide(bShow);
}
}