Webclient: Properly try to support controller input

This commit is contained in:
UnknownShadow200 2024-08-28 07:14:40 +10:00
parent b17281e3cd
commit aab9a6b383
3 changed files with 3 additions and 8 deletions

View File

@ -762,8 +762,7 @@ static CC_INLINE void Game_RenderFrame(void) {
Gfx_BindIb(Gfx.DefaultIb);
Game.Time += deltaD;
Game_Vertices = 0;
if (Input.Sources & INPUT_SOURCE_GAMEPAD) Gamepad_Tick(delta);
Gamepad_Tick(delta);
#ifdef CC_BUILD_SPLITSCREEN
/* TODO: find a better solution */

View File

@ -539,6 +539,7 @@ static void Gamepad_Apply(int port, int btn, cc_bool was, int pressed) {
static void Gamepad_Update(int port, float delta) {
struct GamepadDevice* pad = &Gamepad_Devices[port];
int btn;
if (!pad->deviceID) return;
for (btn = 0; btn < GAMEPAD_BTN_COUNT; btn++)
{

View File

@ -572,12 +572,7 @@ static void Cursor_DoSetVisible(cc_bool visible) {
*-------------------------------------------------------Gamepads----------------------------------------------------------*
*#########################################################################################################################*/
void Gamepads_Init(void) {
/* TODO find a better solution */
int count;
if (emscripten_sample_gamepad_data() != 0) return;
count = emscripten_get_num_gamepads();
if (count) Input.Sources |= INPUT_SOURCE_GAMEPAD;
/* Devices can't be detected until first time a button is pressed */
}
/* https://www.w3.org/TR/gamepad/#dfn-standard-gamepad */