forked from pieeebot/Cafeberry-4JLibs
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c24c663ef | ||
|
|
842fb91443 | ||
|
|
f549c757b9 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
x64/
|
||||
4J_*/x64/
|
||||
Debug/
|
||||
ipch/
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ CKeyboard InternalKeyboard;
|
||||
void C_4JInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
|
||||
{
|
||||
InternalInputManager.Initialise(iInputStateC, ucMapC, ucActionC, ucMenuActionC);
|
||||
InternalKeyboard.Init();
|
||||
}
|
||||
|
||||
void C_4JInput::Tick(void)
|
||||
@@ -40,10 +39,6 @@ void C_4JInput::Tick(void)
|
||||
InternalInputManager.Tick();
|
||||
}
|
||||
|
||||
void C_4JInput::TickKBM(void)
|
||||
{
|
||||
InternalKeyboard.Tick();
|
||||
}
|
||||
void C_4JInput::SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax)
|
||||
{
|
||||
InternalInputManager.SetDeadzoneAndMovementRange(uiDeadzone, uiMovementRangeMax);
|
||||
@@ -79,11 +74,6 @@ unsigned int C_4JInput::GetValue(int iPad, unsigned char ucAction, bool bRepeat)
|
||||
return InternalInputManager.GetValue(iPad, ucAction, bRepeat);
|
||||
}
|
||||
|
||||
void C_4JInput::MapTouchInput(int iPad, int button)
|
||||
{
|
||||
InternalInputManager.MapTouchInput(iPad, button);
|
||||
}
|
||||
|
||||
bool C_4JInput::ButtonPressed(int iPad, unsigned char ucAction)
|
||||
{
|
||||
return InternalInputManager.ButtonPressed(iPad, ucAction);
|
||||
@@ -129,11 +119,6 @@ bool C_4JInput::IsPadConnected(int iPad)
|
||||
return InternalInputManager.IsPadConnected(iPad);
|
||||
}
|
||||
|
||||
bool C_4JInput::IsPadActive(int iPad)
|
||||
{
|
||||
return InternalInputManager.IsPadActive(iPad);
|
||||
}
|
||||
|
||||
float C_4JInput::GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay)
|
||||
{
|
||||
return InternalInputManager.GetJoypadStick_LX(iPad, bCheckMenuDisplay);
|
||||
@@ -169,171 +154,6 @@ void C_4JInput::SetMenuDisplayed(int iPad, bool bVal)
|
||||
InternalInputManager.SetMenuDisplayed(iPad, bVal);
|
||||
}
|
||||
|
||||
void C_4JInput::OnKeyDown(int vkCode)
|
||||
{
|
||||
InternalKeyboard.OnKeyDown(vkCode);
|
||||
}
|
||||
|
||||
void C_4JInput::OnKeyUp(int vkCode)
|
||||
{
|
||||
InternalKeyboard.OnKeyUp(vkCode);
|
||||
}
|
||||
|
||||
void C_4JInput::OnChar(wchar_t ch)
|
||||
{
|
||||
InternalKeyboard.OnChar(ch);
|
||||
}
|
||||
|
||||
bool C_4JInput::IsKeyDown(int vkCode) const
|
||||
{
|
||||
return InternalKeyboard.IsKeyDown(vkCode);
|
||||
}
|
||||
|
||||
bool C_4JInput::IsKeyPressed(int vkCode) const
|
||||
{
|
||||
return InternalKeyboard.IsKeyPressed(vkCode);
|
||||
}
|
||||
|
||||
bool C_4JInput::IsKeyReleased(int vkCode) const
|
||||
{
|
||||
return InternalKeyboard.IsKeyReleased(vkCode);
|
||||
}
|
||||
|
||||
int C_4JInput::GetMouseX() const
|
||||
{
|
||||
return InternalKeyboard.GetMouseX();
|
||||
}
|
||||
|
||||
int C_4JInput::GetMouseY() const
|
||||
{
|
||||
return InternalKeyboard.GetMouseY();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsMouseLDown() const
|
||||
{
|
||||
return InternalKeyboard.IsLButtonDown();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsLButtonPressed() const
|
||||
{
|
||||
return InternalKeyboard.IsLButtonPressed();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsLButtonReleased() const
|
||||
{
|
||||
return InternalKeyboard.IsLButtonReleased();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsMouseRDown() const
|
||||
{
|
||||
return InternalKeyboard.IsRButtonDown();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsRButtonPressed() const
|
||||
{
|
||||
return InternalKeyboard.IsRButtonPressed();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsRButtonReleased() const
|
||||
{
|
||||
return InternalKeyboard.IsRButtonReleased();
|
||||
}
|
||||
|
||||
int C_4JInput::GetMouseWheelDelta() const
|
||||
{
|
||||
return InternalKeyboard.GetMouseWheelDelta();
|
||||
}
|
||||
|
||||
wchar_t C_4JInput::GetLastChar() const
|
||||
{
|
||||
return InternalKeyboard.GetLastChar();
|
||||
}
|
||||
|
||||
bool C_4JInput::HasChar() const
|
||||
{
|
||||
return InternalKeyboard.HasChar();
|
||||
}
|
||||
|
||||
wchar_t C_4JInput::GetChar(int index) const
|
||||
{
|
||||
return InternalKeyboard.GetChar(index);
|
||||
}
|
||||
|
||||
void C_4JInput::OnMouseMove(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnMouseMove(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnRawMouseDelta(int dx, int dy)
|
||||
{
|
||||
InternalKeyboard.OnRawMouseDelta(dx, dy);
|
||||
}
|
||||
|
||||
void C_4JInput::OnLButtonDown(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnLButtonDown(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnLButtonUp(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnLButtonUp(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnRButtonDown(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnRButtonDown(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnRButtonUp(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnRButtonUp(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnMButtonDown(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnMButtonDown(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnMButtonUp(int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnMButtonUp(x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::OnMouseWheel(int delta, int x, int y)
|
||||
{
|
||||
InternalKeyboard.OnMouseWheel(delta, x, y);
|
||||
}
|
||||
|
||||
void C_4JInput::SetMouseCaptured(bool captured)
|
||||
{
|
||||
InternalKeyboard.SetMouseCaptured(captured);
|
||||
}
|
||||
|
||||
void C_4JInput::SetWindowFocused(bool focused)
|
||||
{
|
||||
InternalKeyboard.SetWindowFocused(focused);
|
||||
}
|
||||
|
||||
bool C_4JInput::IsMouseCaptured() const
|
||||
{
|
||||
return InternalKeyboard.IsMouseCaptured();
|
||||
}
|
||||
|
||||
void C_4JInput::SetMousePos(int x, int y)
|
||||
{
|
||||
InternalKeyboard.SetMousePos(x, y);
|
||||
}
|
||||
|
||||
int C_4JInput::GetRawMouseX() const
|
||||
{
|
||||
return InternalKeyboard.GetRawMouseX();
|
||||
}
|
||||
|
||||
int C_4JInput::GetRawMouseY() const
|
||||
{
|
||||
return InternalKeyboard.GetRawMouseY();
|
||||
}
|
||||
|
||||
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||
C_4JInput::EKeyboardMode eMode)
|
||||
{
|
||||
|
||||
@@ -24,231 +24,7 @@ SOFTWARE.
|
||||
|
||||
#include "INP_Keyboard.h"
|
||||
|
||||
CKeyboard::CKeyboard()
|
||||
{
|
||||
m_lParam = nullptr;
|
||||
m_onInput = nullptr;
|
||||
ZeroMemory(m_chrText, sizeof(m_chrText));
|
||||
|
||||
memset(m_keysPrev, 0, sizeof(m_keysPrev));
|
||||
memset(m_keysCurr, 0, sizeof(m_keysCurr));
|
||||
m_mouseX = m_mouseY = 0;
|
||||
m_lButtonPrev = m_lButtonCurr = false;
|
||||
m_rButtonPrev = m_rButtonCurr = false;
|
||||
m_mButtonPrev = m_mButtonCurr = false;
|
||||
m_mouseWheel = 0;
|
||||
memset(m_charBuffer, 0, sizeof(m_charBuffer));
|
||||
m_charCount = 0;
|
||||
m_mouseCaptured = false;
|
||||
m_mouseDeltaX = m_mouseDeltaY = 0;
|
||||
m_windowFocused = true;
|
||||
}
|
||||
|
||||
void CKeyboard::Init()
|
||||
{
|
||||
RAWINPUTDEVICE rid;
|
||||
rid.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC
|
||||
rid.usUsage = 0x02; // HID_USAGE_GENERIC_MOUSE
|
||||
rid.dwFlags = 0;
|
||||
rid.hwndTarget = g_hWnd;
|
||||
RegisterRawInputDevices(&rid, 1, sizeof(rid));
|
||||
}
|
||||
|
||||
void CKeyboard::Tick(void)
|
||||
{
|
||||
memcpy(m_keysPrev, m_keysCurr, sizeof(m_keysCurr));
|
||||
m_lButtonPrev = m_lButtonCurr;
|
||||
m_rButtonPrev = m_rButtonCurr;
|
||||
m_mButtonPrev = m_mButtonCurr;
|
||||
m_mouseWheel = 0;
|
||||
m_charCount = 0;
|
||||
m_mouseDeltaX = m_mouseDeltaAccumX;
|
||||
m_mouseDeltaY = m_mouseDeltaAccumY;
|
||||
m_mouseDeltaAccumX = 0;
|
||||
m_mouseDeltaAccumY = 0;
|
||||
|
||||
if (m_mouseCaptured && g_hWnd && m_windowFocused && g_hWnd)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
POINT center;
|
||||
center.x = (rc.right - rc.left) / 2;
|
||||
center.y = (rc.bottom - rc.top) / 2;
|
||||
ClientToScreen(g_hWnd, ¢er);
|
||||
SetCursorPos(center.x, center.y);
|
||||
}
|
||||
}
|
||||
|
||||
void CKeyboard::OnKeyDown(int vkCode)
|
||||
{
|
||||
if (vkCode >= 0 && vkCode < MAX_KEYS)
|
||||
{
|
||||
m_keysCurr[vkCode] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CKeyboard::OnKeyUp(int vkCode)
|
||||
{
|
||||
if (vkCode >= 0 && vkCode < MAX_KEYS)
|
||||
{
|
||||
m_keysCurr[vkCode] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CKeyboard::OnChar(wchar_t ch)
|
||||
{
|
||||
if (m_charCount < MAX_CHARS_PER_FRAME)
|
||||
{
|
||||
m_charBuffer[m_charCount++] = ch;
|
||||
}
|
||||
}
|
||||
|
||||
bool CKeyboard::IsKeyDown(int vkCode) const
|
||||
{
|
||||
if (vkCode >= 0 && vkCode < MAX_KEYS)
|
||||
return m_keysCurr[vkCode];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CKeyboard::IsKeyPressed(int vkCode) const
|
||||
{
|
||||
if (vkCode >= 0 && vkCode < MAX_KEYS)
|
||||
return m_keysCurr[vkCode] && !m_keysPrev[vkCode];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CKeyboard::IsKeyReleased(int vkCode) const
|
||||
{
|
||||
if (vkCode >= 0 && vkCode < MAX_KEYS)
|
||||
return !m_keysCurr[vkCode] && m_keysPrev[vkCode];
|
||||
return false;
|
||||
}
|
||||
|
||||
void CKeyboard::OnMouseMove(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
}
|
||||
|
||||
void CKeyboard::OnRawMouseDelta(int dx, int dy)
|
||||
{
|
||||
m_mouseDeltaAccumX += dx;
|
||||
m_mouseDeltaAccumY += dy;
|
||||
}
|
||||
|
||||
void CKeyboard::OnLButtonDown(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_lButtonCurr = true;
|
||||
}
|
||||
|
||||
void CKeyboard::OnLButtonUp(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_lButtonCurr = false;
|
||||
}
|
||||
|
||||
void CKeyboard::OnRButtonDown(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_rButtonCurr = true;
|
||||
}
|
||||
|
||||
void CKeyboard::OnRButtonUp(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_rButtonCurr = false;
|
||||
}
|
||||
|
||||
void CKeyboard::OnMButtonDown(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_mButtonCurr = true;
|
||||
}
|
||||
|
||||
void CKeyboard::OnMButtonUp(int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_mButtonCurr = false;
|
||||
}
|
||||
|
||||
void CKeyboard::OnMouseWheel(int delta, int x, int y)
|
||||
{
|
||||
m_mouseX = x;
|
||||
m_mouseY = y;
|
||||
m_mouseWheel += delta;
|
||||
}
|
||||
|
||||
void CKeyboard::SetMouseCaptured(bool grabbed)
|
||||
{
|
||||
if (m_mouseCaptured == grabbed)
|
||||
return;
|
||||
|
||||
m_mouseCaptured = grabbed;
|
||||
if (grabbed && g_hWnd)
|
||||
{
|
||||
while (ShowCursor(FALSE) >= 0) {}
|
||||
RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
POINT topLeft = { rc.left, rc.top };
|
||||
POINT bottomRight = { rc.right, rc.bottom };
|
||||
ClientToScreen(g_hWnd, &topLeft);
|
||||
ClientToScreen(g_hWnd, &bottomRight);
|
||||
RECT clipRect = { topLeft.x, topLeft.y, bottomRight.x, bottomRight.y };
|
||||
ClipCursor(&clipRect);
|
||||
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
POINT center;
|
||||
center.x = (rc.right - rc.left) / 2;
|
||||
center.y = (rc.bottom - rc.top) / 2;
|
||||
ClientToScreen(g_hWnd, ¢er);
|
||||
SetCursorPos(center.x, center.y);
|
||||
|
||||
m_mouseDeltaAccumX = 0;
|
||||
m_mouseDeltaAccumY = 0;
|
||||
}
|
||||
else if (!grabbed && g_hWnd)
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void CKeyboard::SetWindowFocused(bool focused)
|
||||
{
|
||||
m_windowFocused = focused;
|
||||
if (focused)
|
||||
{
|
||||
if (m_mouseCaptured)
|
||||
{
|
||||
while (ShowCursor(FALSE) >= 0) {}
|
||||
RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
POINT center;
|
||||
center.x = (rc.right - rc.left) / 2;
|
||||
center.y = (rc.bottom - rc.top) / 2;
|
||||
ClientToScreen(g_hWnd, ¢er);
|
||||
SetCursorPos(center.x, center.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
ClipCursor(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void CKeyboard::Tick(void) {}
|
||||
|
||||
EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||
C_4JInput::EKeyboardMode eMode)
|
||||
|
||||
@@ -32,8 +32,6 @@ void SeedEditBox();
|
||||
class CKeyboard
|
||||
{
|
||||
public:
|
||||
CKeyboard();
|
||||
|
||||
enum EKeyboardProcessState
|
||||
{
|
||||
};
|
||||
@@ -42,83 +40,11 @@ public:
|
||||
{
|
||||
};
|
||||
|
||||
void Init();
|
||||
void Tick();
|
||||
void Tick(void);
|
||||
|
||||
void OnKeyDown(int vkCode);
|
||||
void OnKeyUp(int vkCode);
|
||||
void OnChar(wchar_t ch);
|
||||
|
||||
void OnMouseMove(int x, int y);
|
||||
void OnRawMouseDelta(int dx, int dy);
|
||||
void OnLButtonDown(int x, int y);
|
||||
void OnLButtonUp(int x, int y);
|
||||
void OnRButtonDown(int x, int y);
|
||||
void OnRButtonUp(int x, int y);
|
||||
void OnMButtonDown(int x, int y);
|
||||
void OnMButtonUp(int x, int y);
|
||||
void OnMouseWheel(int delta, int x, int y);
|
||||
|
||||
bool IsKeyDown(int vkCode) const;
|
||||
bool IsKeyPressed(int vkCode) const;
|
||||
bool IsKeyReleased(int vkCode) const;
|
||||
|
||||
int GetMouseX() const { return m_mouseX; }
|
||||
int GetMouseY() const { return m_mouseY; }
|
||||
|
||||
int GetRawMouseX() const { return m_mouseDeltaX; }
|
||||
int GetRawMouseY() const { return m_mouseDeltaY; }
|
||||
|
||||
bool IsLButtonDown() const { return m_lButtonCurr; }
|
||||
bool IsLButtonPressed() const { return m_lButtonCurr && !m_lButtonPrev; }
|
||||
bool IsLButtonReleased() const { return !m_lButtonCurr && m_lButtonPrev; }
|
||||
|
||||
bool IsRButtonDown() const { return m_rButtonCurr; }
|
||||
bool IsRButtonPressed() const { return m_rButtonCurr && !m_rButtonPrev; }
|
||||
bool IsRButtonReleased() const { return !m_rButtonCurr && m_rButtonPrev; }
|
||||
|
||||
int GetMouseWheelDelta() const { return m_mouseWheel; }
|
||||
|
||||
wchar_t GetLastChar() const { return m_charCount > 0 ? m_charBuffer[0] : 0; }
|
||||
bool HasChar() const { return m_charCount > 0; }
|
||||
int GetCharCount() const { return m_charCount; }
|
||||
wchar_t GetChar(int index) const { return (index >= 0 && index < m_charCount) ? m_charBuffer[index] : 0; }
|
||||
|
||||
void SetMouseCaptured(bool captured);
|
||||
void SetWindowFocused(bool focused);
|
||||
bool IsMouseCaptured() const { return m_mouseCaptured; }
|
||||
|
||||
void SetMousePos(int x, int y) { m_mouseX = x; m_mouseY = y; }
|
||||
|
||||
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||
C_4JInput::EKeyboardMode eMode);
|
||||
void GetText(uint16_t *UTF16String);
|
||||
|
||||
|
||||
BYTE gap0[0x68];
|
||||
private:
|
||||
static const int MAX_KEYS = 256;
|
||||
static const int MAX_CHARS_PER_FRAME = 32;
|
||||
|
||||
bool m_keysPrev[MAX_KEYS];
|
||||
bool m_keysCurr[MAX_KEYS];
|
||||
|
||||
int m_mouseX, m_mouseY;
|
||||
bool m_lButtonPrev, m_lButtonCurr;
|
||||
bool m_rButtonPrev, m_rButtonCurr;
|
||||
bool m_mButtonPrev, m_mButtonCurr;
|
||||
int m_mouseWheel;
|
||||
|
||||
wchar_t m_charBuffer[MAX_CHARS_PER_FRAME];
|
||||
int m_charCount;
|
||||
|
||||
bool m_windowFocused;
|
||||
bool m_mouseCaptured;
|
||||
int m_mouseDeltaX, m_mouseDeltaY;
|
||||
int m_mouseDeltaAccumX, m_mouseDeltaAccumY;
|
||||
|
||||
wchar_t m_chrText[128];
|
||||
LPVOID m_lParam;
|
||||
int (*m_onInput)(LPVOID, LPCWSTR);
|
||||
|
||||
};
|
||||
@@ -30,6 +30,8 @@ SDL_Event event;
|
||||
|
||||
CInput::CInput()
|
||||
{
|
||||
m_Keyboard = CKeyboard();
|
||||
|
||||
m_uiSigninJoypadMask = 0;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
m_bIsMenuDisplayed[i] = 0;
|
||||
@@ -76,8 +78,6 @@ void CInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char uc
|
||||
m_Joypads[i].m_pucLeftTriggerAxisMap = &m_Joypads[i].m_ucLeftTriggerState;
|
||||
m_Joypads[i].m_pucRightTriggerAxisMap = &m_Joypads[i].m_ucRightTriggerState;
|
||||
m_Joypads[i].m_fSensitivity = 1.0f;
|
||||
|
||||
m_iTouchInputButton[i] = 0;
|
||||
}
|
||||
|
||||
m_JoypadMap = (unsigned int **)operator new[](ucMapC * sizeof(int *));
|
||||
@@ -96,6 +96,7 @@ void CInput::Tick(void)
|
||||
{
|
||||
HandleGamepadEvents();
|
||||
UpdateJoypads();
|
||||
m_Keyboard.Tick();
|
||||
}
|
||||
|
||||
void CInput::SetJoypadValues(JOYPAD *pThisPad)
|
||||
@@ -337,11 +338,6 @@ unsigned char CInput::GetJoypadMapVal(int iPad)
|
||||
return m_Joypads[iPad].m_ucMappingValue;
|
||||
}
|
||||
|
||||
void CInput::MapTouchInput(int iPad, int button)
|
||||
{
|
||||
m_iTouchInputButton[iPad] |= button;
|
||||
}
|
||||
|
||||
void CInput::SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
|
||||
{
|
||||
float *pfTo = nullptr;
|
||||
@@ -409,11 +405,6 @@ bool CInput::IsPadConnected(int iPad)
|
||||
return m_Joypads[iPad].m_bIsConnected;
|
||||
}
|
||||
|
||||
bool CInput::IsPadActive(int iPad)
|
||||
{
|
||||
return m_Joypads[iPad].m_bControllerActive;
|
||||
}
|
||||
|
||||
void CInput::SetSigninJoypadMask(unsigned int mask)
|
||||
{
|
||||
m_uiSigninJoypadMask = mask;
|
||||
@@ -765,39 +756,27 @@ bool CInput::UpdateJoypads()
|
||||
if (pThisPad->m_bIsConnected)
|
||||
{
|
||||
SetJoypadValues(pThisPad);
|
||||
|
||||
pThisPad->m_uiButtonsPressed = ~pThisPad->m_uiOldButtons & pThisPad->m_uiButtons;
|
||||
pThisPad->m_uiButtonsReleased = ~pThisPad->m_uiButtons & pThisPad->m_uiOldButtons;
|
||||
|
||||
for (int bit = 0; bit < 24; ++bit)
|
||||
{
|
||||
if ((pThisPad->m_uiButtonsPressed & (1 << bit)) != 0)
|
||||
{
|
||||
GetStartTime(i, bit);
|
||||
}
|
||||
else if ((pThisPad->m_uiButtons & (1 << bit)) != 0)
|
||||
{
|
||||
UpdateTime(i, bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pThisPad->m_bWasConnected)
|
||||
{
|
||||
ClearJoypadValues(pThisPad);
|
||||
}
|
||||
|
||||
if (m_iTouchInputButton[i])
|
||||
{
|
||||
pThisPad->m_uiButtons |= m_iTouchInputButton[i];
|
||||
}
|
||||
|
||||
m_iTouchInputButton[i] = 0;
|
||||
|
||||
pThisPad->m_uiButtonsPressed = ~pThisPad->m_uiOldButtons & pThisPad->m_uiButtons;
|
||||
pThisPad->m_uiButtonsReleased = ~pThisPad->m_uiButtons & pThisPad->m_uiOldButtons;
|
||||
|
||||
for (int bit = 0; bit < 24; ++bit)
|
||||
{
|
||||
if ((pThisPad->m_uiButtonsPressed & (1 << bit)) != 0)
|
||||
{
|
||||
GetStartTime(i, bit);
|
||||
}
|
||||
else if ((pThisPad->m_uiButtons & (1 << bit)) != 0)
|
||||
{
|
||||
UpdateTime(i, bit);
|
||||
}
|
||||
}
|
||||
|
||||
if (pThisPad->m_uiButtonsPressed)
|
||||
pThisPad->m_bControllerActive = true;
|
||||
else
|
||||
pThisPad->m_bControllerActive = false;
|
||||
|
||||
if (m_pDebugSequenceFn && (pThisPad->m_uiButtonsPressed & (_360_JOY_BUTTON_A | _360_JOY_BUTTON_B | _360_JOY_BUTTON_X | _360_JOY_BUTTON_Y |
|
||||
_360_JOY_BUTTON_RB | _360_JOY_BUTTON_LB)) != 0)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,6 @@ public:
|
||||
bool m_bIsConnected;
|
||||
bool m_bWasConnected;
|
||||
bool m_bHasConnected;
|
||||
bool m_bControllerActive;
|
||||
|
||||
unsigned int m_uiButtons;
|
||||
unsigned int m_uiOldButtons;
|
||||
@@ -126,12 +125,10 @@ public:
|
||||
void SetJoypadMapVal(int iPad, unsigned char ucMap);
|
||||
unsigned char GetJoypadMapVal(int iPad);
|
||||
|
||||
void MapTouchInput(int iPad, int button);
|
||||
void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
|
||||
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
|
||||
|
||||
bool IsPadConnected(int iPad);
|
||||
bool IsPadActive(int iPad);
|
||||
void SetSigninJoypadMask(unsigned int mask);
|
||||
unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false);
|
||||
bool IsSet(int iPad, unsigned char ucAction);
|
||||
@@ -205,8 +202,6 @@ public:
|
||||
unsigned int m_uiDebugSequenceIndex;
|
||||
int (*m_pDebugSequenceFn)(void *);
|
||||
LPVOID m_pDebugSequenceParam;
|
||||
|
||||
unsigned int m_iTouchInputButton[MAX_JOYPADS];
|
||||
};
|
||||
|
||||
// Singleton
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -160,10 +160,6 @@
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PreLinkEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreLinkEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>./Windows64/shaders/build.bat</Command>
|
||||
</PreBuildEvent>
|
||||
@@ -208,6 +204,9 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>./Windows64/shaders/build.bat</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -101,7 +101,6 @@ public:
|
||||
|
||||
void Initialise( int iInputStateC, unsigned char ucMapC,unsigned char ucActionC, unsigned char ucMenuActionC );
|
||||
void Tick(void);
|
||||
void TickKBM(void);
|
||||
void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax );
|
||||
void SetGameJoypadMaps(unsigned char ucMap,unsigned char ucAction,unsigned int uiActionVal);
|
||||
unsigned int GetGameJoypadMaps(unsigned char ucMap,unsigned char ucAction);
|
||||
@@ -109,7 +108,6 @@ public:
|
||||
unsigned char GetJoypadMapVal(int iPad);
|
||||
void SetJoypadSensitivity(int iPad, float fSensitivity);
|
||||
unsigned int GetValue(int iPad,unsigned char ucAction, bool bRepeat=false);
|
||||
void MapTouchInput(int iPad, int button);
|
||||
bool ButtonPressed(int iPad,unsigned char ucAction=255); // toggled
|
||||
bool ButtonReleased(int iPad,unsigned char ucAction); //toggled
|
||||
bool ButtonDown(int iPad,unsigned char ucAction=255); // button held down
|
||||
@@ -120,8 +118,8 @@ public:
|
||||
void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam );
|
||||
FLOAT GetIdleSeconds(int iPad);
|
||||
bool IsPadConnected(int iPad);
|
||||
bool IsPadActive(int iPad);
|
||||
bool IsCircleCrossSwapped();
|
||||
|
||||
// In-Game values which may have been remapped due to Southpaw, swap triggers, etc
|
||||
float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay=true);
|
||||
float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay=true);
|
||||
@@ -132,51 +130,6 @@ public:
|
||||
|
||||
void SetMenuDisplayed(int iPad, bool bVal);
|
||||
|
||||
void OnKeyDown(int vkCode);
|
||||
void OnKeyUp(int vkCode);
|
||||
void OnChar(wchar_t ch);
|
||||
|
||||
void OnMouseMove(int x, int y);
|
||||
void OnRawMouseDelta(int dx, int dy);
|
||||
void OnLButtonDown(int x, int y);
|
||||
void OnLButtonUp(int x, int y);
|
||||
void OnRButtonDown(int x, int y);
|
||||
void OnRButtonUp(int x, int y);
|
||||
void OnMButtonDown(int x, int y);
|
||||
void OnMButtonUp(int x, int y);
|
||||
void OnMouseWheel(int delta, int x, int y);
|
||||
|
||||
bool IsKeyDown(int vkCode) const;
|
||||
bool IsKeyPressed(int vkCode) const;
|
||||
bool IsKeyReleased(int vkCode) const;
|
||||
|
||||
int GetMouseX() const;
|
||||
int GetMouseY() const;
|
||||
|
||||
// PIEBOT: Used to be IsLButtonDown, changed so it doesnt conflict with windowx.h
|
||||
bool IsMouseLDown() const;
|
||||
bool IsLButtonPressed() const;
|
||||
bool IsLButtonReleased() const;
|
||||
|
||||
bool IsMouseRDown() const;
|
||||
bool IsRButtonPressed() const;
|
||||
bool IsRButtonReleased() const;
|
||||
|
||||
int GetMouseWheelDelta() const;
|
||||
|
||||
wchar_t GetLastChar() const;
|
||||
bool HasChar() const;
|
||||
int GetCharCount() const;
|
||||
wchar_t GetChar(int index) const;
|
||||
|
||||
void SetMouseCaptured(bool captured);
|
||||
void SetWindowFocused(bool focused);
|
||||
bool IsMouseCaptured() const;
|
||||
|
||||
void SetMousePos(int x, int y);
|
||||
|
||||
int GetRawMouseX() const;
|
||||
int GetRawMouseY() const;
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL);
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL);
|
||||
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode);
|
||||
@@ -213,5 +166,4 @@ public:
|
||||
};
|
||||
|
||||
// Singleton
|
||||
extern C_4JInput InputManager;
|
||||
extern HWND g_hWnd;
|
||||
extern C_4JInput InputManager;
|
||||
Reference in New Issue
Block a user