Implemented Input Functions via C# #358
|
@ -24,6 +24,7 @@ namespace SHADE
|
|||
/* Static defines */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
bool SHInputManager::mouseCentering = false;
|
||||
bool SHInputManager::controllerInUse = false;
|
||||
|
||||
std::map<std::string, SHInputManager::SHLogicalBindingData> SHInputManager::bindings;
|
||||
|
@ -806,16 +807,15 @@ namespace SHADE
|
|||
|
||||
|
||||
//Mouse Centering
|
||||
if (GetKey(SH_KEYCODE::Q))
|
||||
if (mouseCentering)
|
||||
{
|
||||
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
|
||||
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
|
||||
SetMouseWindowPosition(width / 2, height / 2);
|
||||
|
||||
//This four lines help a lot
|
||||
//These four lines help a lot
|
||||
POINT p;
|
||||
GetCursorPos(&p);
|
||||
|
||||
mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt;
|
||||
mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt;
|
||||
}
|
||||
|
|
|
@ -1074,6 +1074,18 @@ namespace SHADE
|
|||
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:
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Constants */
|
||||
|
@ -1097,6 +1109,9 @@ namespace SHADE
|
|||
/* 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
|
||||
//True if from controller(s), False if from KB/M
|
||||
//Useful for switching control hints between controllers and KB/M
|
||||
|
|
Loading…
Reference in New Issue