---
name: "SDL_JoyHatEvent"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_JoyHatEvent"
---

# SDL\_JoyHatEvent(3)

Joystick hat position change event structure

## NAME

SDL\_JoyHatEvent - Joystick hat position change event structure

## STRUCTURE DEFINITION

```
typedef struct{
  Uint8 type;
  Uint8 which;
  Uint8 hat;
  Uint8 value;
} SDL_JoyHatEvent;
```

## STRUCTURE DATA

- **type**

  **SDL\_JOY**

- **which**

  Joystick device index

- **hat**

  Joystick hat index

- **value**

  Hat position

## DESCRIPTION

**SDL\_JoyHatEvent** is a member of the **SDL\_Event** union and is used when an event of type **SDL\_JOYHATMOTION** is reported.

A **SDL\_JOYHATMOTION** event occurs when ever a user moves a hat on the joystick. The field **which** is the index of the joystick that reported the event and **hat** is the index of the hat (for a more detailed exlaination see the *Joystick section*). **value** is the current position of the hat. It is a logically OR'd combination of the following values (whose meanings should be pretty obvious:) :

-

  **SDL\_HAT\_CENTERED**

-

  **SDL\_HAT\_UP**

-

  **SDL\_HAT\_RIGHT**

-

  **SDL\_HAT\_DOWN**

-

  **SDL\_HAT\_LEFT**

The following defines are also provided:

-

  **SDL\_HAT\_RIGHTUP**

-

  **SDL\_HAT\_RIGHTDOWN**

-

  **SDL\_HAT\_LEFTUP**

-

  **SDL\_HAT\_LEFTDOWN**

## SEE ALSO

**SDL\_Event**, *Joystick Functions*, **SDL\_JoystickEventState**, **SDL\_JoystickGetHat**
