added grab_input parameter to Video::start()

git-svn-id: svn://anubis/anaglym/trunk@56 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-09 03:02:18 +00:00
parent f260d83d47
commit 0373aa75d1
3 changed files with 14 additions and 7 deletions

View File

@ -31,7 +31,7 @@ Video::Video()
m_inputGrabbed = false; 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) if (m_surface == NULL)
{ {
@ -45,8 +45,11 @@ void Video::start(int width, int height, bool fullscreen)
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
m_surface = SDL_SetVideoMode(width, height, 32, flags); m_surface = SDL_SetVideoMode(width, height, 32, flags);
if (grab_input)
{
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
SDL_WM_GrabInput(SDL_GRAB_ON); SDL_WM_GrabInput(SDL_GRAB_ON);
}
m_inputGrabbed = true; m_inputGrabbed = true;
m_fullscreen = fullscreen; m_fullscreen = fullscreen;

View File

@ -8,9 +8,8 @@ class Video
{ {
public: public:
Video(); Video();
void start(int width = 0, void start(int width = 0, int height = 0,
int height = 0, bool fullscreen = true, bool grab_input = true);
bool fullscreen = true);
void stop(); void stop();
int getDefaultWidth() { return m_defaultWidth; } int getDefaultWidth() { return m_defaultWidth; }
int getDefaultHeight() { return m_defaultHeight; } int getDefaultHeight() { return m_defaultHeight; }

View File

@ -79,7 +79,12 @@ Engine::Engine()
/* setup redraw SDL event structure */ /* setup redraw SDL event structure */
userEvent.type = SDL_USEREVENT; userEvent.type = SDL_USEREVENT;
userEvent.user.code = 0; userEvent.user.code = 0;
#if 0
/* start in windowed mode for debugging */
m_video->start(0, 0, false, false);
#else
m_video->start(); m_video->start();
#endif
} }
Engine::~Engine() Engine::~Engine()
@ -328,7 +333,7 @@ void Engine::Object::draw()
{ {
const dReal * pos = m_ode_object->getPosition(); const dReal * pos = m_ode_object->getPosition();
const dReal * rot = m_ode_object->getRotation(); const dReal * rot = m_ode_object->getRotation();
bool transform = pos != NULL && rot != NULL; bool transform = (pos != NULL && rot != NULL);
if (transform) if (transform)
OdeWorld::pushTransform(pos, rot); OdeWorld::pushTransform(pos, rot);