progress
This commit is contained in:
parent
9cc318cf27
commit
0e572d7f89
|
@ -24,6 +24,7 @@ namespace SHADE
|
||||||
/* Static defines */
|
/* Static defines */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
bool SHInputManager::mouseCentering = false;
|
||||||
bool SHInputManager::controllerInUse = false;
|
bool SHInputManager::controllerInUse = false;
|
||||||
|
|
||||||
std::map<std::string, SHInputManager::SHLogicalBindingData> SHInputManager::bindings;
|
std::map<std::string, SHInputManager::SHLogicalBindingData> SHInputManager::bindings;
|
||||||
|
@ -806,16 +807,15 @@ namespace SHADE
|
||||||
|
|
||||||
|
|
||||||
//Mouse Centering
|
//Mouse Centering
|
||||||
if (GetKey(SH_KEYCODE::Q))
|
if (mouseCentering)
|
||||||
{
|
{
|
||||||
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
|
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
|
||||||
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
|
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
|
||||||
SetMouseWindowPosition(width / 2, height / 2);
|
SetMouseWindowPosition(width / 2, height / 2);
|
||||||
|
|
||||||
//This four lines help a lot
|
//These four lines help a lot
|
||||||
POINT p;
|
POINT p;
|
||||||
GetCursorPos(&p);
|
GetCursorPos(&p);
|
||||||
|
|
||||||
mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt;
|
mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt;
|
||||||
mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt;
|
mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1074,6 +1074,18 @@ namespace SHADE
|
||||||
SetCursorPos(p.x, p.y);
|
SetCursorPos(p.x, p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Call to set the flag to start mouse centering every frame
|
||||||
|
static inline void SetMouseCentering(bool state) noexcept
|
||||||
|
{
|
||||||
|
mouseCentering = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get the flag whether mouse centering is on or not
|
||||||
|
static inline bool GetMouseCentering() noexcept
|
||||||
|
{
|
||||||
|
return mouseCentering;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Constants */
|
/* Constants */
|
||||||
|
@ -1097,6 +1109,9 @@ namespace SHADE
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//Whether mouse centering will be called every frame or not
|
||||||
|
static bool mouseCentering;
|
||||||
|
|
||||||
//If the last input is from controller(s) or KB/M
|
//If the last input is from controller(s) or KB/M
|
||||||
//True if from controller(s), False if from KB/M
|
//True if from controller(s), False if from KB/M
|
||||||
//Useful for switching control hints between controllers and KB/M
|
//Useful for switching control hints between controllers and KB/M
|
||||||
|
|
Loading…
Reference in New Issue