summaryrefslogtreecommitdiff
path: root/src/graphic/graphic.h
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-12-20 08:08:32 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-12-20 08:08:32 +0000
commit41b0b5c0ed80d812d13c8c92d286a8663084ec58 (patch)
tree26e968bb48a886bccf8aa17e8064e6f3b8f2bc5d /src/graphic/graphic.h
parent1883b8b5e20506e41f31bdf6b802fbfd3f63f961 (diff)
downloadmana-41b0b5c0ed80d812d13c8c92d286a8663084ec58.tar.gz
mana-41b0b5c0ed80d812d13c8c92d286a8663084ec58.tar.bz2
mana-41b0b5c0ed80d812d13c8c92d286a8663084ec58.tar.xz
mana-41b0b5c0ed80d812d13c8c92d286a8663084ec58.zip
Updated Debian package, some fixes, new classes for the new graphic engine
Diffstat (limited to 'src/graphic/graphic.h')
-rw-r--r--src/graphic/graphic.h73
1 files changed, 69 insertions, 4 deletions
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index 4c68f933..08ed79d2 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -24,10 +24,6 @@
#ifndef _GRAPHIC_H
#define _GRAPHIC_H
-#ifdef WIN32
-#pragma warning (disable:4312)
-#endif
-
#include "../game.h"
#include "../map.h"
#include "../being.h"
@@ -64,4 +60,73 @@ void do_graphic(void);
void init_graphic(void);
void exit_graphic(void);
+class Surface {
+ public:
+ BITMAP *buffer;
+ virtual void lock() = 0;
+ virtual void show() = 0;
+ virtual void update() = 0;
+};
+
+class VideoSurface : public Surface {
+ private:
+ int current_page;
+ BITMAP *page[2];
+ public:
+ VideoSurface(BITMAP *page1, BITMAP *page2) {
+ page[0] = page1;
+ page[1] = page2;
+ current_page = 0;
+ }
+ ~VideoSurface() {
+ destroy_bitmap(page[0]);
+ destroy_bitmap(page[2]);
+ }
+ void lock() {
+#ifdef WIN32
+ acquire_bitmap(buffer);
+#endif
+ }
+ void show() {
+#ifdef WIN32
+ release_bitmap(buffer);
+#endif
+ show_video_bitmap(buffer);
+ }
+ void update() {
+ current_page++;
+ if(current_page=2) {
+ current_page = 0;
+ }
+ buffer = page[current_page];
+ }
+};
+
+class MemorySurface : public Surface {
+ public:
+ MemorySurface(BITMAP *buffer) {
+ this->buffer = buffer;
+ }
+ ~MemorySurface() {
+ destroy_bitmap(buffer);
+ }
+ void lock() {
+ }
+ void show() {
+ blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
+ }
+ void update() {
+ }
+};
+
+class GraphicEngine {
+ private:
+ Surface *surface;
+ Spriteset *tileset;
+ public:
+ GraphicEngine();
+ ~GraphicEngine();
+ void refresh();
+};
+
#endif