summaryrefslogtreecommitdiffhomepage
path: root/Stars45/ExitDlg.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-01 21:23:39 +0200
committerAki <please@ignore.pl>2022-04-01 21:23:39 +0200
commit3c487c5cd69c53d6fea948643c0a76df03516605 (patch)
tree72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /Stars45/ExitDlg.cpp
parent8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff)
downloadstarshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2
Moved Stars45 to StarsEx
Diffstat (limited to 'Stars45/ExitDlg.cpp')
-rw-r--r--Stars45/ExitDlg.cpp150
1 files changed, 0 insertions, 150 deletions
diff --git a/Stars45/ExitDlg.cpp b/Stars45/ExitDlg.cpp
deleted file mode 100644
index 5d42448..0000000
--- a/Stars45/ExitDlg.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Starshatter: The Open Source Project
- Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
- Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
- Copyright (c) 1997-2006, Destroyer Studios LLC.
-
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
-*/
-
-#include "ExitDlg.h"
-#include "MenuScreen.h"
-#include "MusicDirector.h"
-#include "Starshatter.h"
-#include "FormatUtil.h"
-
-#include "Clock.h"
-#include "Keyboard.h"
-#include "Button.h"
-#include "RichTextBox.h"
-#include "DataLoader.h"
-
-// +--------------------------------------------------------------------+
-// DECLARE MAPPING FUNCTIONS:
-
-DEF_MAP_CLIENT(ExitDlg, OnApply);
-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())
-{
- Init(def);
-}
-
-ExitDlg::~ExitDlg()
-{
-}
-
-void
-ExitDlg::RegisterControls()
-{
- if (apply)
- return;
-
- credits = (RichTextBox*) FindControl(201);
-
- apply = (Button*) FindControl(1);
- REGISTER_CLIENT(EID_CLICK, apply, ExitDlg, OnApply);
-
- cancel = (Button*) FindControl(2);
- REGISTER_CLIENT(EID_CLICK, cancel, ExitDlg, OnCancel);
-}
-
-// +--------------------------------------------------------------------+
-
-void
-ExitDlg::ExecFrame()
-{
- if (credits && credits->GetLineCount() > 0) {
- credits->SmoothScroll(ScrollWindow::SCROLL_DOWN, Clock::GetInstance()->GuiDelta());
-
- 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;
- }
-}
-
-// +--------------------------------------------------------------------+
-
-void
-ExitDlg::Show()
-{
- if (!IsShown()) {
- Rect r = def_rect;
-
- 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;
- }
-
- r.x = (screen->Width() - r.w) / 2;
- r.y = (screen->Height() - r.h) / 2;
-
- MoveTo(r);
-
- exit_latch = true;
- Button::PlaySound(Button::SND_CONFIRM);
- MusicDirector::SetMode(MusicDirector::CREDITS);
-
- DataLoader* loader = DataLoader::GetLoader();
- BYTE* block = 0;
-
- loader->SetDataPath(0);
- loader->LoadBuffer("credits.txt", block, true);
-
- if (block && credits) {
- credits->SetText((const char*) block);
- }
-
- loader->ReleaseBuffer(block);
- }
-
- FormWindow::Show();
-}
-
-// +--------------------------------------------------------------------+
-
-void
-ExitDlg::OnApply(AWEvent* event)
-{
- Starshatter* stars = Starshatter::GetInstance();
-
- if (stars) {
- ::Print("Exit Confirmed.\n");
- stars->Exit();
- }
-}
-
-void
-ExitDlg::OnCancel(AWEvent* event)
-{
- manager->ShowMenuDlg();
- MusicDirector::SetMode(MusicDirector::MENU);
-}
-
-// +--------------------------------------------------------------------+