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 
47 class SmushMultiFont : public GlyphRenderer_v7 {
48 public:
49  static const int MAX_FONTS = 5;
50 
51  SmushMultiFont(ScummEngine *vm, SmushPlayer *player, bool useOriginalColors);
52  ~SmushMultiFont() override;
53 
54  // String drawing methods
55  void drawString(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int16 col, TextStyleFlags flags);
56  void drawString(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags);
57  void drawStringWrap(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int16 col, TextStyleFlags flags);
58 
59  // GlyphRenderer_v7 interface
60  int draw2byte(byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, uint16 chr) override;
61  int drawCharV7(byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags, byte chr) override;
62  int getCharWidth(uint16 chr) const override;
63  int getCharHeight(uint16 chr) const override;
64  int getFontHeight() const override;
65  int setFont(int id) override;
66  bool newStyleWrapping() const override { return true; }
67 
68  // Set the initial/default font
69  void setDefaultFont(int id) { _defaultFont = id; _currentFont = id; }
70 
71 private:
72  NutRenderer *getFont(int id);
73  NutRenderer *getCurrentFont() const;
74  Rebel2FontSet getRebel2FontSet();
75 
76  ScummEngine *_vm;
77  SmushPlayer *_player;
78  TextRenderer_v7 *_textRenderer;
79  NutRenderer *_rebel2Fonts[Rebel2FontSet::kMaxFonts];
80 
81  int _currentFont;
82  int _defaultFont;
83  bool _hardcodedFontColors;
84 };
85 
86 } // End of namespace Scumm
87 
88 #endif
Definition: rect.h:524
Definition: smush_multi_font.h:47
Definition: scumm.h:524
Definition: font_rebel2.h:35
Definition: actor.h:30