# Touch input

These functions are declared in the main Allegro header file:

     #include <allegro5/allegro.h>

# ALLEGRO_TOUCH_INPUT

    typedef struct ALLEGRO_TOUCH_INPUT ALLEGRO_TOUCH_INPUT;

Source Code

An abstract data type representing a physical touch screen or touch pad.

Since: 5.1.0

# ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT

    #define ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT        16

Source Code

The maximum amount of simultaneous touches that can be detected.

Since: 5.1.0

# ALLEGRO_TOUCH_STATE

    typedef struct ALLEGRO_TOUCH_STATE ALLEGRO_TOUCH_STATE;

Source Code

This is a structure that is used to hold a "snapshot" of a touch at a particular instant.

Public fields (read only):

- id - identifier of the touch. If the touch is valid, this is positive.
- x - touch x position
- y - touch y position
- dx - touch relative x position
- dy - touch relative y position
- primary - TRUE if this touch is the primary one (usually the first one).
- display - The ALLEGRO_DISPLAY that was touched.

Since: 5.1.0

# ALLEGRO_TOUCH_INPUT_STATE

    typedef struct ALLEGRO_TOUCH_INPUT_STATE ALLEGRO_TOUCH_INPUT_STATE;

Source Code

This is a structure that holds a snapshot of all simultaneous touches at a particular instant.

Public fields (read only):

- touches - an array of ALLEGRO_TOUCH_STATE

Since: 5.1.0

# ALLEGRO_MOUSE_EMULATION_MODE

    typedef enum ALLEGRO_MOUSE_EMULATION_MODE

Source Code

Type of mouse emulation to apply.

ALLEGRO_MOUSE_EMULATION_NONE
  Disables mouse emulation.
ALLEGRO_MOUSE_EMULATION_TRANSPARENT
  Enables transparent mouse emulation.
ALLEGRO_MOUSE_EMULATION_INCLUSIVE
  Enable inclusive mouse emulation.
ALLEGRO_MOUSE_EMULATION_EXCLUSIVE
  Enables exclusive mouse emulation.
ALLEGRO_MOUSE_EMULATION_5_0_x
  Enables mouse emulation that is backwards compatible with Allegro 5.0.x.

Since: 5.1.0

> Unstable API: Seems of limited value, as touch input tends to have different semantics compared to mouse input.

# al_install_touch_input

    bool al_install_touch_input(void)

Source Code

Install a touch input driver, returning true if successful. If a touch input driver was already installed, returns true immediately.

Since: 5.1.0

See also: al_uninstall_touch_input

# al_uninstall_touch_input

    void al_uninstall_touch_input(void)

Source Code

Uninstalls the active touch input driver. If no touch input driver was active, this function does nothing.

This function is automatically called when Allegro is shut down.

Since: 5.1.0

See also: al_install_touch_input

# al_is_touch_input_installed

    bool al_is_touch_input_installed(void)

Source Code

Returns true if al_install_touch_input was called successfully.

Since: 5.1.0

# al_get_touch_input_state

    void al_get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state)

Source Code

Gets the current touch input state. The touch information is copied into the ALLEGRO_TOUCH_INPUT_STATE you provide to this function.

Since: 5.1.0

# al_set_mouse_emulation_mode

    void al_set_mouse_emulation_mode(int mode)

Source Code

Sets the kind of mouse emulation for the touch input subsystem to perform.

Since: 5.1.0

> Unstable API: Seems of limited value, as touch input tends to have different semantics compared to mouse input.

See also: ALLEGRO_MOUSE_EMULATION_MODE, al_get_mouse_emulation_mode.

# al_get_mouse_emulation_mode

    int al_get_mouse_emulation_mode(void)

Source Code

Returns the kind of mouse emulation which the touch input subsystem is set to perform.

Since: 5.1.0

> Unstable API: Seems of limited value, as touch input tends to have different semantics compared to mouse input.

See also: ALLEGRO_MOUSE_EMULATION_MODE, al_set_mouse_emulation_mode.

# al_get_touch_input_event_source

    ALLEGRO_EVENT_SOURCE *al_get_touch_input_event_source(void)

Source Code

Returns the global touch input event source. This event source generates touch input events.

Since: 5.1.0

See also: ALLEGRO_EVENT_SOURCE, al_register_event_source

# al_get_touch_input_mouse_emulation_event_source

    ALLEGRO_EVENT_SOURCE *al_get_touch_input_mouse_emulation_event_source(void)

Source Code

Returns the global touch input event source for emulated mouse events. This event source generates emulated mouse events that are based on touch events.

See also: ALLEGRO_EVENT_SOURCE, al_register_event_source

Since: 5.1.0

> Unstable API: Seems of limited value, as touch input tends to have different semantics compared to mouse input.

Allegro version 5.2.5 - Last updated: 2019-02-24 19:11:45 UTC