Mercurial > LightClone
comparison LightClone/Source/ConfirmScreen.cpp @ 73:0574e2cf8bac
Additional screen types
author | koryspansel |
---|---|
date | Tue, 11 Oct 2011 17:44:10 -0700 |
parents | |
children | 40c0b5305de8 |
comparison
equal
deleted
inserted
replaced
72:9a9be3d8632e | 73:0574e2cf8bac |
---|---|
1 /* | |
2 * ConfirmScreen | |
3 */ | |
4 | |
5 #include "ConfirmScreen.h" | |
6 #include "ScreenManager.h" | |
7 | |
8 /* | |
9 * Initialize | |
10 */ | |
11 ErrorCode ConfirmScreen::Initialize(ServiceProvider* pServiceProvider) | |
12 { | |
13 ErrorCode eCode = kInterface.Initialize(pServiceProvider); | |
14 if(eCode == Error_Success) | |
15 { | |
16 pDialog = new ChoiceDialog(); | |
17 pDialog->Initialize(pServiceProvider); | |
18 pDialog->Subscribe(GuiDialog::EventResult, &ConfirmScreen::OnResult, this); | |
19 | |
20 const D3DXVECTOR2& kMessageSize = pDialog->GetDimensions(); | |
21 pDialog->SetPosition(0.5f * ((ScreenSizeX - 280) - kMessageSize.x), 0.5f * (ScreenSizeY - kMessageSize.y)); | |
22 } | |
23 | |
24 return Error_Success; | |
25 } | |
26 | |
27 /* | |
28 * Terminate | |
29 */ | |
30 void ConfirmScreen::Terminate() | |
31 { | |
32 kInterface.Terminate(); | |
33 | |
34 Screen::Terminate(); | |
35 } | |
36 | |
37 /* | |
38 * Update | |
39 */ | |
40 void ConfirmScreen::Update(float fElapsed) | |
41 { | |
42 kInterface.Update(fElapsed); | |
43 } | |
44 | |
45 /* | |
46 * Render | |
47 */ | |
48 void ConfirmScreen::Render(RenderContext& kContext) | |
49 { | |
50 kCameraController.SetMode(CameraMode_2D); | |
51 kInterface.Render(kContext, kCameraController); | |
52 } | |
53 | |
54 /* | |
55 * OnEnter | |
56 */ | |
57 void ConfirmScreen::OnEnter() | |
58 { | |
59 pDialog->SetFlag(GuiElementFlag_Visible); | |
60 } | |
61 | |
62 /* | |
63 * OnExit | |
64 */ | |
65 void ConfirmScreen::OnExit() | |
66 { | |
67 pDialog->ClearFlag(GuiElementFlag_Visible); | |
68 } | |
69 | |
70 /* | |
71 * OnResult | |
72 */ | |
73 void ConfirmScreen::OnResult(GuiEventArguments& kArguments) | |
74 { | |
75 GuiResultArguments& kResultArguments = (GuiResultArguments&)kArguments; | |
76 | |
77 if(kResultArguments.nResult == DialogResult_Yes) | |
78 { | |
79 pScreenManager->Set(NULL); | |
80 } | |
81 else | |
82 | |
83 if(kResultArguments.nResult == DialogResult_No) | |
84 { | |
85 pScreenManager->Pop(); | |
86 } | |
87 } |