c++ - SDL2 - No Joysticks detected? -
so, i'm trying larn how utilize joysticks sdl2, , i'm next lazyfoo's tutorial(gamepads , joysticks), must've been doing wrong because programme won't observe controller!
windows detects it(i'm using windos 7 , wireless xbox 360 controller) , lazyfoo's example(which downloaded link above) detects controller!
i searched , tried things, nil tried seems work...
here's init:
if (sdl_init(sdl_init_everything) < 0){ cout << "error initializing sdl!" << endl; homecoming 1; }
and part within constructor of input class, whic supposed "start" joystick(and detects event keyborad):
if (sdl_numjoysticks() < 1){ cout << "no joystick detected." << endl; } else{ controller = sdl_joystickopen(0); if (controller == null){ cout << "error: unable open joystick." << endl; } else{ isusingjoystick = true; } }
i tried using sdl_joystickeventstate(sdl_enable)
after init , sdl_joystickupdate()
, did'nt worked either...
what forgetting?
if guys want, can edit post codes of input class...
edit: forgot that, though controller connected , everything, sdl_numjoysticks()
returns 0...
no more help needed here, figured out doing wrong. turns out trying open joystick before initializing sdl (i opening joystick in constructor of input
class, creating 1 , instance of input
class before sdl_init_everything
... :p)
sorry bothering, , think impossible find info wrote... so, sorry again...
c++ c sdl sdl-2 joystick
No comments:
Post a Comment