gorbit99 / olcPGEX_Gamepad

Cross platform (Windows + Linux) Gamepad API for the Pixel Game Engine (http://onelonecoder.com/)
Other
15 stars 5 forks source link

allow to be built with -c as an independent compile unit #12

Closed Moros1138 closed 2 weeks ago

Moros1138 commented 3 weeks ago

When compiling as an independent compile unit, it's missing emscripten symbols

em++ -std=c++20 -c -IolcPixelGameEngine -IolcPixelGameEngine/extensions -IolcPixelGameEngine/utilities -Iminiaudio/0.11.21 -c olcPGEX_Gamepad/olcPGEX_Gamepad.cpp -o olcPGEX_Gamepad/olcPGEX_Gamepad.o
In file included from olcPGEX_Gamepad/olcPGEX_Gamepad.cpp:2:
olcPGEX_Gamepad/olcPGEX_Gamepad.h:1150:3: error: unknown type name 'EmscriptenGamepadEvent'
 1150 |   EmscriptenGamepadEvent state;
      |   ^
olcPGEX_Gamepad/olcPGEX_Gamepad.h:1182:39: error: use of undeclared identifier 'emscripten_sample_gamepad_data'
 1182 | void olc::GamePad::updateGamepads() { emscripten_sample_gamepad_data(); }
      |                                       ^
olcPGEX_Gamepad/olcPGEX_Gamepad.h:1196:35: error: unknown type name 'EmscriptenGamepadEvent'
 1196 |                             const EmscriptenGamepadEvent *gamepadEvent,
      |                                   ^
olcPGEX_Gamepad/olcPGEX_Gamepad.h:1200:22: error: use of undeclared identifier 'EMSCRIPTEN_EVENT_GAMEPADCONNECTED'
 1200 |     if (eventType == EMSCRIPTEN_EVENT_GAMEPADCONNECTED) {
      |                      ^
olcPGEX_Gamepad/olcPGEX_Gamepad.h:1214:3: error: use of undeclared identifier 'emscripten_set_gamepadconnected_callback'
 1214 |   emscripten_set_gamepadconnected_callback(&gamepads, true, gamepadCallback);
      |   ^
olcPGEX_Gamepad/olcPGEX_Gamepad.h:1215:3: error: use of undeclared identifier 'emscripten_set_gamepaddisconnected_callback'
 1215 |   emscripten_set_gamepaddisconnected_callback(&gamepads, true, gamepadCallback);
      |   ^
6 errors generated.
make: *** [Makefile:18: olcPGEX_Gamepad/olcPGEX_Gamepad.o] Error 1

This fixes that!