Grab the mouse while in-game (#1637)

This only implements this for the SDL port for now.
liquid_container
Lukas Werling 2016-02-11 22:55:45 +01:00 committed by Günther Brammer
parent f505b31032
commit 24ef8b43af
6 changed files with 25 additions and 0 deletions

View File

@ -695,12 +695,16 @@ void C4Application::GameTick()
}
if(Config.Graphics.Windowed == 2 && FullScreenMode())
Application.SetVideoMode(GetConfigWidth(), GetConfigHeight(), Config.Graphics.RefreshRate, Config.Graphics.Monitor, true);
if (!isEditor)
pWindow->GrabMouse(true);
break;
case C4AS_AfterGame:
// stop game
Game.Clear();
if(Config.Graphics.Windowed == 2 && !NextMission && !isEditor)
Application.SetVideoMode(GetConfigWidth(), GetConfigHeight(), Config.Graphics.RefreshRate, Config.Graphics.Monitor, false);
if (!isEditor)
pWindow->GrabMouse(false);
AppState = C4AS_PreInit;
// if a next mission is desired, set to start it
if (NextMission)

View File

@ -381,6 +381,7 @@ public:
void SetSize(unsigned int cx, unsigned int cy); // resize
void SetTitle(const char * Title);
void FlashWindow();
void GrabMouse(bool grab);
// request that this window be redrawn in the near future (including immediately)
virtual void RequestUpdate();
// Invokes actual drawing code - should not be called directly

View File

@ -605,6 +605,11 @@ void C4Window::FlashWindow()
//FIXME - how is this reset? gtk_window_set_urgency_hint(window, true);
}
void C4Window::GrabMouse(bool grab)
{
// TODO
}
C4Window* C4Window::Init(WindowKind windowKind, C4AbstractApp * pApp, const char * Title, const C4Rect * size)
{
Active = true;

View File

@ -136,6 +136,11 @@ void C4Window::SetSize(unsigned int cx, unsigned int cy)
[controller setContentSize:NSMakeSize(cx, cy)];
}
void C4Window::GrabMouse(bool grab)
{
// TODO
}
void C4Window::RequestUpdate()
{
[ctrler.openGLView display];

View File

@ -119,3 +119,8 @@ void C4Window::RequestUpdate()
void C4Window::FlashWindow()
{
}
void C4Window::GrabMouse(bool grab)
{
SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE);
}

View File

@ -761,6 +761,11 @@ void C4Window::FlashWindow()
::FlashWindow(hWindow, FLASHW_ALL | FLASHW_TIMERNOFG);
}
void C4Window::GrabMouse(bool grab)
{
// TODO
}
void C4Window::EnumerateMultiSamples(std::vector<int>& samples) const
{
#ifndef USE_CONSOLE