Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
570752a7a5 |
@@ -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);
|
||||
@@ -139,11 +129,6 @@ bool C_4JInput::IsSelectBackSwapped()
|
||||
return InternalInputManager.IsSelectBackSwapped();
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -179,191 +164,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();
|
||||
}
|
||||
|
||||
int C_4JInput::GetCharCount() const
|
||||
{
|
||||
return InternalKeyboard.GetCharCount();
|
||||
}
|
||||
|
||||
wchar_t C_4JInput::GetChar(int index) const
|
||||
{
|
||||
return InternalKeyboard.GetChar(index);
|
||||
}
|
||||
|
||||
int C_4JInput::GetClipboardText(wchar_t *outText, int outCapacity) const
|
||||
{
|
||||
return InternalKeyboard.GetClipboardText(outText, outCapacity);
|
||||
}
|
||||
|
||||
bool C_4JInput::SetClipboardText(const wchar_t *text) const
|
||||
{
|
||||
return InternalKeyboard.SetClipboardText(text);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
bool C_4JInput::IsWindowFocused() const
|
||||
{
|
||||
return InternalKeyboard.IsWindowFocused();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "INP_ForceFeedback.h"
|
||||
#include "INP_Main.h"
|
||||
|
||||
void CForceFeedback::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
|
||||
{
|
||||
@@ -109,7 +110,7 @@ void CForceFeedback::Tick(void)
|
||||
while (pRumbleNode)
|
||||
{
|
||||
RUMBLE_EFFECT *pRumble = pRumbleNode->GetDataAs<RUMBLE_EFFECT>();
|
||||
SDL_Gamepad* m_pGamepad = SDL_GetGamepadFromPlayerIndex(pRumble->m_Pad);
|
||||
SDL_Gamepad* m_pGamepad = InternalInputManager.m_Joypads[pRumble->m_Pad].m_pGamepad;
|
||||
|
||||
if (pRumble->m_TimeLeft <= qwCurrentTime.QuadPart)
|
||||
{
|
||||
|
||||
@@ -24,280 +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;
|
||||
}
|
||||
}
|
||||
|
||||
int CKeyboard::GetClipboardText(wchar_t *outText, int outCapacity) const
|
||||
{
|
||||
if (!outText || outCapacity <= 0)
|
||||
return 0;
|
||||
outText[0] = 0;
|
||||
if (!OpenClipboard(g_hWnd))
|
||||
return 0;
|
||||
int copied = 0;
|
||||
HANDLE h = GetClipboardData(CF_UNICODETEXT);
|
||||
if (h)
|
||||
{
|
||||
const wchar_t *src = (const wchar_t *)GlobalLock(h);
|
||||
if (src)
|
||||
{
|
||||
while (src[copied] && copied + 1 < outCapacity)
|
||||
{
|
||||
outText[copied] = src[copied];
|
||||
++copied;
|
||||
}
|
||||
outText[copied] = 0;
|
||||
GlobalUnlock(h);
|
||||
}
|
||||
}
|
||||
CloseClipboard();
|
||||
return copied;
|
||||
}
|
||||
|
||||
bool CKeyboard::SetClipboardText(const wchar_t *text) const
|
||||
{
|
||||
if (!text)
|
||||
return false;
|
||||
size_t len = wcslen(text);
|
||||
if (!OpenClipboard(g_hWnd))
|
||||
return false;
|
||||
EmptyClipboard();
|
||||
bool ok = false;
|
||||
HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
|
||||
if (h)
|
||||
{
|
||||
memcpy(GlobalLock(h), text, (len + 1) * sizeof(wchar_t));
|
||||
GlobalUnlock(h);
|
||||
ok = (SetClipboardData(CF_UNICODETEXT, h) != NULL);
|
||||
if (!ok)
|
||||
GlobalFree(h);
|
||||
}
|
||||
CloseClipboard();
|
||||
return ok;
|
||||
}
|
||||
|
||||
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,87 +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; }
|
||||
|
||||
int GetClipboardText(wchar_t *outText, int outCapacity) const;
|
||||
bool SetClipboardText(const wchar_t *text) const;
|
||||
|
||||
void SetMouseCaptured(bool captured);
|
||||
void SetWindowFocused(bool focused);
|
||||
bool IsMouseCaptured() const { return m_mouseCaptured; }
|
||||
bool IsWindowFocused() const { return m_windowFocused; }
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
@@ -78,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 *));
|
||||
@@ -98,6 +96,7 @@ void CInput::Tick(void)
|
||||
{
|
||||
HandleGamepadEvents();
|
||||
UpdateJoypads();
|
||||
m_Keyboard.Tick();
|
||||
}
|
||||
|
||||
void CInput::SetJoypadValues(JOYPAD *pThisPad)
|
||||
@@ -149,9 +148,13 @@ void CInput::SetJoypadValues(JOYPAD *pThisPad)
|
||||
pThisPad->m_uiButtons |= _360_JOY_BUTTON_BACK;
|
||||
}
|
||||
|
||||
if (SDL_GetGamepadButton(pGamePad, SDL_GAMEPAD_BUTTON_TOUCHPAD))
|
||||
//str1k3r - Only check the touchpad if we have one
|
||||
if (SDL_GetNumGamepadTouchpads(pGamePad) > 0)
|
||||
{
|
||||
pThisPad->m_uiButtons |= _PS_JOY_BUTTON_TOUCHPAD;
|
||||
if (SDL_GetGamepadButton(pGamePad, SDL_GAMEPAD_BUTTON_TOUCHPAD))
|
||||
{
|
||||
pThisPad->m_uiButtons |= _PS_JOY_BUTTON_TOUCHPAD;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_GetGamepadButton(pGamePad, SDL_GAMEPAD_BUTTON_LEFT_STICK))
|
||||
@@ -350,11 +353,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;
|
||||
@@ -435,11 +433,6 @@ bool CInput::IsSelectBackSwapped()
|
||||
return m_bSelectBackSwapped;
|
||||
}
|
||||
|
||||
bool CInput::IsPadActive(int iPad)
|
||||
{
|
||||
return m_Joypads[iPad].m_bControllerActive;
|
||||
}
|
||||
|
||||
void CInput::SetSigninJoypadMask(unsigned int mask)
|
||||
{
|
||||
m_uiSigninJoypadMask = mask;
|
||||
@@ -796,39 +789,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)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
bool m_bIsConnected;
|
||||
bool m_bWasConnected;
|
||||
bool m_bHasConnected;
|
||||
bool m_bControllerActive;
|
||||
|
||||
unsigned int m_uiButtons;
|
||||
unsigned int m_uiOldButtons;
|
||||
@@ -106,14 +105,12 @@ 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);
|
||||
void SetSelectBackSwapped(bool swapped);
|
||||
bool IsSelectBackSwapped();
|
||||
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);
|
||||
@@ -191,8 +188,6 @@ public:
|
||||
int (*m_pDebugSequenceFn)(void *);
|
||||
LPVOID m_pDebugSequenceParam;
|
||||
|
||||
unsigned int m_iTouchInputButton[MAX_JOYPADS];
|
||||
|
||||
private:
|
||||
EControllerType GetControllerName(SDL_GamepadType type)
|
||||
{
|
||||
|
||||
@@ -12,18 +12,12 @@ CSys::CSys()
|
||||
|
||||
bool CSys::IsSignedIn(int iQuadrant)
|
||||
{
|
||||
if (InputManager.IsPadConnected(iQuadrant))
|
||||
return true;
|
||||
//str1k3r - since we dont sign in like consoles just check if the pad is connected
|
||||
//kbm - pad 0 also counts as signed in when the keyboard is available
|
||||
return iQuadrant == 0 && InputManager.IsWindowFocused();
|
||||
return InputManager.IsPadConnected(iQuadrant); //str1k3r - since we dont sign in like consoles just check if the pad is connected
|
||||
}
|
||||
|
||||
bool CSys::IsSignedInLive(int iProf)
|
||||
{
|
||||
if (InputManager.IsPadConnected(iProf))
|
||||
return true;
|
||||
return iProf == 0 && InputManager.IsWindowFocused();
|
||||
return InputManager.IsPadConnected(iProf);
|
||||
}
|
||||
|
||||
//str1k3r - set every pad that isnt pad 0 as a guest
|
||||
|
||||
@@ -115,7 +115,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);
|
||||
@@ -123,7 +122,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
|
||||
@@ -137,8 +135,6 @@ public:
|
||||
void SetSelectBackSwapped(bool swapped);
|
||||
bool IsSelectBackSwapped();
|
||||
|
||||
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);
|
||||
@@ -149,55 +145,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;
|
||||
|
||||
int GetClipboardText(wchar_t *outText, int outCapacity) const;
|
||||
bool SetClipboardText(const wchar_t *text) const;
|
||||
|
||||
void SetMouseCaptured(bool captured);
|
||||
void SetWindowFocused(bool focused);
|
||||
bool IsMouseCaptured() const;
|
||||
bool IsWindowFocused() 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);
|
||||
@@ -234,5 +181,4 @@ public:
|
||||
};
|
||||
|
||||
// Singleton
|
||||
extern C_4JInput InputManager;
|
||||
extern HWND g_hWnd;
|
||||
extern C_4JInput InputManager;
|
||||
Reference in New Issue
Block a user