ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

diaryindex.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "engines/stark/ui/menu/diaryindex.h"
00024 
00025 #include "engines/stark/gfx/driver.h"
00026 #include "engines/stark/services/services.h"
00027 #include "engines/stark/services/diary.h"
00028 #include "engines/stark/services/userinterface.h"
00029 #include "engines/stark/services/gamemessage.h"
00030 
00031 #include "engines/stark/ui/cursor.h"
00032 
00033 #include "common/translation.h"
00034 #include "engines/engine.h"
00035 #include "gui/message.h"
00036 #include "gui/saveload.h"
00037 
00038 namespace Stark {
00039 
00040 const Color DiaryIndexScreen::_textColorHovered = Color(0x1E, 0x1E, 0x96);
00041 const Color DiaryIndexScreen::_textColorDefault = Color(0x00, 0x00, 0x00);
00042 
00043 DiaryIndexScreen::DiaryIndexScreen(Gfx::Driver *gfx, Cursor *cursor) :
00044         StaticLocationScreen(gfx, cursor, "DiaryIndexLocation", Screen::kScreenDiaryIndex) {
00045 }
00046 
00047 DiaryIndexScreen::~DiaryIndexScreen() {
00048 }
00049 
00050 void DiaryIndexScreen::open() {
00051     StaticLocationScreen::open();
00052 
00053     _widgets.push_back(new StaticLocationWidget(
00054             "BGImage",
00055             nullptr,
00056             nullptr));
00057 
00058     _widgets.push_back(new StaticLocationWidget(
00059             "SaveGame",
00060             CLICK_HANDLER(DiaryIndexScreen, saveHandler),
00061             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00062     _widgets.back()->setVisible(g_engine->canSaveGameStateCurrently());
00063 
00064     _widgets.push_back(new StaticLocationWidget(
00065             "Continue",
00066             CLICK_HANDLER(DiaryIndexScreen, loadHandler),
00067             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00068 
00069     _widgets.push_back(new StaticLocationWidget(
00070             "Options",
00071             CLICK_HANDLER(DiaryIndexScreen, settingsHandler),
00072             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00073 
00074     _widgets.push_back(new StaticLocationWidget(
00075             "Log",
00076             CLICK_HANDLER(DiaryIndexScreen, dialogHandler),
00077             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00078 
00079     _widgets.push_back(new StaticLocationWidget(
00080             "Fmv",
00081             CLICK_HANDLER(DiaryIndexScreen, fmvHandler),
00082             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00083 
00084     _widgets.push_back(new StaticLocationWidget(
00085             "Diary",
00086             CLICK_HANDLER(DiaryIndexScreen, diaryHandler),
00087             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00088     _widgets.back()->setVisible(StarkDiary->isEnabled());
00089 
00090     _widgets.push_back(new StaticLocationWidget(
00091             "Return",
00092             CLICK_HANDLER(DiaryIndexScreen, backHandler),
00093             nullptr));
00094 
00095     _widgets.push_back(new StaticLocationWidget(
00096             "Quit",
00097             CLICK_HANDLER(DiaryIndexScreen, quitHandler),
00098             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00099 
00100     _widgets.push_back(new StaticLocationWidget(
00101             "Back",
00102             CLICK_HANDLER(DiaryIndexScreen, backHandler),
00103             nullptr));
00104 
00105     for (uint i = 1; i < _widgets.size(); i++) {
00106         // The background image is intentionally ignored
00107         _widgets[i]->setupSounds(0, 1);
00108     }
00109 }
00110 
00111 void DiaryIndexScreen::widgetTextColorHandler(StaticLocationWidget &widget, const Common::Point &mousePos) {
00112     if (widget.isVisible()) {
00113         Color textColor = widget.isMouseInside(mousePos) ? _textColorHovered : _textColorDefault;
00114         widget.setTextColor(textColor);
00115     }
00116 }
00117 
00118 void DiaryIndexScreen::settingsHandler() {
00119     StarkUserInterface->changeScreen(Screen::kScreenSettingsMenu);
00120 }
00121 
00122 void DiaryIndexScreen::fmvHandler() {
00123     StarkUserInterface->changeScreen(Screen::kScreenFMVMenu);
00124 }
00125 
00126 void DiaryIndexScreen::backHandler() {
00127     StarkUserInterface->backPrevScreen();
00128 }
00129 
00130 void DiaryIndexScreen::quitHandler() {
00131     StarkUserInterface->confirm(GameMessage::kQuitGamePrompt, StarkUserInterface,
00132                                 &UserInterface::requestQuitToMainMenu);
00133 }
00134 
00135 void DiaryIndexScreen::loadHandler() {
00136     StarkUserInterface->changeScreen(Screen::kScreenLoadMenu);
00137 }
00138 
00139 void DiaryIndexScreen::saveHandler() {
00140     StarkUserInterface->changeScreen(Screen::kScreenSaveMenu);
00141 }
00142 
00143 void DiaryIndexScreen::diaryHandler() {
00144     StarkUserInterface->changeScreen(Screen::kScreenDiaryPages);
00145 }
00146 
00147 void DiaryIndexScreen::dialogHandler() {
00148     StarkUserInterface->changeScreen(Screen::kScreenDialog);
00149 }
00150 
00151 } // End of namespace Stark


Generated on Sat Jul 20 2019 05:00:59 for ResidualVM by doxygen 1.7.1
curved edge   curved edge