ScummVM API documentation
menu_render.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 HARVESTER_MENU_RENDER_H
23#define HARVESTER_MENU_RENDER_H
24
25#include "graphics/font.h"
26#include "harvester/menu/menu.h"
27
28namespace Graphics {
29class Screen;
30}
31
32namespace Harvester {
33namespace MenuRendering {
34
35extern const int kMenuStartY;
36extern const int kMenuLineSpacing;
37extern const byte kTextColorNormal;
38extern const int kOptionsSliderMinX;
39extern const int kOptionsSliderStep;
40extern const int kOptionsIndicatorY;
41extern const int kPasswordEntryWidth;
42
43struct TextLayout {
44 TextLayout(int x, int y, int width) : x(x), y(y), width(width) {}
45
46 int x;
47 int y;
48 int width;
49};
50
51struct FontPair {
52 FontPair(const Graphics::Font &primary, const Graphics::Font &secondary)
53 : primary(primary), secondary(secondary) {}
54
55 const Graphics::Font &primary;
56 const Graphics::Font &secondary;
57};
58
60 SliderBitmaps(const IndexedBitmap &bar, const IndexedBitmap &indicator)
61 : bar(bar), indicator(indicator) {}
62
63 const IndexedBitmap &bar;
64 const IndexedBitmap &indicator;
65};
66
67// Drawing calls borrow their backdrop, palette, fonts, and bitmaps synchronously.
68class Renderer {
69public:
70 Renderer(HarvesterEngine &engine, const IndexedBitmap &backdrop,
71 const byte *palette, float paletteBrightness)
72 : _engine(engine), _backdrop(backdrop), _palette(palette), _paletteBrightness(paletteBrightness) {}
73
74 void renderOptionsMenu(const FontPair &fonts, const Art &art, const MenuTextConfig &config,
75 const SliderBitmaps &sliders, int selectedItem, bool drawCursor = true) const;
76 void renderPasswordPrompt(const FontPair &fonts, const Art &art, const Common::String &title,
77 const Common::String &text, bool cursorVisible, bool drawLogo) const;
78 void renderQuickTipsOverlay(const MenuTextConfig &config, const QuickTipsLayout &layout,
79 const Common::String &tipText) const;
80 void renderConfirmPrompt(const Graphics::Font &promptFont,
81 const Graphics::Font &yesFont, const Graphics::Font &noFont,
82 const IndexedBitmap &textbox, const Common::String &promptText, const MenuTextConfig &config) const;
83
84private:
85 HarvesterEngine &_engine;
86 const IndexedBitmap &_backdrop;
87 const byte *_palette;
88 float _paletteBrightness;
89};
90
91void applyMenuPalette(Graphics::Screen &screen, const HarvesterEngine &engine,
92 const byte *palette, float brightness);
93void blitBitmap(Graphics::Screen &screen, const IndexedBitmap &bitmap, int x, int y);
94void drawShadowedString(Graphics::Screen &screen, const Graphics::Font &font,
95 const Common::String &text, const TextLayout &layout, byte color,
97void renderCdChangePromptScreen(HarvesterEngine &engine, const IndexedBitmap &bitmap, const byte *palette);
98void renderHelpScreen(HarvesterEngine &engine, const IndexedBitmap &bitmap, const byte *palette);
99int getNativeRoomMenuLineHeight(const Graphics::Font &selectedFont);
100
101} // End of namespace MenuRendering
102} // End of namespace Harvester
103
104#endif // HARVESTER_MENU_RENDER_H
Definition: str.h:59
Definition: font.h:83
Definition: screen.h:47
Definition: art.h:35
Definition: harvester.h:47
Definition: menu_render.h:68
TextAlign
Definition: font.h:48
@ kTextAlignLeft
Align the text to the left.
Definition: font.h:51
Definition: formatinfo.h:28
Definition: bitmap.h:33
Definition: menu_render.h:51
Definition: menu_render.h:59
Definition: menu_render.h:43
Definition: menu.h:45
Definition: menu.h:76
Definition: atari-screen.h:58