mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
Webclient: Properly try to support controller input
This commit is contained in:
parent
b17281e3cd
commit
aab9a6b383
@ -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 */
|
||||
|
@ -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++)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user