summaryrefslogtreecommitdiff
path: root/Screen.cpp
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2010-11-25 15:04:54 +0000
committerLuke Bratch <l_bratch@yahoo.co.uk>2010-11-25 15:04:54 +0000
commit71926d883a678be983a434f8c0da435178d7585d (patch)
tree0d3598d060ae153aa129eb9eeddeb66f0c48717a /Screen.cpp
parent3383e8be9001826bf0d09f1fb73ad5013cc8627e (diff)
Add Screen class, move video output functionality to it
Diffstat (limited to 'Screen.cpp')
-rw-r--r--Screen.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Screen.cpp b/Screen.cpp
new file mode 100644
index 0000000..5a0b157
--- /dev/null
+++ b/Screen.cpp
@@ -0,0 +1,26 @@
+#include <iostream>
+#include "Screen.h"
+
+Screen::Screen() {
+ // Turn on the main screen
+ if (!(screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE)))
+ std::cout << "Error setting video mode.\n";
+
+ // Set window title
+ SDL_WM_SetCaption("Intense Marcus", NULL);
+}
+
+void Screen::blit(int x, int y, SDL_Surface* src, SDL_Surface* dst, SDL_Rect* clip) {
+ // Destination position
+ SDL_Rect pos;
+
+ pos.x = x;
+ pos.y = y;
+
+ SDL_BlitSurface(src, clip, dst, &pos);
+}
+
+void Screen::flip() {
+ if (SDL_Flip(screen) == -1)
+ std::cout << "Error flipping screen.\n";
+}