#ifndef GOSU_BUTTONS_HPP #define GOSU_BUTTONS_HPP #include #ifdef GOSU_IS_MAC #define GOSU_SCANCODE(mac, windows_or_linux) mac #define GOSU_SPECIAL_SCANCODE(mac, windows, linux) mac #else #define GOSU_SCANCODE(mac, linux_or_windows) linux_or_windows #ifdef GOSU_IS_WIN #define GOSU_SPECIAL_SCANCODE(mac, windows, linux) windows #else #define GOSU_SPECIAL_SCANCODE(mac, windows, linux) linux #endif #endif namespace Gosu { //! List of button ids that can be used with Gosu::Input. //! This enumeration contains ids for keyboard keys (kb*), //! mouse buttons and mouse wheel (ms*) and gamepad buttons (gp*). enum ButtonName { kbRangeBegin, kbEscape = GOSU_SCANCODE(0x35, 0x01), kbF1 = GOSU_SCANCODE(0x7a, 0x3b), kbF2 = GOSU_SCANCODE(0x78, 0x3c), kbF3 = GOSU_SCANCODE(0x63, 0x3d), kbF4 = GOSU_SCANCODE(0x76, 0x3e), kbF5 = GOSU_SCANCODE(0x60, 0x3f), kbF6 = GOSU_SCANCODE(0x61, 0x40), kbF7 = GOSU_SCANCODE(0x62, 0x41), kbF8 = GOSU_SCANCODE(0x64, 0x42), kbF9 = GOSU_SCANCODE(0x65, 0x43), kbF10 = GOSU_SCANCODE(0x6d, 0x44), kbF11 = GOSU_SCANCODE(0x67, 0x57), kbF12 = GOSU_SCANCODE(0x6f, 0x58), kb0 = GOSU_SCANCODE(0x1d, 0x0b), kb1 = GOSU_SCANCODE(0x12, 0x02), kb2 = GOSU_SCANCODE(0x13, 0x03), kb3 = GOSU_SCANCODE(0x14, 0x04), kb4 = GOSU_SCANCODE(0x15, 0x05), kb5 = GOSU_SCANCODE(0x17, 0x06), kb6 = GOSU_SCANCODE(0x16, 0x07), kb7 = GOSU_SCANCODE(0x1a, 0x08), kb8 = GOSU_SCANCODE(0x1c, 0x09), kb9 = GOSU_SCANCODE(0x19, 0x0a), kbTab = GOSU_SCANCODE(0x30, 0x0f), kbReturn = GOSU_SCANCODE(0x24, 0x1c), kbSpace = GOSU_SCANCODE(0x31, 0x39), kbLeftShift = GOSU_SCANCODE(0x38, 0x2a), kbRightShift = GOSU_SCANCODE(0x3c, 0x36), kbLeftControl = GOSU_SCANCODE(0x3b, 0x1d), kbRightControl = GOSU_SPECIAL_SCANCODE(0x3e, 0x9d, 0x61), kbLeftAlt = GOSU_SCANCODE(0x3a, 0x38), kbRightAlt = GOSU_SPECIAL_SCANCODE(0x3d, 0xb8, 0x64), kbLeftMeta = GOSU_SPECIAL_SCANCODE(0x37, 0xdb, 0x7d), kbRightMeta = GOSU_SPECIAL_SCANCODE(0x36, 0xdc, 0x7e), kbBackspace = GOSU_SCANCODE(0x33, 0x0e), kbLeft = GOSU_SPECIAL_SCANCODE(0x7b, 0xcb, 0x69), kbRight = GOSU_SPECIAL_SCANCODE(0x7c, 0xcd, 0x6a), kbUp = GOSU_SPECIAL_SCANCODE(0x7e, 0xc8, 0x67), kbDown = GOSU_SPECIAL_SCANCODE(0x7d, 0xd0, 0x6c), kbHome = GOSU_SPECIAL_SCANCODE(0x73, 0xc7, 0x66), kbEnd = GOSU_SPECIAL_SCANCODE(0x77, 0xcf, 0x6b), kbInsert = GOSU_SPECIAL_SCANCODE(0x72, 0xd2, 0x6e), kbDelete = GOSU_SPECIAL_SCANCODE(0x75, 0xd3, 0x6f), kbPageUp = GOSU_SPECIAL_SCANCODE(0x74, 0xc9, 0x68), kbPageDown = GOSU_SPECIAL_SCANCODE(0x79, 0xd1, 0x6d), kbEnter = GOSU_SPECIAL_SCANCODE(0x4c, 0x9c, 0x60), kbBacktick = GOSU_SCANCODE(0x32, 0x29), kbMinus = GOSU_SCANCODE(0x1b, 0x0c), kbEqual = GOSU_SCANCODE(0x18, 0x0d), kbBracketLeft = GOSU_SCANCODE(0x21, 0x1a), kbBracketRight = GOSU_SCANCODE(0x1e, 0x1b), kbBackslash = GOSU_SCANCODE(0x2a, 0x2b), kbSemicolon = GOSU_SCANCODE(0x29, 0x27), kbApostrophe = GOSU_SCANCODE(0x27, 0x28), kbComma = GOSU_SCANCODE(0x2b, 0x33), kbPeriod = GOSU_SCANCODE(0x2f, 0x34), kbSlash = GOSU_SCANCODE(0x2c, 0x35), kbA = GOSU_SCANCODE(0x00, 0x1e), kbB = GOSU_SCANCODE(0x0b, 0x30), kbC = GOSU_SCANCODE(0x08, 0x2e), kbD = GOSU_SCANCODE(0x02, 0x20), kbE = GOSU_SCANCODE(0x0e, 0x12), kbF = GOSU_SCANCODE(0x03, 0x21), kbG = GOSU_SCANCODE(0x05, 0x22), kbH = GOSU_SCANCODE(0x04, 0x23), kbI = GOSU_SCANCODE(0x22, 0x17), kbJ = GOSU_SCANCODE(0x26, 0x24), kbK = GOSU_SCANCODE(0x28, 0x25), kbL = GOSU_SCANCODE(0x25, 0x26), kbM = GOSU_SCANCODE(0x2e, 0x32), kbN = GOSU_SCANCODE(0x2d, 0x31), kbO = GOSU_SCANCODE(0x1f, 0x18), kbP = GOSU_SCANCODE(0x23, 0x19), kbQ = GOSU_SCANCODE(0x0c, 0x10), kbR = GOSU_SCANCODE(0x0f, 0x13), kbS = GOSU_SCANCODE(0x01, 0x1f), kbT = GOSU_SCANCODE(0x11, 0x14), kbU = GOSU_SCANCODE(0x20, 0x16), kbV = GOSU_SCANCODE(0x09, 0x2f), kbW = GOSU_SCANCODE(0x0d, 0x11), kbX = GOSU_SCANCODE(0x07, 0x2d), kbY = GOSU_SCANCODE(0x10, 0x15), kbZ = GOSU_SCANCODE(0x06, 0x2c), kbNumpad0 = GOSU_SCANCODE(0x52, 0x52), kbNumpad1 = GOSU_SCANCODE(0x53, 0x4f), kbNumpad2 = GOSU_SCANCODE(0x54, 0x50), kbNumpad3 = GOSU_SCANCODE(0x55, 0x51), kbNumpad4 = GOSU_SCANCODE(0x56, 0x4b), kbNumpad5 = GOSU_SCANCODE(0x57, 0x4c), kbNumpad6 = GOSU_SCANCODE(0x58, 0x4d), kbNumpad7 = GOSU_SCANCODE(0x59, 0x47), kbNumpad8 = GOSU_SCANCODE(0x5b, 0x48), kbNumpad9 = GOSU_SCANCODE(0x5c, 0x49), kbNumpadAdd = GOSU_SCANCODE(0x45, 0x4e), kbNumpadSubtract = GOSU_SCANCODE(0x4e, 0x4a), kbNumpadMultiply = GOSU_SCANCODE(0x43, 0x37), kbNumpadDivide = GOSU_SCANCODE(0x4b, 0xb5), kbRangeEnd = 0xff, msRangeBegin, msLeft = msRangeBegin, msRight, msMiddle, msWheelUp, msWheelDown, msOther0, msOther1, msOther2, msOther3, msOther4, msOther5, msOther6, msOther7, msRangeEnd = 0x110, gpRangeBegin, gpLeft = gpRangeBegin, gpRight, gpUp, gpDown, gpButton0, gpButton1, gpButton2, gpButton3, gpButton4, gpButton5, gpButton6, gpButton7, gpButton8, gpButton9, gpButton10, gpButton11, gpButton12, gpButton13, gpButton14, gpButton15, gp0Left, gp0Right, gp0Up, gp0Down, gp0Button0, gp0Button1, gp0Button2, gp0Button3, gp0Button4, gp0Button5, gp0Button6, gp0Button7, gp0Button8, gp0Button9, gp0Button10, gp0Button11, gp0Button12, gp0Button13, gp0Button14, gp0Button15, gp1Left, gp1Right, gp1Up, gp1Down, gp1Button0, gp1Button1, gp1Button2, gp1Button3, gp1Button4, gp1Button5, gp1Button6, gp1Button7, gp1Button8, gp1Button9, gp1Button10, gp1Button11, gp1Button12, gp1Button13, gp1Button14, gp1Button15, gp2Left, gp2Right, gp2Up, gp2Down, gp2Button0, gp2Button1, gp2Button2, gp2Button3, gp2Button4, gp2Button5, gp2Button6, gp2Button7, gp2Button8, gp2Button9, gp2Button10, gp2Button11, gp2Button12, gp2Button13, gp2Button14, gp2Button15, gp3Left, gp3Right, gp3Up, gp3Down, gp3Button0, gp3Button1, gp3Button2, gp3Button3, gp3Button4, gp3Button5, gp3Button6, gp3Button7, gp3Button8, gp3Button9, gp3Button10, gp3Button11, gp3Button12, gp3Button13, gp3Button14, gp3Button15, gpRangeEnd = gp3Button15, numButtons = gpRangeEnd + 1, numGamepads = 4, noButton = 0xffffffff, kbNum = kbRangeEnd - kbRangeBegin + 1, msNum = msRangeEnd - msRangeBegin + 1, gpNum = gpRangeEnd - gpRangeBegin + 1, gpNumPerGamepad = gpNum / (numGamepads + 1), }; } #undef GOSU_SCANCODE #undef GOSU_SPECIAL_SCANCODE #endif