ScummVM API documentation
smush_multi_font.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 SCUMM_SMUSH_MULTI_FONT_H
23 #define SCUMM_SMUSH_MULTI_FONT_H
24 
25 #include "common/scummsys.h"
26 #include "scumm/nut_renderer.h"
27 #include "scumm/scumm.h"
28 #include "scumm/smush/rebel/font_rebel2.h"
29 #include "scumm/string_v7.h"
30 
31 namespace Scumm {
32 
33 class SmushPlayer;
34 
35 // Multi-font renderer for SMUSH text with ^fXX font switching.
36 class SmushMultiFont : public GlyphRenderer_v7 {
37 public:
38  static const int MAX_FONTS = 5;
39 
40  SmushMultiFont(ScummEngine *vm, SmushPlayer *player, bool useOriginalColors);
41  ~SmushMultiFont() override;
42 
43  void drawString(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int16 col, TextStyleFlags flags);
44  void drawString(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags);
45  void drawStringWrap(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int16 col, TextStyleFlags flags);
46  void drawStringWrap(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags);
47 
48  int draw2byte(byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, uint16 chr) override;
49  int drawCharV7(byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags, byte chr) override;
50  int getCharWidth(uint16 chr) const override;
51  int getCharHeight(uint16 chr) const override;
52  int getFontHeight() const override;
53  int setFont(int id) override;
54  bool newStyleWrapping() const override { return true; }
55 
56  void setDefaultFont(int id) { _defaultFont = id; _currentFont = id; }
57 
58 private:
59  NutRenderer *getFont(int id);
60  NutRenderer *getCurrentFont() const;
61  Rebel2FontSet getRebel2FontSet();
62 
63  ScummEngine *_vm;
64  SmushPlayer *_player;
65  TextRenderer_v7 *_textRenderer;
66  NutRenderer *_rebel2Fonts[Rebel2FontSet::kMaxFonts];
67 
68  int _currentFont;
69  int _defaultFont;
70  bool _hardcodedFontColors;
71 };
72 
73 } // End of namespace Scumm
74 
75 #endif
Definition: rect.h:536
Definition: smush_multi_font.h:36
Definition: scumm.h:524
Definition: font_rebel2.h:35
Definition: actor.h:30