summaryrefslogtreecommitdiffhomepage
path: root/Stars45/ExitDlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/ExitDlg.cpp')
-rw-r--r--Stars45/ExitDlg.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/Stars45/ExitDlg.cpp b/Stars45/ExitDlg.cpp
index 189928a..e3e8519 100644
--- a/Stars45/ExitDlg.cpp
+++ b/Stars45/ExitDlg.cpp
@@ -1,14 +1,14 @@
/* Project Starshatter 4.5
- Destroyer Studios LLC
- Copyright © 1997-2004. All Rights Reserved.
+ Destroyer Studios LLC
+ Copyright © 1997-2004. All Rights Reserved.
- SUBSYSTEM: Stars.exe
- FILE: ExitDlg.cpp
- AUTHOR: John DiCamillo
+ SUBSYSTEM: Stars.exe
+ FILE: ExitDlg.cpp
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
+ OVERVIEW
+ ========
*/
#include "MemDebug.h"
@@ -33,12 +33,12 @@ DEF_MAP_CLIENT(ExitDlg, OnCancel);
// +--------------------------------------------------------------------+
ExitDlg::ExitDlg(Screen* s, FormDef& def, MenuScreen* mgr)
- : FormWindow(s, 0, 0, s->Width(), s->Height()),
- manager(mgr), exit_latch(false),
- credits(0), apply(0), cancel(0),
- def_rect(def.GetRect())
+: FormWindow(s, 0, 0, s->Width(), s->Height()),
+manager(mgr), exit_latch(false),
+credits(0), apply(0), cancel(0),
+def_rect(def.GetRect())
{
- Init(def);
+ Init(def);
}
ExitDlg::~ExitDlg()
@@ -48,16 +48,16 @@ ExitDlg::~ExitDlg()
void
ExitDlg::RegisterControls()
{
- if (apply)
- return;
+ if (apply)
+ return;
- credits = (RichTextBox*) FindControl(201);
+ credits = (RichTextBox*) FindControl(201);
- apply = (Button*) FindControl(1);
- REGISTER_CLIENT(EID_CLICK, apply, ExitDlg, OnApply);
+ apply = (Button*) FindControl(1);
+ REGISTER_CLIENT(EID_CLICK, apply, ExitDlg, OnApply);
- cancel = (Button*) FindControl(2);
- REGISTER_CLIENT(EID_CLICK, cancel, ExitDlg, OnCancel);
+ cancel = (Button*) FindControl(2);
+ REGISTER_CLIENT(EID_CLICK, cancel, ExitDlg, OnCancel);
}
// +--------------------------------------------------------------------+
@@ -65,25 +65,25 @@ ExitDlg::RegisterControls()
void
ExitDlg::ExecFrame()
{
- if (credits && credits->GetLineCount() > 0) {
- credits->SmoothScroll(ScrollWindow::SCROLL_DOWN, Game::GUITime());
-
- if (credits->GetTopIndex() >= credits->GetLineCount()-1) {
- credits->ScrollTo(0);
- }
- }
-
- if (Keyboard::KeyDown(VK_RETURN)) {
- OnApply(0);
- }
-
- if (Keyboard::KeyDown(VK_ESCAPE)) {
- if (!exit_latch)
- OnCancel(0);
- }
- else {
- exit_latch = false;
- }
+ if (credits && credits->GetLineCount() > 0) {
+ credits->SmoothScroll(ScrollWindow::SCROLL_DOWN, Game::GUITime());
+
+ if (credits->GetTopIndex() >= credits->GetLineCount()-1) {
+ credits->ScrollTo(0);
+ }
+ }
+
+ if (Keyboard::KeyDown(VK_RETURN)) {
+ OnApply(0);
+ }
+
+ if (Keyboard::KeyDown(VK_ESCAPE)) {
+ if (!exit_latch)
+ OnCancel(0);
+ }
+ else {
+ exit_latch = false;
+ }
}
// +--------------------------------------------------------------------+
@@ -91,42 +91,42 @@ ExitDlg::ExecFrame()
void
ExitDlg::Show()
{
- if (!IsShown()) {
- Rect r = def_rect;
+ if (!IsShown()) {
+ Rect r = def_rect;
- if (r.w > screen->Width()) {
- int extra = r.w - screen->Width();
- r.w -= extra;
- }
+ if (r.w > screen->Width()) {
+ int extra = r.w - screen->Width();
+ r.w -= extra;
+ }
- if (r.h > screen->Height()) {
- int extra = r.h - screen->Height();
- r.h -= extra;
- }
+ if (r.h > screen->Height()) {
+ int extra = r.h - screen->Height();
+ r.h -= extra;
+ }
- r.x = (screen->Width() - r.w) / 2;
- r.y = (screen->Height() - r.h) / 2;
+ r.x = (screen->Width() - r.w) / 2;
+ r.y = (screen->Height() - r.h) / 2;
- MoveTo(r);
+ MoveTo(r);
- exit_latch = true;
- Button::PlaySound(Button::SND_CONFIRM);
- MusicDirector::SetMode(MusicDirector::CREDITS);
+ exit_latch = true;
+ Button::PlaySound(Button::SND_CONFIRM);
+ MusicDirector::SetMode(MusicDirector::CREDITS);
- DataLoader* loader = DataLoader::GetLoader();
- BYTE* block = 0;
+ DataLoader* loader = DataLoader::GetLoader();
+ BYTE* block = 0;
- loader->SetDataPath(0);
- loader->LoadBuffer("credits.txt", block, true);
+ loader->SetDataPath(0);
+ loader->LoadBuffer("credits.txt", block, true);
- if (block && credits) {
- credits->SetText((const char*) block);
- }
+ if (block && credits) {
+ credits->SetText((const char*) block);
+ }
- loader->ReleaseBuffer(block);
- }
+ loader->ReleaseBuffer(block);
+ }
- FormWindow::Show();
+ FormWindow::Show();
}
// +--------------------------------------------------------------------+
@@ -134,19 +134,19 @@ ExitDlg::Show()
void
ExitDlg::OnApply(AWEvent* event)
{
- Starshatter* stars = Starshatter::GetInstance();
+ Starshatter* stars = Starshatter::GetInstance();
- if (stars) {
- ::Print("Exit Confirmed.\n");
- stars->Exit();
- }
+ if (stars) {
+ ::Print("Exit Confirmed.\n");
+ stars->Exit();
+ }
}
void
ExitDlg::OnCancel(AWEvent* event)
{
- manager->ShowMenuDlg();
- MusicDirector::SetMode(MusicDirector::MENU);
+ manager->ShowMenuDlg();
+ MusicDirector::SetMode(MusicDirector::MENU);
}
// +--------------------------------------------------------------------+