From 0373aa75d11b51bd8bef45160e9994eea6bb9959 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 9 Oct 2009 03:02:18 +0000 Subject: [PATCH] added grab_input parameter to Video::start() git-svn-id: svn://anubis/anaglym/trunk@56 99a6e188-d820-4881-8870-2d33a10e2619 --- Video.cc | 9 ++++++--- Video.h | 5 ++--- anaglym.cc | 7 ++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Video.cc b/Video.cc index d52dde1..f576047 100644 --- a/Video.cc +++ b/Video.cc @@ -31,7 +31,7 @@ Video::Video() m_inputGrabbed = false; } -void Video::start(int width, int height, bool fullscreen) +void Video::start(int width, int height, bool fullscreen, bool grab_input) { if (m_surface == NULL) { @@ -45,8 +45,11 @@ void Video::start(int width, int height, bool fullscreen) SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); m_surface = SDL_SetVideoMode(width, height, 32, flags); - SDL_ShowCursor(SDL_DISABLE); - SDL_WM_GrabInput(SDL_GRAB_ON); + if (grab_input) + { + SDL_ShowCursor(SDL_DISABLE); + SDL_WM_GrabInput(SDL_GRAB_ON); + } m_inputGrabbed = true; m_fullscreen = fullscreen; diff --git a/Video.h b/Video.h index 849ebe3..beea11c 100644 --- a/Video.h +++ b/Video.h @@ -8,9 +8,8 @@ class Video { public: Video(); - void start(int width = 0, - int height = 0, - bool fullscreen = true); + void start(int width = 0, int height = 0, + bool fullscreen = true, bool grab_input = true); void stop(); int getDefaultWidth() { return m_defaultWidth; } int getDefaultHeight() { return m_defaultHeight; } diff --git a/anaglym.cc b/anaglym.cc index fe3053e..7adad70 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -79,7 +79,12 @@ Engine::Engine() /* setup redraw SDL event structure */ userEvent.type = SDL_USEREVENT; userEvent.user.code = 0; +#if 0 + /* start in windowed mode for debugging */ + m_video->start(0, 0, false, false); +#else m_video->start(); +#endif } Engine::~Engine() @@ -328,7 +333,7 @@ void Engine::Object::draw() { const dReal * pos = m_ode_object->getPosition(); const dReal * rot = m_ode_object->getRotation(); - bool transform = pos != NULL && rot != NULL; + bool transform = (pos != NULL && rot != NULL); if (transform) OdeWorld::pushTransform(pos, rot);