Implemented Input Functions via C# #358

Merged
mushgunAX merged 5 commits from SP3-10-input-management into main 2023-02-23 14:00:26 +08:00
3 changed files with 42 additions and 1 deletions
Showing only changes of commit fe64844c4e - Show all commits

View File

@ -9682,6 +9682,7 @@
aimingLength: 1
throwItem: false
rayDistance: 0.75
rayHeight: 0.100000001
- EID: 3
Name: HoldingPoint
IsActive: true

View File

@ -14,6 +14,9 @@
#include <fstream>
#include "SHInputManager.h"
#include "../Tools/SHException.h"
#include <Graphics/Windowing/SHWindow.h>
#include <Graphics/MiddleEnd/Interface/SHGraphicsSystem.h>
#include <Graphics/MiddleEnd/Interface/SHGraphicsSystemInterface.h>
namespace SHADE
{
@ -801,6 +804,23 @@ namespace SHADE
mouseVelocityX = static_cast<double>(mouseScreenX - mouseScreenXLast) / dt;
mouseVelocityY = static_cast<double>(mouseScreenY - mouseScreenYLast) / dt;
//Mouse Centering
if (GetKey(SH_KEYCODE::Q))
{
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
SetMouseWindowPosition(width / 2, height / 2);
//This 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;
}
//Mouse wheel vertical delta updating
mouseWheelVerticalDelta = 0;
mouseWheelVerticalDelta = mouseWheelVerticalDeltaPoll;

View File

@ -181,7 +181,6 @@ namespace SHADE
//Break
//Menu
//Mouse buttons use mouse codes, which are enums declared later
//TODO Controller input
#if 0
Space = static_cast<int>(SHInputManager::SH_KEYCODE::SPACE),
//Apostrophe = static_cast<int>(SHInputManager::SH_KEYCODE::APOSTROPHE),
@ -355,6 +354,27 @@ namespace SHADE
Button3 = static_cast<int>(SHInputManager::SH_KEYCODE::XMB1),
Button4 = static_cast<int>(SHInputManager::SH_KEYCODE::XMB2)
};
enum class ControllerCode : int
{
DpadUp = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::DPAD_UP),
DpadDown = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::DPAD_DOWN),
DpadLeft = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::DPAD_LEFT),
DpadRight = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::DPAD_RIGHT),
Start = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::START),
Back = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::BACK),
LeftThumbstickButton = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::LEFT_THUMBSTICK),
RightThumbstickButton = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::RIGHT_THUMBSTICK),
LeftShoulder = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::LEFT_SHOULDER),
RightShoulder = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::RIGHT_SHOULDER),
AButton = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::A),
BButton = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::B),
XButton = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::X),
YButton = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::Y),
LeftTrigger = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::LEFT_TRIGGER),
RightTrigger = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::RIGHT_TRIGGER),
LeftThumbStickX = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::LEFT_THUMBSTICK_X),
LeftThumbStickY = static_cast<int>(SHInputManager::SH_CONTROLLERCODE::LEFT_THUMBSTICK_Y)
};
/*-----------------------------------------------------------------------------*/
/* Properites */