Kore 3
Loading...
Searching...
No Matches
gamepad.h File Reference

Provides gamepad-support. More...

#include <kore3/global.h>

Go to the source code of this file.

Macros

#define KORE_GAMEPAD_MAX_COUNT   12

Functions

KORE_FUNC void kore_gamepad_set_connect_callback (void(*value)(int, void *), void *userdata)
 Sets the gamepad-connect-callback which is called when a gamepad is connected.
KORE_FUNC void kore_gamepad_set_disconnect_callback (void(*value)(int, void *), void *userdata)
 Sets the gamepad-disconnect-callback which is called when a gamepad is disconnected.
KORE_FUNC void kore_gamepad_set_axis_callback (void(*value)(int, int, float, void *), void *userdata)
 Sets the gamepad-axis-callback which is called with data about changing gamepad-sticks.
KORE_FUNC void kore_gamepad_set_button_callback (void(*value)(int, int, float, void *), void *userdata)
 Sets the gamepad-button-callback which is called with data about changing gamepad-buttons.
KORE_FUNC const char * kore_gamepad_vendor (int gamepad)
 Returns a vendor-name for a gamepad.
KORE_FUNC const char * kore_gamepad_product_name (int gamepad)
 Returns a name for a gamepad.
KORE_FUNC bool kore_gamepad_connected (int gamepad)
 Checks whether a gamepad is connected.
KORE_FUNC void kore_gamepad_rumble (int gamepad, float left, float right)
 Rumbles a gamepad. Careful here because it might just fall off your table.

Detailed Description

Provides gamepad-support.

Function Documentation

◆ kore_gamepad_connected()

KORE_FUNC bool kore_gamepad_connected ( int gamepad)

Checks whether a gamepad is connected.

Parameters
gamepadThe index of the gamepad which's connection will be checked
Returns
Whether a gamepad is connected for the gamepad-index

◆ kore_gamepad_product_name()

KORE_FUNC const char * kore_gamepad_product_name ( int gamepad)

Returns a name for a gamepad.

Parameters
gamepadThe index of the gamepad for which to receive the name
Returns
The gamepad's name

◆ kore_gamepad_rumble()

KORE_FUNC void kore_gamepad_rumble ( int gamepad,
float left,
float right )

Rumbles a gamepad. Careful here because it might just fall off your table.

Parameters
gamepadThe index of the gamepad to rumble
leftRumble-strength for the left motor between 0 and 1
rightRumble-strength for the right motor between 0 and 1

◆ kore_gamepad_set_axis_callback()

KORE_FUNC void kore_gamepad_set_axis_callback ( void(* value )(int, int, float, void *),
void * userdata )

Sets the gamepad-axis-callback which is called with data about changing gamepad-sticks.

Parameters
valueThe callback
userdataUserdata you will receive back as the 4th callback parameter

◆ kore_gamepad_set_button_callback()

KORE_FUNC void kore_gamepad_set_button_callback ( void(* value )(int, int, float, void *),
void * userdata )

Sets the gamepad-button-callback which is called with data about changing gamepad-buttons.

Parameters
valueThe callback
userdataUserdata you will receive back as the 4th callback parameter

◆ kore_gamepad_set_connect_callback()

KORE_FUNC void kore_gamepad_set_connect_callback ( void(* value )(int, void *),
void * userdata )

Sets the gamepad-connect-callback which is called when a gamepad is connected.

Parameters
valueThe callback
userdataUserdata you will receive back as the 2nd callback parameter

◆ kore_gamepad_set_disconnect_callback()

KORE_FUNC void kore_gamepad_set_disconnect_callback ( void(* value )(int, void *),
void * userdata )

Sets the gamepad-disconnect-callback which is called when a gamepad is disconnected.

Parameters
valueThe callback
userdataUserdata you will receive back as the 2nd callback parameter

◆ kore_gamepad_vendor()

KORE_FUNC const char * kore_gamepad_vendor ( int gamepad)

Returns a vendor-name for a gamepad.

Parameters
gamepadThe index of the gamepad for which to receive the vendor-name
Returns
The vendor-name