ScummVM API documentation
dos_text_screen.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 
13 #ifndef MADS_NEBULAR_BONUS_DOS_TEXT_SCREEN_H
14 #define MADS_NEBULAR_BONUS_DOS_TEXT_SCREEN_H
15 
16 #include "common/rect.h"
17 #include "common/scummsys.h"
18 #include "common/str.h"
19 
20 namespace Graphics {
21 struct Surface;
22 }
23 
24 namespace MADS {
25 namespace RexNebular {
26 
29 public:
30  enum {
31  kColumns = 80,
32  kRows = 25,
33  kCellWidth = 8,
34  kCellHeight = 16,
35  kRasterWidth = kColumns * kCellWidth,
36  kRasterHeight = kRows * kCellHeight
37  };
38 
39  struct Cell {
40  byte character;
41  byte attribute;
42  };
43 
44  DOSTextScreen();
45 
46  void clear(byte character = 0x20, byte attribute = 0x07);
47  bool isValidCell(int x, int y) const;
48  const Cell &getCell(int x, int y) const;
49  void setCell(int x, int y, byte character, byte attribute);
50  void setCharacter(int x, int y, byte character);
51  void setAttribute(int x, int y, byte attribute);
52 
53  void fill(const Common::Rect &rect, byte character, byte attribute);
54  void recolor(const Common::Rect &rect, byte attribute);
55  void drawBox(const Common::Rect &rect, byte attribute, bool doubleLine = true);
56  void drawShadow(const Common::Rect &rect, byte shadowAttribute = 0x08);
57  void drawSeparator(const Common::Rect &rect, int y, byte attribute);
58  void drawTitle(const Common::Rect &rect, const Common::String &title,
59  byte attribute, byte hotkeyAttribute = 0x0F);
60  void drawFooter(const Common::Rect &rect, const Common::String &text,
61  byte attribute, byte hotkeyAttribute = 0x0F);
62 
67  int drawText(int x, int y, const Common::String &text, byte attribute,
68  byte hotkeyAttribute, bool parseAccelerator = true, int maxCells = -1);
69  int drawCenteredText(int y, int left, int right, const Common::String &text,
70  byte attribute, byte hotkeyAttribute, bool parseAccelerator = true);
71 
73  bool render(Graphics::Surface &surface, bool blinkVisible = true) const;
74 
75  static void installVGAPalette();
76  static Common::String visibleText(const Common::String &source);
77  static int visibleTextWidth(const Common::String &source);
78  static char accelerator(const Common::String &source);
79 
80 private:
81  Cell _cells[kColumns * kRows];
82 
83  static int indexOf(int x, int y) { return y * kColumns + x; }
84  void drawBorderText(const Common::Rect &rect, int y,
85  const Common::String &text, byte attribute, byte hotkeyAttribute);
86 };
87 
88 } // namespace RexNebular
89 } // namespace MADS
90 
91 #endif // MADS_NEBULAR_BONUS_DOS_TEXT_SCREEN_H
Definition: str.h:59
Definition: surface.h:67
Definition: rect.h:536
Definition: dos_text_screen.h:39
Definition: dos_text_screen.h:28
Definition: formatinfo.h:28
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
Definition: anim_timer.h:27