Open StrikerMan780 opened 1 week ago
Been curious about easing the dependency too. But in the mean time, you are able to implement your own custom gamepad input source. Something like this....
#define NK_GAMEPAD_NONE
#define NK_GAMEPAD_IMPLEMENTATION
#include "nuklear_gamepad.h"
void custom_gamepad_update(struct nk_gamepads* gamepads, void* user_data) {
// Indicate that the left button is down for gamepad 0
nk_gamepad_button(gamepads, 0, NK_GAMEPAD_BUTTON_LEFT, nk_true);
}
int main() {
struct nk_gamepad_input_source input_source = {
.update = &custom_gamepad_update
};
struct nk_gamepads gamepads;
nk_gamepad_init_with_source(&gamepads, ctx, input_source);
nk_console_set_gamepads(console, &gamepads);
}
Which platform are you using? I'd love to add more options for input sources to ease integrations.
I'm using SDL2 as a base, but I have my own event loop for it, and a custom key->action remapping system so people can bind multiple keys and devices to the same action, among other things. I noticed that nuklear_console responds to the keyboard inputs in my loop, so I'm guessing if I just have my joystick handler send NK_KEY_UP/DOWN/LEFT/RIGHT inputs, I'll be set?
Also, thanks for replying, I appreciate it. I've been trying to get help with Nuklear itself in the main Nuklear repo, but nobody seems to reply there, making me feel like I'm up a creek without a paddle. This gives me some hope, though.
Case in point: https://github.com/Immediate-Mode-UI/Nuklear/issues/646 Might want to look at this, since it's relevant to, and affects nuklear_console quite severely.
Is there a way to disable the dependency on nuklear_gamepad? I have my own controller implementation, that I'd like to get the input for nuklear_console from.