summaryrefslogtreecommitdiff
path: root/Screen.cpp
diff options
context:
space:
mode:
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";
+}