Joystick Snippet reference for ericw
Moderator: InsideQC Admins
1 post
• Page 1 of 1
Joystick Snippet reference for ericw
- Code: Select all
static cbool IN_Joystick_Consider_Opened (SDL_Joystick *joy_consider)
{ DEBUG_ASSERT (!joy_active_controller); {
int buttons = SDL_JoystickNumButtons(joy_consider);
const char *joyname = SDL_JoystickName (joy_consider);
if (buttons >= 4) {
// Set the 3 variables
joy_active_controller = joy_consider;
joy_active_instance_idx = SDL_JoystickInstanceID(joy_consider);
c_strlcpy (joy_active_name, joy_active_name);
Con_SafePrintLinef ("Controller detected: " QUOTED_S " with instance id %d", joy_active_name, joy_active_instance_idx);
return true;
}
Con_WarningLinef ("Ignoring controller due to lack of buttons: %s", joyname != NULL ? joyname : "NULL");
if (SDL_JoystickGetAttached(joy_consider)) {
SDL_JoystickClose(joy_consider);
} else {
Con_SafePrintLinef ("Joystick not attached"); // Does this happen
}
return false;
}}
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest