---
name: "SDL_JoystickGetHat"
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_JoystickGetHat"
---

# SDL\_JoystickGetHat(3)

Get the current state of a joystick hat

## NAME

SDL\_JoystickGetHat - Get the current state of a joystick hat

## SYNOPSIS

**#include "SDL.h"**

**Uint8 SDL\_JoystickGetHat**(**SDL\_Joystick \*joystick, int hat**);

## DESCRIPTION

SDL\_JoystickGetHat returns the current state of the given **hat** on the given **joystick**.

## RETURN VALUE

The current state is returned as a Uint8 which is defined as an OR'd combination of one or more of the following

-

  **SDL\_HAT\_CENTERED**

-

  **SDL\_HAT\_UP**

-

  **SDL\_HAT\_RIGHT**

-

  **SDL\_HAT\_DOWN**

-

  **SDL\_HAT\_LEFT**

-

  **SDL\_HAT\_RIGHTUP**

-

  **SDL\_HAT\_RIGHTDOWN**

-

  **SDL\_HAT\_LEFTUP**

-

  **SDL\_HAT\_LEFTDOWN**

## SEE ALSO

**SDL\_JoystickNumHats**
