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:
parent
f260d83d47
commit
0373aa75d1
9
Video.cc
9
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;
|
||||
|
||||
|
5
Video.h
5
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; }
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user