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

fmvmenu.h

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 #ifndef STARK_UI_MENU_FMV_MENU_H
00024 #define STARK_UI_MENU_FMV_MENU_H
00025 
00026 #include "engines/stark/ui/menu/locationscreen.h"
00027 
00028 #include "engines/stark/visual/text.h"
00029 
00030 namespace Stark {
00031 
00032 class FMVWidget;
00033 
00037 class FMVMenuScreen : public StaticLocationScreen {
00038 public:
00039     static Common::Point _formatRectPos;
00040     static int _fontHeight;
00041     static uint _fmvPerPage;
00042 
00043     FMVMenuScreen(Gfx::Driver *gfx, Cursor *cursor);
00044     virtual ~FMVMenuScreen();
00045 
00046     // StaticLocationScreen API
00047     void open() override;
00048     void close() override;
00049     void onScreenChanged() override;
00050 
00051 protected:
00052     // Window API
00053     void onMouseMove(const Common::Point &pos) override;
00054     void onClick(const Common::Point &pos) override;
00055     void onRender() override;
00056 
00057 private:
00058     enum WidgetIndex {
00059         kWidgetPrevious = 3,
00060         kWidgetNext = 4
00061     };
00062 
00063     Common::Array<FMVWidget *> _fmvWidgets;
00064 
00065     // Count from zero
00066     uint _page, _maxPage;
00067 
00068     void backHandler();
00069     void prevPageHandler() { changePage(_page - 1); }
00070     void nextPageHandler() { changePage(_page + 1); }
00071 
00072     void freeFMVWidgets();
00073     void loadFMVWidgets(uint page);
00074     void changePage(uint page);
00075 };
00076 
00080 class FMVWidget {
00081 public:
00082     FMVWidget(Gfx::Driver *gfx, uint fmvIndex);
00083     ~FMVWidget() {}
00084 
00085     void render() { _title.render(_position); }
00086 
00087     bool isMouseInside(const Common::Point &mousePos) const;
00088 
00089     void onMouseMove(const Common::Point &mousePos) {
00090         setTextColor(isMouseInside(mousePos) ? _textColorHovered : _textColorDefault);
00091     }
00092 
00093     void onClick();
00094 
00095     void setTextColor(const Color &color) { _title.setColor(color); }
00096 
00097     void onScreenChanged() { _title.resetTexture(); }
00098 
00099 private:
00100     static const Color _textColorHovered;
00101     static const Color _textColorDefault;
00102 
00103     const Common::String &_filename;
00104     VisualText _title;
00105 
00106     int _width;
00107     Common::Point _position;
00108 };
00109 
00110 } // End of namespace Stark
00111 
00112 #endif // STARK_UI_MENU_FMV_MENU_H


Generated on Sat Mar 16 2019 05:01:32 for ResidualVM by doxygen 1.7.1
curved edge   curved edge