MCPcopy Create free account
hub / github.com/TheRealMJP/Shadows / GetKeyboardState

Method GetKeyboardState

Shadows/SampleFramework11/Input.cpp:103–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103KeyboardState KeyboardState::GetKeyboardState(HWND hwnd)
104{
105 if(GetForegroundWindow() != hwnd)
106 return prevState;
107
108 ::GetKeyboardState(currState);
109
110 KeyState state;
111 for (UINT i = 0; i < 256; ++i)
112 {
113 state.Pressed = KeyPressed(currState[i]);
114 state.RisingEdge = state.Pressed && !prevState.keyStates[i].Pressed;
115 state.FallingEdge = !state.Pressed && prevState.keyStates[i].Pressed;
116 prevState.keyStates[i] = state;
117 }
118
119 return prevState;
120}
121
122KeyState::KeyState() : Pressed(false),
123 RisingEdge(false),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected