This documents an old version of bs::framework. Click here to see the latest release.
Input

Description

Input (mouse, keyboard, gamepad, etc.).

Classes

class  Input
 Primary module used for dealing with input. More...
 
struct  ButtonEvent
 Contains data about a button input event. More...
 
struct  PointerEvent
 Event that gets sent out when user interacts with the screen in some way, usually by moving the mouse cursor or using touch input. More...
 
struct  TextInputEvent
 Event that gets sent out when user inputs some text. More...
 

Enumerations

enum  ButtonCode : UINT32 {
  BC_UNASSIGNED = 0x00, BC_ESCAPE = 0x01, BC_1 = 0x02, BC_2 = 0x03,
  BC_3 = 0x04, BC_4 = 0x05, BC_5 = 0x06, BC_6 = 0x07,
  BC_7 = 0x08, BC_8 = 0x09, BC_9 = 0x0A, BC_0 = 0x0B,
  BC_MINUS = 0x0C, BC_EQUALS = 0x0D, BC_BACK = 0x0E, BC_TAB = 0x0F,
  BC_Q = 0x10, BC_W = 0x11, BC_E = 0x12, BC_R = 0x13,
  BC_T = 0x14, BC_Y = 0x15, BC_U = 0x16, BC_I = 0x17,
  BC_O = 0x18, BC_P = 0x19, BC_LBRACKET = 0x1A, BC_RBRACKET = 0x1B,
  BC_RETURN = 0x1C, BC_LCONTROL = 0x1D, BC_A = 0x1E, BC_S = 0x1F,
  BC_D = 0x20, BC_F = 0x21, BC_G = 0x22, BC_H = 0x23,
  BC_J = 0x24, BC_K = 0x25, BC_L = 0x26, BC_SEMICOLON = 0x27,
  BC_APOSTROPHE = 0x28, BC_GRAVE = 0x29, BC_LSHIFT = 0x2A, BC_BACKSLASH = 0x2B,
  BC_Z = 0x2C, BC_X = 0x2D, BC_C = 0x2E, BC_V = 0x2F,
  BC_B = 0x30, BC_N = 0x31, BC_M = 0x32, BC_COMMA = 0x33,
  BC_PERIOD = 0x34, BC_SLASH = 0x35, BC_RSHIFT = 0x36, BC_MULTIPLY = 0x37,
  BC_LMENU = 0x38, BC_SPACE = 0x39, BC_CAPITAL = 0x3A, BC_F1 = 0x3B,
  BC_F2 = 0x3C, BC_F3 = 0x3D, BC_F4 = 0x3E, BC_F5 = 0x3F,
  BC_F6 = 0x40, BC_F7 = 0x41, BC_F8 = 0x42, BC_F9 = 0x43,
  BC_F10 = 0x44, BC_NUMLOCK = 0x45, BC_SCROLL = 0x46, BC_NUMPAD7 = 0x47,
  BC_NUMPAD8 = 0x48, BC_NUMPAD9 = 0x49, BC_SUBTRACT = 0x4A, BC_NUMPAD4 = 0x4B,
  BC_NUMPAD5 = 0x4C, BC_NUMPAD6 = 0x4D, BC_ADD = 0x4E, BC_NUMPAD1 = 0x4F,
  BC_NUMPAD2 = 0x50, BC_NUMPAD3 = 0x51, BC_NUMPAD0 = 0x52, BC_DECIMAL = 0x53,
  BC_OEM_102 = 0x56, BC_F11 = 0x57, BC_F12 = 0x58, BC_F13 = 0x64,
  BC_F14 = 0x65, BC_F15 = 0x66, BC_KANA = 0x70, BC_ABNT_C1 = 0x73,
  BC_CONVERT = 0x79, BC_NOCONVERT = 0x7B, BC_YEN = 0x7D, BC_ABNT_C2 = 0x7E,
  BC_NUMPADEQUALS = 0x8D, BC_PREVTRACK = 0x90, BC_AT = 0x91, BC_COLON = 0x92,
  BC_UNDERLINE = 0x93, BC_KANJI = 0x94, BC_STOP = 0x95, BC_AX = 0x96,
  BC_UNLABELED = 0x97, BC_NEXTTRACK = 0x99, BC_NUMPADENTER = 0x9C, BC_RCONTROL = 0x9D,
  BC_MUTE = 0xA0, BC_CALCULATOR = 0xA1, BC_PLAYPAUSE = 0xA2, BC_MEDIASTOP = 0xA4,
  BC_VOLUMEDOWN = 0xAE, BC_VOLUMEUP = 0xB0, BC_WEBHOME = 0xB2, BC_NUMPADCOMMA = 0xB3,
  BC_DIVIDE = 0xB5, BC_SYSRQ = 0xB7, BC_RMENU = 0xB8, BC_PAUSE = 0xC5,
  BC_HOME = 0xC7, BC_UP = 0xC8, BC_PGUP = 0xC9, BC_LEFT = 0xCB,
  BC_RIGHT = 0xCD, BC_END = 0xCF, BC_DOWN = 0xD0, BC_PGDOWN = 0xD1,
  BC_INSERT = 0xD2, BC_DELETE = 0xD3, BC_LWIN = 0xDB, BC_RWIN = 0xDC,
  BC_APPS = 0xDD, BC_POWER = 0xDE, BC_SLEEP = 0xDF, BC_WAKE = 0xE3,
  BC_WEBSEARCH = 0xE5, BC_WEBFAVORITES = 0xE6, BC_WEBREFRESH = 0xE7, BC_WEBSTOP = 0xE8,
  BC_WEBFORWARD = 0xE9, BC_WEBBACK = 0xEA, BC_MYCOMPUTER = 0xEB, BC_MAIL = 0xEC,
  BC_MEDIASELECT = 0xED, BC_MOUSE_LEFT = 0x800000EE, BC_MOUSE_RIGHT, BC_MOUSE_MIDDLE,
  BC_MOUSE_BTN4, BC_MOUSE_BTN5, BC_MOUSE_BTN6, BC_MOUSE_BTN7,
  BC_MOUSE_BTN8, BC_MOUSE_BTN9, BC_MOUSE_BTN10, BC_MOUSE_BTN11,
  BC_MOUSE_BTN12, BC_MOUSE_BTN13, BC_MOUSE_BTN14, BC_MOUSE_BTN15,
  BC_MOUSE_BTN16, BC_MOUSE_BTN17, BC_MOUSE_BTN18, BC_MOUSE_BTN19,
  BC_MOUSE_BTN20, BC_MOUSE_BTN21, BC_MOUSE_BTN22, BC_MOUSE_BTN23,
  BC_MOUSE_BTN24, BC_MOUSE_BTN25, BC_MOUSE_BTN26, BC_MOUSE_BTN27,
  BC_MOUSE_BTN28, BC_MOUSE_BTN29, BC_MOUSE_BTN30, BC_MOUSE_BTN31,
  BC_MOUSE_BTN32, BC_GAMEPAD_A = 0x4000010F, BC_GAMEPAD_B, BC_GAMEPAD_X,
  BC_GAMEPAD_Y, BC_GAMEPAD_LB, BC_GAMEPAD_RB, BC_GAMEPAD_LS,
  BC_GAMEPAD_RS, BC_GAMEPAD_BACK, BC_GAMEPAD_START, BC_GAMEPAD_DPAD_LEFT,
  BC_GAMEPAD_DPAD_RIGHT, BC_GAMEPAD_DPAD_UP, BC_GAMEPAD_DPAD_DOWN, BC_GAMEPAD_BTN1,
  BC_GAMEPAD_BTN2, BC_GAMEPAD_BTN3, BC_GAMEPAD_BTN4, BC_GAMEPAD_BTN5,
  BC_GAMEPAD_BTN6, BC_GAMEPAD_BTN7, BC_GAMEPAD_BTN8, BC_GAMEPAD_BTN9,
  BC_GAMEPAD_BTN10, BC_GAMEPAD_BTN11, BC_GAMEPAD_BTN12, BC_GAMEPAD_BTN13,
  BC_GAMEPAD_BTN14, BC_GAMEPAD_BTN15, BC_GAMEPAD_BTN16, BC_GAMEPAD_BTN17,
  BC_GAMEPAD_BTN18, BC_GAMEPAD_BTN19, BC_GAMEPAD_BTN20, BC_GAMEPAD_DPAD_UPLEFT,
  BC_GAMEPAD_DPAD_UPRIGHT, BC_GAMEPAD_DPAD_DOWNLEFT, BC_GAMEPAD_DPAD_DOWNRIGHT, BC_NumKeys = BC_MEDIASELECT - BC_UNASSIGNED + 1,
  BC_NumMouse = BC_MOUSE_BTN32 - BC_MOUSE_LEFT + 1, BC_NumGamepad = BC_GAMEPAD_DPAD_DOWNRIGHT - BC_GAMEPAD_A + 1, BC_Count = BC_NumKeys + BC_NumMouse + BC_NumGamepad
}
 Contains all possible input buttons, including keyboard scan codes, mouse buttons and gamepad buttons. More...
 
enum  PointerEventButton { Left, Middle, Right, Count }
 Pointer buttons. More...
 
enum  PointerEventType { CursorMoved, ButtonPressed, ButtonReleased, DoubleClick }
 Type of pointer event. More...
 
enum  InputCommandType {
  CursorMoveLeft, CursorMoveRight, CursorMoveUp, CursorMoveDown,
  SelectLeft, SelectRight, SelectUp, SelectDown,
  Escape, Delete, Backspace, Return,
  Confirm, Tab
}
 Types of special input commands. More...
 
enum  InputDevice { Keyboard, Mouse, Gamepad, Count }
 Types of input devices. More...
 
enum  InputAxis {
  MouseX, MouseY, MouseZ, LeftStickX,
  LeftStickY, RightStickX, RightStickY, LeftTrigger,
  RightTrigger, Count
}
 Common input axis types. More...
 
enum  ButtonModifier {
  None = 0x00, Shift = 0x01, Ctrl = 0x02, Alt = 0x04,
  ShiftCtrl = 0x03, CtrlAlt = 0x06, ShiftAlt = 0x05, ShiftCtrlAlt = 0x07
}
 Modifiers used with along with keyboard buttons. More...
 

Functions

BS_CORE_EXPORT InputgInput ()
 Provides global access to Input. More...
 

Enumeration Type Documentation

◆ ButtonCode

enum ButtonCode : UINT32

Contains all possible input buttons, including keyboard scan codes, mouse buttons and gamepad buttons.

Note
These codes are only keyboard scan codes. This means that exact scan code identifier might not correspond to that exact character on user's keyboard, depending on user's input locale. Only for US locale will these scan code names match the actual keyboard input. Think of the US key code names as only a convenience for more easily identifying which location on the keyboard a scan code represents.
When storing these sequentially make sure to only reference the low order 2 bytes. Two high order bytes are used for various flags.

◆ ButtonModifier

enum ButtonModifier
strong

Modifiers used with along with keyboard buttons.

◆ InputAxis

enum InputAxis
strong

Common input axis types.

Enumerator
MouseX 

Mouse axis X.

Provides unnormalized relative movement.

MouseY 

Mouse axis Y.

Provides unnormalized relative movement.

MouseZ 

Mouse wheel/scroll axis.

Provides unnormalized relative movement.

LeftStickX 

Gamepad left stick X.

Provides normalized ([-1, 1] range) absolute position.

LeftStickY 

Gamepad left stick Y.

Provides normalized ([-1, 1] range) absolute position.

RightStickX 

Gamepad right stick X.

Provides normalized ([-1, 1] range) absolute position.

RightStickY 

Gamepad right stick Y.

Provides normalized ([-1, 1] range) absolute position.

LeftTrigger 

Gamepad left trigger.

Provides normalized ([-1, 1] range) absolute position.

RightTrigger 

Gamepad right trigger.

Provides normalized ([-1, 1] range) absolute position.

◆ InputCommandType

enum InputCommandType
strong

Types of special input commands.

◆ InputDevice

enum InputDevice
strong

Types of input devices.

◆ PointerEventButton

enum PointerEventButton
strong

Pointer buttons.

Generally these correspond to mouse buttons, but may be used in some form for touch input as well.

◆ PointerEventType

enum PointerEventType
strong

Type of pointer event.

Function Documentation

◆ gInput()

BS_CORE_EXPORT Input& bs::gInput ( )

Provides global access to Input.