summaryrefslogtreecommitdiff
path: root/lib/base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base.cc')
-rw-r--r--lib/base.cc28
1 files changed, 11 insertions, 17 deletions
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;
+}