In UpdateControls we will need access to the games context which is the renderable area of the window, which is essentially the area of the game window inside the windows border. We use this context to find the center of the screen and store the coordinates as sx and sy.
Context* context = Context::GetCurrent();
//Get the mouse movement
float sx = context->GetWidth()/2;
float sy = context->GetHeight()/2;
Next we save the current mouse position and then return the mouse to the center of the screen:
//Get the mouse position
Vec3 mouseposition = window->GetMousePosition();
//Move the mouse to the center of the screen
Now that we know where the center of the screen is and the current mouse position we can figure out the difference between the two which tells us which direction to look:
//Get change in mouse position
float dx = mouseposition.x - sx;
float dy = mouseposition.y - sy;
We want to set the mouse speed by smoothing between the previous mouse speed and the distance from the center of the screen.