summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2003-01-21 03:00:13 +0000
committerpixel <pixel>2003-01-21 03:00:13 +0000
commit38a65f1d57c4dc65dcce9056725ce26e0474eabc (patch)
tree5cd44b75ad4a152fb299f33994a17c76b4fadd11 /lib
parentcbb8340d3b139596e94f2caa3ca51577d8fa3d0e (diff)
Fixing more things...
Diffstat (limited to 'lib')
-rw-r--r--lib/engine.cc28
-rw-r--r--lib/glbase.cc2
-rw-r--r--lib/gltexture.cc10
3 files changed, 35 insertions, 5 deletions
diff --git a/lib/engine.cc b/lib/engine.cc
index d065346..fac660e 100644
--- a/lib/engine.cc
+++ b/lib/engine.cc
@@ -3,6 +3,7 @@
#define _(x) x
int mogltk::engine::inited = 0;
+bool mogltk::engine::appactive = false, mogltk::engine::cursorvisible = false;
int mogltk::engine::setup() throw(GeneralException) {
if (inited) {
@@ -14,8 +15,6 @@ int mogltk::engine::setup() throw(GeneralException) {
}
atexit(SDL_Quit);
- SDL_ShowCursor(0);
-
inited = 1;
return 0;
@@ -92,15 +91,22 @@ SDL_RWops * mogltk::engine::RWFromHandle(Handle * h) throw (GeneralException) {
void mogltk::engine::pollevents() {
SDL_Event event;
+ bool hastoreturn = appactive;
while(true) {
+ if (hastoreturn)
+ if (!SDL_PollEvent(NULL))
+ return;
SDL_WaitEvent(&event);
switch(event.type) {
case SDL_VIDEOEXPOSE:
printm(M_INFO, "Needs to redraw\n");
- return;
+ hastoreturn = true;
+ break;
case SDL_MOUSEMOTION:
printm(M_INFO, "Mouse has gone over the screen - (%i, %i)\n", event.motion.x, event.motion.y);
+ if (cursorvisible)
+ hastoreturn = true;
break;
case SDL_QUIT:
printm(M_INFO, "Quit requested\n");
@@ -125,3 +131,19 @@ void mogltk::engine::pollevents() {
}
}
}
+
+void mogltk::engine::setappactive(bool p) {
+ appactive = p;
+}
+
+bool mogltk::engine::getappactive() {
+ return appactive;
+}
+
+void mogltk::engine::setcursorvisible(bool p) {
+ cursorvisible = p;
+}
+
+bool mogltk::engine::getcursorvisible() {
+ return cursorvisible;
+}
diff --git a/lib/glbase.cc b/lib/glbase.cc
index 346421f..5e9a74e 100644
--- a/lib/glbase.cc
+++ b/lib/glbase.cc
@@ -64,6 +64,8 @@ int mogltk::glbase::setup(int w, int h, int flags) throw(GeneralException) {
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ SDL_ShowCursor(0);
Flip();
return 0;
diff --git a/lib/gltexture.cc b/lib/gltexture.cc
index 49a5157..76cfe5a 100644
--- a/lib/gltexture.cc
+++ b/lib/gltexture.cc
@@ -1,6 +1,5 @@
#include <sys/types.h>
#include <SDL.h>
-#include <SDL_image.h>
#include <SDL_opengl.h>
#include <generic.h>
#include "gltexture.h"
@@ -56,11 +55,16 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
SDL_Surface * temp;
+#if 0
if (!(temp = IMG_Load_RW(engine::RWFromHandle(h), 1)))
throw GeneralException(_("Can't load image from Handle ") + h->GetName());
-
+
width = temp->w;
height = temp->h;
+#else
+ width = 256;
+ height = 256;
+#endif
if ((BITCOUNT(width) != 1) || (BITCOUNT(height) != 1)) {
SDL_FreeSurface(temp);
@@ -84,8 +88,10 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
throw GeneralException(_("Can't create RGB Surface"));
}
+#if 0
SDL_BlitSurface(temp, 0, surface, 0);
SDL_FreeSurface(temp);
+#endif
#ifdef TRACE_TEXTURES
next = 0;