mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -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);
|
Gfx_BindIb(Gfx.DefaultIb);
|
||||||
Game.Time += deltaD;
|
Game.Time += deltaD;
|
||||||
Game_Vertices = 0;
|
Game_Vertices = 0;
|
||||||
|
Gamepad_Tick(delta);
|
||||||
if (Input.Sources & INPUT_SOURCE_GAMEPAD) Gamepad_Tick(delta);
|
|
||||||
|
|
||||||
#ifdef CC_BUILD_SPLITSCREEN
|
#ifdef CC_BUILD_SPLITSCREEN
|
||||||
/* TODO: find a better solution */
|
/* 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) {
|
static void Gamepad_Update(int port, float delta) {
|
||||||
struct GamepadDevice* pad = &Gamepad_Devices[port];
|
struct GamepadDevice* pad = &Gamepad_Devices[port];
|
||||||
int btn;
|
int btn;
|
||||||
|
if (!pad->deviceID) return;
|
||||||
|
|
||||||
for (btn = 0; btn < GAMEPAD_BTN_COUNT; btn++)
|
for (btn = 0; btn < GAMEPAD_BTN_COUNT; btn++)
|
||||||
{
|
{
|
||||||
|
@ -572,12 +572,7 @@ static void Cursor_DoSetVisible(cc_bool visible) {
|
|||||||
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void Gamepads_Init(void) {
|
void Gamepads_Init(void) {
|
||||||
/* TODO find a better solution */
|
/* Devices can't be detected until first time a button is pressed */
|
||||||
int count;
|
|
||||||
if (emscripten_sample_gamepad_data() != 0) return;
|
|
||||||
count = emscripten_get_num_gamepads();
|
|
||||||
|
|
||||||
if (count) Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* https://www.w3.org/TR/gamepad/#dfn-standard-gamepad */
|
/* https://www.w3.org/TR/gamepad/#dfn-standard-gamepad */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user