RetroController

RetroController — An interface representing an input controller

Functions

Signals

void state-changed Run First

Types and Values

Object Hierarchy

    GInterface
    ╰── RetroController

Prerequisites

RetroController requires GObject.

Includes

#include <retro-gtk/retro-gtk.h>

Description

Functions

retro_controller_get_input_state ()

gint16
retro_controller_get_input_state (RetroController *self,
                                  RetroInput *input);

Gets the state of an input of self .

Parameters

self

a RetroController

 

input

a RetroInput to query self

 

Returns

the input's state


retro_controller_get_controller_type ()

RetroControllerType
retro_controller_get_controller_type (RetroController *self);

Gets the main type of the controller.

Parameters

self

a RetroController

 

Returns

the controller type of self


retro_controller_get_capabilities ()

guint64
retro_controller_get_capabilities (RetroController *self);

Gets a flag representing the capabilities of self . Each bit index matches the RetroControllerType of same number.

For example, if self is an analog gamepad, the value would be: (1 << RETRO_CONTROLLER_TYPE_JOYPAD) | (1 << RETRO_CONTROLLER_TYPE_ANALOG).

Parameters

self

a RetroController

 

Returns

the capabilities flag of self


retro_controller_has_capability ()

gboolean
retro_controller_has_capability (RetroController *self,
                                 RetroControllerType controller_type);

Gets whether self has the capability to represent the given controller type.

Parameters

self

a RetroController

 

controller_type

a RetroControllerType

 

Returns

whether self has the capability


retro_controller_get_supports_rumble ()

gboolean
retro_controller_get_supports_rumble (RetroController *self);

Gets whether self supports rumble effects.

Parameters

self

a RetroController

 

Returns

whether self supports rumble effects.


retro_controller_set_rumble_state ()

void
retro_controller_set_rumble_state (RetroController *self,
                                   RetroRumbleEffect effect,
                                   guint16 strength);

Sets the rumble state of self .

Parameters

self

a RetroController

 

effect

the rumble effect

 

strength

the rumble effect strength

 

retro_controller_emit_state_changed ()

void
retro_controller_emit_state_changed (RetroController *self);

Types and Values

RETRO_TYPE_CONTROLLER

#define RETRO_TYPE_CONTROLLER (retro_controller_get_type())

struct RetroControllerInterface

struct RetroControllerInterface {
  GTypeInterface parent_iface;

  gint16 (*get_input_state) (RetroController *self,
                             RetroInput      *input);
  RetroControllerType (*get_controller_type) (RetroController *self);
  guint64 (*get_capabilities) (RetroController *self);
  gboolean (*get_supports_rumble) (RetroController *self);
  void (*set_rumble_state) (RetroController   *self,
                            RetroRumbleEffect  effect,
                            guint16            strength);
};

An interface for a controller, e.g. a gamepad.

Members

GTypeInterface parent_iface;

The parent interface.

 

get_input_state ()

Gets the state from on of the controller's inputs.

 

get_controller_type ()

Gets the type of the controller.

 

get_capabilities ()

Gets the capabilities of the controller.

 

get_supports_rumble ()

Gets whether the controller supports rumble.

 

set_rumble_state ()

Sets the rumble state of the controller.

 

RetroController

typedef struct _RetroController RetroController;

Signal Details

The “state-changed” signal

void
user_function (RetroController *retrocontroller,
               gpointer         user_data)

Flags: Run First

See Also

retro-controller-codes