ScummVM API documentation
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 MTROPOLIS_RENDER_H
23 #define MTROPOLIS_RENDER_H
24 
25 #include "common/events.h"
26 #include "common/ptr.h"
27 #include "common/scummsys.h"
28 
29 #include "graphics/pixelformat.h"
30 
31 #include "actions.h"
32 
33 namespace Graphics {
34 
35 class ManagedSurface;
36 struct Surface;
37 
38 } // End of namespace Graphics
39 
40 namespace MTropolis {
41 
42 class CursorGraphic;
43 class Runtime;
44 class Project;
45 struct SceneTransitionEffect;
46 
47 enum TextAlignment {
48  kTextAlignmentLeft,
49  kTextAlignmentCenter,
50  kTextAlignmentRight,
51 };
52 
54  bool bold : 1;
55  bool italic : 1;
56  bool underline : 1;
57  bool outline : 1;
58  bool shadow : 1;
59  bool condensed : 1;
60  bool expanded : 1;
61 
63  bool load(uint8 dataStyleFlags);
64 };
65 
68  MacFontFormatting(uint16 mff_fontID, uint8 mff_fontFlags, uint16 mff_size);
69 
70  uint16 fontID;
71  uint8 fontFlags;
72  uint16 size;
73 };
74 
77 
78  uint16 spanStart;
79  MacFontFormatting formatting;
80 };
81 
83  Runtime *runtime;
84  int32 x;
85  int32 y;
86  int16 width;
87  int16 height;
88  const Graphics::PixelFormat format;
89 
90  WindowParameters(Runtime *wp_runtime, int32 wp_x, int32 wp_y, int16 wp_width, int16 wp_height, const Graphics::PixelFormat &wp_format);
91 };
92 
93 class Window {
94 public:
95  explicit Window(const WindowParameters &windowParams);
96  virtual ~Window();
97 
98  int32 getX() const;
99  int32 getY() const;
100  int32 getWidth() const;
101  int32 getHeight() const;
102  void setPosition(int32 x, int32 y);
103  void resizeWindow(int32 width, int32 height); // Destroys contents
104 
105  const Common::SharedPtr<Graphics::ManagedSurface> &getSurface() const;
106  const Graphics::PixelFormat &getPixelFormat() const;
107 
108  const Common::SharedPtr<CursorGraphic> &getCursorGraphic() const;
109  void setCursorGraphic(const Common::SharedPtr<CursorGraphic> &cursor);
110 
111  bool getMouseVisible() const;
112  void setMouseVisible(bool visible);
113 
114  void setStrata(int strata);
115  int getStrata() const;
116 
117  // Mouse transparency = ignores mouse events
118  void setMouseTransparent(bool isTransparent);
119  bool isMouseTransparent() const;
120 
121  void close();
122  void detachFromRuntime();
123 
124  virtual void onMouseDown(int32 x, int32 y, int mouseButton);
125  virtual void onMouseMove(int32 x, int32 y);
126  virtual void onMouseUp(int32 x, int32 y, int mouseButton);
127  virtual void onKeyboardEvent(const Common::EventType evtType, bool repeat, const Common::KeyState &keyEvt);
128  virtual void onAction(Actions::Action action);
129 
130 protected:
131  int32 _x;
132  int32 _y;
133  Runtime *_runtime;
134  int _strata;
135  bool _isMouseTransparent;
136  bool _isMouseVisible;
137 
140 };
141 
142 namespace Render {
143 
144 uint32 resolveRGB(uint8 r, uint8 g, uint8 b, const Graphics::PixelFormat &fmt);
145 void renderProject(Runtime *runtime, Window *mainWindow, bool *outSkipped);
146 void renderSceneTransition(Runtime *runtime, Window *mainWindow, const SceneTransitionEffect &effect, uint32 startTime, uint32 endTime, uint32 currentTime, const Graphics::ManagedSurface &oldFrame, const Graphics::ManagedSurface &newFrame);
147 
148 void convert32To16(Graphics::ManagedSurface &destSurface, const Graphics::ManagedSurface &srcSurface);
149 void convert16To32(Graphics::ManagedSurface &destSurface, const Graphics::ManagedSurface &srcSurface);
150 
151 } // End of namespace Render
152 
153 } // End of namespace MTropolis
154 
155 #endif
Definition: managed_surface.h:51
Definition: pixelformat.h:138
Definition: render.h:66
EventType
Definition: events.h:49
Definition: render.h:53
Definition: runtime.h:1594
Definition: render.h:93
Definition: render.h:82
Definition: render.h:75
Definition: formatinfo.h:28
Definition: actions.h:25
Definition: keyboard.h:294
Definition: runtime.h:1376