read Blackboard data correctly from the SFC file, and construct a BlackboardPart...
[openc2e.git] / Backend.h
blobc84da6699e767b78eb7053d3ded060c9449de49e
1 /*
2 * Backend.h
3 * openc2e
5 * Created by Alyssa Milburn on Sat Dec 2 2006.
6 * Copyright (c) 2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _BACKEND_H
21 #define _BACKEND_H
23 #include "endianlove.h"
24 #include <boost/shared_ptr.hpp>
26 using boost::shared_ptr;
28 enum eventtype { eventquit, eventkeydown, eventspecialkeyup, eventspecialkeydown, eventmousebuttondown, eventmousebuttonup, eventmousemove, eventresizewindow };
29 enum eventbuttons { buttonleft=0x1, buttonright=0x2, buttonmiddle=0x4, buttonwheeldown=0x8, buttonwheelup=0x10 };
31 struct SomeEvent {
32 eventtype type;
33 int x, y, xrel, yrel;
34 int key;
35 unsigned int button;
38 class creaturesImage;
40 class Surface {
41 public:
42 virtual void render(boost::shared_ptr<creaturesImage> image, unsigned int frame, int x, int y, bool trans = false, unsigned char transparency = 0, bool mirror = false, bool is_background = false) = 0;
43 virtual void renderLine(int x1, int y1, int x2, int y2, unsigned int colour) = 0;
44 virtual void renderText(int x, int y, std::string text, unsigned int colour, unsigned int bgcolour) = 0;
45 virtual void blitSurface(Surface *src, int x, int y, int w, int h) = 0;
46 virtual unsigned int getWidth() const = 0;
47 virtual unsigned int getHeight() const = 0;
48 virtual void renderDone() = 0;
49 virtual ~Surface() { }
52 class Backend {
53 public:
54 virtual void init() = 0;
55 virtual int networkInit() = 0;
56 virtual void shutdown() = 0;
58 virtual unsigned int ticks() = 0;
59 virtual bool pollEvent(SomeEvent &e) = 0;
60 virtual void handleEvents() = 0;
61 virtual bool keyDown(int key) = 0;
63 virtual bool selfRender() = 0;
64 virtual void requestRender() = 0;
66 virtual void resize(unsigned int width, unsigned int height) = 0;
68 virtual Surface *getMainSurface() = 0;
69 virtual Surface *newSurface(unsigned int width, unsigned int height) = 0;
70 virtual void freeSurface(Surface *surf) = 0;
72 virtual void setPalette(uint8 *data) = 0;
74 virtual int run(int argc, char **argv);
75 virtual void delay(int msec) = 0;
76 virtual ~Backend() { }
79 #endif