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 
00063     _widgets.push_back(new StaticLocationWidget(
00064             "Continue",
00065             CLICK_HANDLER(DiaryIndexScreen, loadHandler),
00066             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00067 
00068     _widgets.push_back(new StaticLocationWidget(
00069             "Options",
00070             CLICK_HANDLER(DiaryIndexScreen, settingsHandler),
00071             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00072 
00073     _widgets.push_back(new StaticLocationWidget(
00074             "Log",
00075             CLICK_HANDLER(DiaryIndexScreen, dialogHandler),
00076             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00077 
00078     _widgets.push_back(new StaticLocationWidget(
00079             "Fmv",
00080             CLICK_HANDLER(DiaryIndexScreen, fmvHandler),
00081             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00082 
00083     _widgets.push_back(new StaticLocationWidget(
00084             "Diary",
00085             CLICK_HANDLER(DiaryIndexScreen, diaryHandler),
00086             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00087     _widgets.back()->setVisible(StarkDiary->isEnabled());
00088 
00089     _widgets.push_back(new StaticLocationWidget(
00090             "Return",
00091             CLICK_HANDLER(DiaryIndexScreen, backHandler),
00092             nullptr));
00093 
00094     _widgets.push_back(new StaticLocationWidget(
00095             "Quit",
00096             CLICK_HANDLER(DiaryIndexScreen, quitHandler),
00097             MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
00098 
00099     _widgets.push_back(new StaticLocationWidget(
00100             "Back",
00101             CLICK_HANDLER(DiaryIndexScreen, backHandler),
00102             nullptr));
00103 
00104     for (uint i = 1; i < _widgets.size(); i++) {
00105         // The background image is intentionally ignored
00106         _widgets[i]->setupSounds(0, 1);
00107     }
00108 }
00109 
00110 void DiaryIndexScreen::widgetTextColorHandler(StaticLocationWidget &widget, const Common::Point &mousePos) {
00111     if (widget.isVisible()) {
00112         Color textColor = widget.isMouseInside(mousePos) ? _textColorHovered : _textColorDefault;
00113         widget.setTextColor(textColor);
00114     }
00115 }
00116 
00117 void DiaryIndexScreen::settingsHandler() {
00118     StarkUserInterface->changeScreen(Screen::kScreenSettingsMenu);
00119 }
00120 
00121 void DiaryIndexScreen::fmvHandler() {
00122     StarkUserInterface->changeScreen(Screen::kScreenFMVMenu);
00123 }
00124 
00125 void DiaryIndexScreen::backHandler() {
00126     StarkUserInterface->backPrevScreen();
00127 }
00128 
00129 void DiaryIndexScreen::quitHandler() {
00130     StarkUserInterface->confirm(GameMessage::kQuitGamePrompt, StarkUserInterface,
00131                                 &UserInterface::requestQuitToMainMenu);
00132 }
00133 
00134 void DiaryIndexScreen::loadHandler() {
00135     StarkUserInterface->changeScreen(Screen::kScreenLoadMenu);
00136 }
00137 
00138 void DiaryIndexScreen::saveHandler() {
00139     StarkUserInterface->changeScreen(Screen::kScreenSaveMenu);
00140 }
00141 
00142 void DiaryIndexScreen::diaryHandler() {
00143     StarkUserInterface->changeScreen(Screen::kScreenDiaryPages);
00144 }
00145 
00146 void DiaryIndexScreen::dialogHandler() {
00147     StarkUserInterface->changeScreen(Screen::kScreenDialog);
00148 }
00149 
00150 } // End of namespace Stark


Generated on Sat Feb 9 2019 05:00:30 for ResidualVM by doxygen 1.7.1
curved edge   curved edge