Added follow cam

Added "Controlled" mesh classes
Added Global Lighting Class
Added Gamepad controls
Split terrain nodes into Height and Perlin classes
Fixed Splitmesh node stuff
This commit is contained in:
iDunnoDev
2022-05-09 17:50:22 +01:00
committed by iDunnoDev
parent bc906064e5
commit f6bba67897
58 changed files with 1743 additions and 351 deletions

View File

@ -11,7 +11,7 @@ GamePadController::~GamePadController(void)
{
}
void GamePadController::ProcessGameController()
void GamePadController::ProcessGameController(set<ControlInputs>& currentInputs, bool &boostHit)
{
DWORD magnitudeSquared;
@ -40,11 +40,29 @@ void GamePadController::ProcessGameController()
// check if the controller is inside a circular dead zone. We do it this way to avoid having to
// take the square root of the magnitude above.
if (magnitudeSquared <= _leftThumbDeadZoneSquared)
{
{
thumbLX = 0;
thumbLY = 0;
}
if (thumbLY > 0)
{
currentInputs.insert(ControlInputs::Forward);
}
else if (thumbLY < 0)
{
currentInputs.insert(ControlInputs::Back);
}
if (thumbLX > 0)
{
currentInputs.insert(ControlInputs::StrafeRight);
}
else if (thumbLX < 0)
{
currentInputs.insert(ControlInputs::StrafeLeft);
}
// Deal with the right thumb stick
SHORT thumbRX = _controllerState.Gamepad.sThumbRX;
SHORT thumbRY = _controllerState.Gamepad.sThumbRY;
@ -59,36 +77,64 @@ void GamePadController::ProcessGameController()
thumbRY = 0;
}
if (thumbRY > 0)
{
currentInputs.insert(ControlInputs::Up);
}
else if (thumbRY < 0)
{
currentInputs.insert(ControlInputs::Down);
}
if (thumbRX > 0)
{
currentInputs.insert(ControlInputs::TurnRight);
}
else if (thumbRX < 0)
{
currentInputs.insert(ControlInputs::TurnLeft);
}
// Check left and right triggers
BYTE leftTrigger = _controllerState.Gamepad.bLeftTrigger;
if (leftTrigger <= XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
{
{
leftTrigger = 0;
}
if (leftTrigger > 0)
{
boostHit = true;
}
BYTE rightTrigger = _controllerState.Gamepad.bRightTrigger;
if (rightTrigger <= XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
{
{
rightTrigger = 0;
}
if (rightTrigger)
{
currentInputs.insert(ControlInputs::Fire2);
}
// Test the different digital buttons
WORD buttons = _controllerState.Gamepad.wButtons;
if (buttons & XINPUT_GAMEPAD_DPAD_UP)
{
// Directional pad up pressed
currentInputs.insert(ControlInputs::Forward);
}
if (buttons & XINPUT_GAMEPAD_DPAD_DOWN)
{
// Directional pad down pressed
currentInputs.insert(ControlInputs::Back);
}
if (buttons & XINPUT_GAMEPAD_DPAD_LEFT)
{
// Directional pad left pressed
currentInputs.insert(ControlInputs::TurnLeft);
}
if (buttons & XINPUT_GAMEPAD_DPAD_RIGHT)
{
// Directional pad right pressed
currentInputs.insert(ControlInputs::TurnRight);
}
// Other button mask values that can be used are: