Animation hooks hook up properly.
[scummvm-innocent.git] / engines / innocent / graphics.h
blob571c9543dff80374f4a3d663ee9a13d14df97e7c
1 #ifndef INNOCENT_GRAPHICS_H
2 #define INNOCENT_GRAPHICS_H
4 #include <memory>
6 #include "common/rect.h"
7 #include "common/singleton.h"
8 #include "config.h"
10 #include "innocent/types.h"
11 #include "innocent/value.h"
13 class OSystem;
15 namespace Innocent {
17 class Engine;
18 class Resources;
19 class Surface;
20 class Sprite;
22 Common::Point &operator+=(Common::Point &p1, const Common::Point &p2);
24 class Graphics : public Common::Singleton<Graphics> {
25 public:
26 Graphics() {}
28 void setEngine(Engine *engine);
30 /**
31 * Load interface image and palette; sets the palette.
33 void loadInterface();
35 void init();
36 void paint();
38 /**
39 * Paint the interface to proper portion of the screen.
41 void paintInterface();
42 void paintAnimations();
43 void paintExits();
45 void push(Paintable *p);
46 void pop(Paintable *p);
47 void hookAfterRepaint(CodePointer &p);
49 void setBackdrop(uint16 id);
50 void paintBackdrop();
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;
72 private:
73 enum {
74 kLineHeight = 12
76 static byte clampChar(byte ch);
77 /**
78 * paint a character on screen
79 * @returns char width
81 uint16 paintChar(uint16 left, uint16 top, byte colour, byte character, Surface *s) const;
82 byte _interface[0x3c00];
83 Engine *_engine;
84 Resources *_resources;
85 OSystem *_system;
86 std::auto_ptr<Surface> _backdrop, _framebuffer;
88 static const char _charwidths[];
90 private:
91 Common::List<Paintable *> _paintables;
92 Common::List<CodePointer> _afterRepaintHooks;
95 } // End of namespace Innocent
97 #endif // INNOCENT_GRAPHICS_H