ScummVM API documentation
ports.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 SCI_GRAPHICS_PORTS_H
23 #define SCI_GRAPHICS_PORTS_H
24 
25 #include "common/serializer.h"
26 #include "common/list.h"
27 #include "common/array.h"
28 
29 namespace Sci {
30 
31 class GfxPaint16;
32 class GfxScreen;
33 class GfxText16;
34 struct WorklistManager;
35 
36 // window styles
37 enum {
38  SCI_WINDOWMGR_STYLE_TRANSPARENT = (1 << 0),
39  SCI_WINDOWMGR_STYLE_NOFRAME = (1 << 1),
40  SCI_WINDOWMGR_STYLE_TITLE = (1 << 2),
41  SCI_WINDOWMGR_STYLE_TOPMOST = (1 << 3),
42  SCI_WINDOWMGR_STYLE_USER = (1 << 7)
43 };
44 
45 typedef Common::List<Port *> PortList;
46 typedef Common::Array<Port *> PortArray;
47 
53 public:
54  GfxPorts(SegManager *segMan, GfxScreen *screen);
55  ~GfxPorts() override;
56 
57  void init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *text16);
58  void reset();
59 
60  void kernelSetActive(uint16 portId);
61  Common::Rect kernelGetPicWindow(int16 &picTop, int16 &picLeft);
62  void kernelSetPicWindow(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag);
63  reg_t kernelGetActive();
64  reg_t kernelNewWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title);
65  void kernelDisposeWindow(uint16 windowId, bool reanimate);
66 
67  int16 isFrontWindow(Window *wnd);
68  void beginUpdate(Window *wnd);
69  void endUpdate(Window *wnd);
70  Window *addWindow(const Common::Rect &dims, const Common::Rect *restoreRect, const char *title, uint16 style, int16 priority, bool draw);
71  void drawWindow(Window *wnd);
72  void removeWindow(Window *pWnd, bool reanimate);
73  void freeWindow(Window *pWnd);
74  void updateWindow(Window *wnd);
75 
76  Port *getPortById(uint16 id);
77 
78  Port *setPort(Port *newPort);
79  Port *getPort();
80  void setOrigin(int16 left, int16 top);
81  void moveTo(int16 left, int16 top);
82  void move(int16 left, int16 top);
83  void openPort(Port *port);
84  void penColor(int16 color);
85  void backColor(int16 color);
86  void penMode(int16 mode);
87  void textGreyedOutput(bool state);
88  int16 getPointSize();
89 
90  void offsetRect(Common::Rect &r);
91  void offsetLine(Common::Point &start, Common::Point &end);
92  void clipLine(Common::Point &start, Common::Point &end);
93 
94  void priorityBandsInit(int16 bandCount, int16 top, int16 bottom);
95  void priorityBandsInit(const SciSpan<const byte> &data);
96  void priorityBandsInitSci11(SciSpan<const byte> data);
97 
98  void kernelInitPriorityBands();
99  void kernelGraphAdjustPriority(int top, int bottom);
100  byte kernelCoordinateToPriority(int16 y);
101  int16 kernelPriorityToCoordinate(byte priority);
102  void processEngineHunkList(WorklistManager &wm);
103  void printWindowList(Console *con);
104 
105  Port *_wmgrPort;
106  Window *_picWind;
107 
108  Port *_menuPort;
109  Common::Rect _menuBarRect;
110  Common::Rect _menuRect;
111  Common::Rect _menuLine;
112  Port *_curPort;
113 
114  void saveLoadWithSerializer(Common::Serializer &ser) override;
115 
116 private:
118  PortList _windowList;
119 
121  PortArray _windowsById;
122 
123  SegManager *_segMan;
124  GfxPaint16 *_paint16;
125  GfxScreen *_screen;
126  GfxText16 *_text16;
127 
128  bool _usesOldGfxFunctions;
129 
130  uint16 _styleUser;
131 
132  // counts windows that got disposed but are not freed yet
133  uint16 _freeCounter;
134 
135  Common::Rect _bounds;
136 
137  // Priority Bands related variables
138  int16 _priorityTop, _priorityBottom, _priorityBandCount;
139  byte _priorityBands[200];
140 };
141 
142 } // End of namespace Sci
143 
144 #endif // SCI_GRAPHICS_PORTS_H
Definition: paint16.h:37
Definition: ports.h:52
Definition: gc.h:57
Definition: rect.h:144
Definition: serializer.h:79
Definition: rect.h:45
Definition: console.h:28
Definition: serializer.h:308
Definition: seg_manager.h:48
Definition: text16.h:45
Definition: screen.h:70
Definition: vm_types.h:39
Definition: helpers.h:56
Definition: console.h:36
Definition: helpers.h:78