From 71926d883a678be983a434f8c0da435178d7585d Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Thu, 25 Nov 2010 15:04:54 +0000 Subject: Add Screen class, move video output functionality to it --- Screen.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Screen.cpp (limited to 'Screen.cpp') 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 +#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"; +} -- cgit v1.2.3