From 541c00c93fcd98f766cce661aa83ef4ffe713e57 Mon Sep 17 00:00:00 2001 From: pixel Date: Fri, 28 Mar 2003 12:30:26 +0000 Subject: First part of the backend separation --- lib/base.cc | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'lib/base.cc') diff --git a/lib/base.cc b/lib/base.cc index 049f53c..8741978 100644 --- a/lib/base.cc +++ b/lib/base.cc @@ -8,12 +8,7 @@ #endif #include "gettext.h" -int mogltk::base::setup(int w, int h, int flags) : surface(0) throw(GeneralException) { - if (inited) { - printm(M_WARNING, "mogltk::base::setup called twice, ignoring second call...\n"); - return -1; - } - +mogltk::base::base(int w, int h, int flags) throw(GeneralException) : surface(0) { width = w; height = h; @@ -33,15 +28,16 @@ int mogltk::base::setup(int w, int h, int flags) : surface(0) throw(GeneralExcep printm(M_INFO, "Video resolution: %dx%dx%d (ratio = %3.2f)\n", surface->w, surface->h, surface->format->BitsPerPixel, ratio); - inited = 1; - SDL_ShowCursor(0); SDL_FillRect(surface, NULL, 0); - SDL_SwapBuffers(); + SDL_Flip(surface); SDL_FillRect(surface, NULL, 0); mogltk::engine::postsetup(); } +mogltk::base::~base() { +} + int mogltk::base::GetWidth(void) { return width; } @@ -50,23 +46,17 @@ int mogltk::base::GetHeight(void) { return height; } -int mogltk::base::GetInited(void) { - return inited; -} - void mogltk::base::Flip() { printm(M_INFO, "Flipping\n"); mogltk::engine::pollevents(); - SDL_SwapBuffers(); + SDL_Flip(surface); SDL_FillRect(surface, NULL, 0); } -int mogltk::base::setup(int w, int h, int flags) : surface(0) { +mogltk::base::base(int w, int h, int flags, int) : surface(0) { width = w; height = h; - inited = 1; - SDL_ShowCursor(0); } @@ -75,3 +65,7 @@ void mogltk::base::setsurface(SDL_Surface * _surface) throw (GeneralException) { throw GeneralException("Can't set video surface twice"); surface = _surface; } + +SDL_Surface * mogltk::base::getsurface() { + return surface; +} -- cgit v1.2.3