---
name: "key_shifts"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/key_shifts"
---

# key\_shifts(3alleg)

Bitmask containing the current state of modifier keys. Allegro game programming library.

## NAME

key\_shifts - Bitmask containing the current state of modifier keys. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**extern volatile int key\_shifts;**

## DESCRIPTION

Bitmask containing the current state of shift/ctrl/alt, the special  Windows keys, and the accent escape characters. Wherever possible this  value will be updated asynchronously, but if keyboard\_needs\_poll()  returns TRUE, you must manually call poll\_keyboard() to update it with  the current input state. This can contain any of the flags:

```
   KB_SHIFT_FLAG
   KB_CTRL_FLAG
   KB_ALT_FLAG
   KB_LWIN_FLAG
   KB_RWIN_FLAG
   KB_MENU_FLAG
   KB_COMMAND_FLAG
   KB_SCROLOCK_FLAG
   KB_NUMLOCK_FLAG
   KB_CAPSLOCK_FLAG
   KB_INALTSEQ_FLAG
   KB_ACCENT1_FLAG
   KB_ACCENT2_FLAG
   KB_ACCENT3_FLAG
   KB_ACCENT4_FLAG
```

Example:

```
   if (key[KEY_W]) {
      if (key_shifts & KB_SHIFT_FLAG) {
         /* User is pressing shift + W. */
      } else {
         /* Hmmm... lower case W then. */
      }
   }
```

## SEE ALSO

[**install\_keyboard**(3alleg)](/install_keyboard/3alleg.md), [**poll\_keyboard**(3alleg)](/poll_keyboard/3alleg.md), [**key**(3alleg)](/key/3alleg.md), [**excamera**(3alleg)](/excamera/3alleg.md), [**exkeys**(3alleg)](/exkeys/3alleg.md)
