ScummVM API documentation
fmvmenu.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef STARK_UI_MENU_FMV_MENU_H
23 #define STARK_UI_MENU_FMV_MENU_H
24 
25 #include "engines/stark/ui/menu/locationscreen.h"
26 #include "engines/stark/visual/text.h"
27 
28 #include "common/path.h"
29 
30 namespace Stark {
31 
32 class FMVWidget;
33 
38 public:
39  FMVMenuScreen(Gfx::Driver *gfx, Cursor *cursor);
40  virtual ~FMVMenuScreen();
41 
42  // StaticLocationScreen API
43  void open() override;
44  void close() override;
45  void onScreenChanged() override;
46 
47 protected:
48  // Window API
49  void onMouseMove(const Common::Point &pos) override;
50  void onClick(const Common::Point &pos) override;
51  void onRender() override;
52 
53 private:
54  enum WidgetIndex {
55  kWidgetPrevious = 3,
56  kWidgetNext = 4
57  };
58 
59  Common::Array<FMVWidget *> _fmvWidgets;
60 
61  Common::Point _formatRectPos;
62  int _fontHeight;
63  uint _fmvPerPage;
64 
65  // Count from zero
66  uint _page, _maxPage;
67 
68  void backHandler();
69  void prevPageHandler() { changePage(_page - 1); }
70  void nextPageHandler() { changePage(_page + 1); }
71 
72  void freeFMVWidgets();
73  void loadFMVWidgets(uint page);
74  void changePage(uint page);
75 };
76 
80 class FMVWidget {
81 public:
82  FMVWidget(Gfx::Driver *gfx, uint fmvIndex);
83  ~FMVWidget() {}
84 
85  void render() { _title.render(_position); }
86 
87  bool isMouseInside(const Common::Point &mousePos) const;
88 
89  void onMouseMove(const Common::Point &mousePos) {
90  setTextColor(isMouseInside(mousePos) ? _textColorHovered : _textColorDefault);
91  }
92 
93  void onClick();
94 
95  void setTextColor(const Gfx::Color &color) { _title.setColor(color); }
96 
97  void onScreenChanged() { _title.reset(); }
98 
99 private:
100  const Gfx::Color _textColorHovered = Gfx::Color(0x1E, 0x1E, 0x96);
101  const Gfx::Color _textColorDefault = Gfx::Color(0x00, 0x00, 0x00);
102 
103  Common::Point _formatRectPos;
104  int _fontHeight;
105  uint _fmvPerPage;
106 
107  const Common::Path &_filename;
108  VisualText _title;
109 
110  int _width;
111  Common::Point _position;
112 };
113 
114 } // End of namespace Stark
115 
116 #endif // STARK_UI_MENU_FMV_MENU_H
void render() override
Definition: screen.h:86
Definition: array.h:52
void onScreenChanged() override
Definition: path.h:52
Definition: fmvmenu.h:80
Definition: driver.h:44
Definition: fmvmenu.h:37
Definition: cursor.h:45
bool isMouseInside() const
Definition: locationscreen.h:46
Definition: text.h:44
Definition: console.h:27
Definition: rect.h:45
void open() override
void close() override
Definition: color.h:30