1 #ifndef INNOCENT_GRAPHICS_H
2 #define INNOCENT_GRAPHICS_H
6 #include "common/rect.h"
7 #include "common/singleton.h"
10 #include "innocent/types.h"
11 #include "innocent/value.h"
22 Common::Point
&operator+=(Common::Point
&p1
, const Common::Point
&p2
);
24 class Graphics
: public Common::Singleton
<Graphics
> {
28 void setEngine(Engine
*engine
);
31 * Load interface image and palette; sets the palette.
39 * Paint the interface to proper portion of the screen.
41 void paintInterface();
42 void paintAnimations();
45 void push(Paintable
*p
);
46 void pop(Paintable
*p
);
47 void hookAfterRepaint(CodePointer
&p
);
49 void setBackdrop(uint16 id
);
52 int8
ask(uint16 left
, uint16 top
, byte width
, byte height
, byte
*string
);
53 void paintText(uint16 left
, uint16 top
, byte colour
, byte
*string
) {
54 paintText(left
, top
, colour
, string
, _framebuffer
.get());
56 void paintText(uint16 left
, uint16 top
, byte colour
, byte
*string
, Surface
*s
);
57 void paintRect(const Common::Rect
&r
, byte colour
= 235);
59 void paint(const Sprite
*sprite
, Common::Point pos
) const {
60 paint(sprite
, pos
, _framebuffer
.get());
62 void paint(const Sprite
*sprite
, uint16 left
, uint16 top
, Surface
*dest
) const {
63 paint(sprite
, Common::Point(left
, top
), dest
);
65 void paint(const Sprite
*sprite
, Common::Point pos
, Surface
*s
) const;
67 Common::Point
cursorPosition() const;
68 void showCursor() const;
70 void updateScreen() const;
76 static byte
clampChar(byte ch
);
78 * paint a character on screen
81 uint16
paintChar(uint16 left
, uint16 top
, byte colour
, byte character
, Surface
*s
) const;
82 byte _interface
[0x3c00];
84 Resources
*_resources
;
86 std::auto_ptr
<Surface
> _backdrop
, _framebuffer
;
88 static const char _charwidths
[];
91 Common::List
<Paintable
*> _paintables
;
92 Common::List
<CodePointer
> _afterRepaintHooks
;
95 } // End of namespace Innocent
97 #endif // INNOCENT_GRAPHICS_H