/
GGameOption.cpp
71 lines (61 loc) · 1.4 KB
/
GGameOption.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
#include "GGameDemoHeader.h"
#include "GGameOption.h"
#include "GEnumTypesStrings.h"
#include "GD9Device.h"
#include "Content.h"
GGameOption::GGameOption ( void )
: RenderBloom ( false )
{
FillMode = FillSolid;
Content::Device.mOnResetDevice += this;
}
GGameOption::~GGameOption ( void )
{
}
void GGameOption::registerAllProperty()
{
//__super::registerAllProperty();
__RegisterPropertyEnum ( FillMode );
__RegisterProperty ( RenderBloom );
}
void GGameOption::onPropertyChangeEnd ( void* cur )
{
__super::onPropertyChangeEnd ( cur );
if ( &FillMode == cur )
{
updateRenderState();
}
}
void GGameOption::updateRenderState()
{
switch ( FillMode )
{
case FillPoint:
Content::Device.getD9Device()->SetRenderState ( D3DRS_FILLMODE, D3DFILL_POINT );
break;
case FillSolid:
Content::Device.getD9Device()->SetRenderState ( D3DRS_FILLMODE, D3DFILL_SOLID );
break;
case FillWire:
Content::Device.getD9Device()->SetRenderState ( D3DRS_FILLMODE, D3DFILL_WIREFRAME );
break;
default:
break;
}
}
void GGameOption::onCallBack ( const CXDelegate& delegate, CXEventArgs* )
{
if ( delegate == Content::Device.mOnResetDevice )
{
updateRenderState();
}
}
void GGameOption::destroy()
{
Content::Device.mOnResetDevice -= this;
}
bool GGameOption::init()
{
updateRenderState();
return true;
}