twitchapon-anim

Basic Twitchapon Receiver/Visuals
git clone git://bsandro.tech/twitchapon-anim
Log | Files | Refs | README | LICENSE

keys.go (15203B)


      1 // Copyright 2013 The Ebiten Authors
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 // Code generated by genkeys.go using 'go generate'. DO NOT EDIT.
     16 
     17 package ebiten
     18 
     19 import (
     20 	"strings"
     21 
     22 	"github.com/hajimehoshi/ebiten/v2/internal/driver"
     23 )
     24 
     25 // A Key represents a keyboard key.
     26 // These keys represent pysical keys of US keyboard.
     27 // For example, KeyQ represents Q key on US keyboards and ' (quote) key on Dvorak keyboards.
     28 type Key int
     29 
     30 // Keys.
     31 const (
     32 	Key0            Key = Key(driver.Key0)
     33 	Key1            Key = Key(driver.Key1)
     34 	Key2            Key = Key(driver.Key2)
     35 	Key3            Key = Key(driver.Key3)
     36 	Key4            Key = Key(driver.Key4)
     37 	Key5            Key = Key(driver.Key5)
     38 	Key6            Key = Key(driver.Key6)
     39 	Key7            Key = Key(driver.Key7)
     40 	Key8            Key = Key(driver.Key8)
     41 	Key9            Key = Key(driver.Key9)
     42 	KeyA            Key = Key(driver.KeyA)
     43 	KeyB            Key = Key(driver.KeyB)
     44 	KeyC            Key = Key(driver.KeyC)
     45 	KeyD            Key = Key(driver.KeyD)
     46 	KeyE            Key = Key(driver.KeyE)
     47 	KeyF            Key = Key(driver.KeyF)
     48 	KeyG            Key = Key(driver.KeyG)
     49 	KeyH            Key = Key(driver.KeyH)
     50 	KeyI            Key = Key(driver.KeyI)
     51 	KeyJ            Key = Key(driver.KeyJ)
     52 	KeyK            Key = Key(driver.KeyK)
     53 	KeyL            Key = Key(driver.KeyL)
     54 	KeyM            Key = Key(driver.KeyM)
     55 	KeyN            Key = Key(driver.KeyN)
     56 	KeyO            Key = Key(driver.KeyO)
     57 	KeyP            Key = Key(driver.KeyP)
     58 	KeyQ            Key = Key(driver.KeyQ)
     59 	KeyR            Key = Key(driver.KeyR)
     60 	KeyS            Key = Key(driver.KeyS)
     61 	KeyT            Key = Key(driver.KeyT)
     62 	KeyU            Key = Key(driver.KeyU)
     63 	KeyV            Key = Key(driver.KeyV)
     64 	KeyW            Key = Key(driver.KeyW)
     65 	KeyX            Key = Key(driver.KeyX)
     66 	KeyY            Key = Key(driver.KeyY)
     67 	KeyZ            Key = Key(driver.KeyZ)
     68 	KeyApostrophe   Key = Key(driver.KeyApostrophe)
     69 	KeyBackslash    Key = Key(driver.KeyBackslash)
     70 	KeyBackspace    Key = Key(driver.KeyBackspace)
     71 	KeyCapsLock     Key = Key(driver.KeyCapsLock)
     72 	KeyComma        Key = Key(driver.KeyComma)
     73 	KeyDelete       Key = Key(driver.KeyDelete)
     74 	KeyDown         Key = Key(driver.KeyDown)
     75 	KeyEnd          Key = Key(driver.KeyEnd)
     76 	KeyEnter        Key = Key(driver.KeyEnter)
     77 	KeyEqual        Key = Key(driver.KeyEqual)
     78 	KeyEscape       Key = Key(driver.KeyEscape)
     79 	KeyF1           Key = Key(driver.KeyF1)
     80 	KeyF2           Key = Key(driver.KeyF2)
     81 	KeyF3           Key = Key(driver.KeyF3)
     82 	KeyF4           Key = Key(driver.KeyF4)
     83 	KeyF5           Key = Key(driver.KeyF5)
     84 	KeyF6           Key = Key(driver.KeyF6)
     85 	KeyF7           Key = Key(driver.KeyF7)
     86 	KeyF8           Key = Key(driver.KeyF8)
     87 	KeyF9           Key = Key(driver.KeyF9)
     88 	KeyF10          Key = Key(driver.KeyF10)
     89 	KeyF11          Key = Key(driver.KeyF11)
     90 	KeyF12          Key = Key(driver.KeyF12)
     91 	KeyGraveAccent  Key = Key(driver.KeyGraveAccent)
     92 	KeyHome         Key = Key(driver.KeyHome)
     93 	KeyInsert       Key = Key(driver.KeyInsert)
     94 	KeyKP0          Key = Key(driver.KeyKP0)
     95 	KeyKP1          Key = Key(driver.KeyKP1)
     96 	KeyKP2          Key = Key(driver.KeyKP2)
     97 	KeyKP3          Key = Key(driver.KeyKP3)
     98 	KeyKP4          Key = Key(driver.KeyKP4)
     99 	KeyKP5          Key = Key(driver.KeyKP5)
    100 	KeyKP6          Key = Key(driver.KeyKP6)
    101 	KeyKP7          Key = Key(driver.KeyKP7)
    102 	KeyKP8          Key = Key(driver.KeyKP8)
    103 	KeyKP9          Key = Key(driver.KeyKP9)
    104 	KeyKPAdd        Key = Key(driver.KeyKPAdd)
    105 	KeyKPDecimal    Key = Key(driver.KeyKPDecimal)
    106 	KeyKPDivide     Key = Key(driver.KeyKPDivide)
    107 	KeyKPEnter      Key = Key(driver.KeyKPEnter)
    108 	KeyKPEqual      Key = Key(driver.KeyKPEqual)
    109 	KeyKPMultiply   Key = Key(driver.KeyKPMultiply)
    110 	KeyKPSubtract   Key = Key(driver.KeyKPSubtract)
    111 	KeyLeft         Key = Key(driver.KeyLeft)
    112 	KeyLeftBracket  Key = Key(driver.KeyLeftBracket)
    113 	KeyMenu         Key = Key(driver.KeyMenu)
    114 	KeyMinus        Key = Key(driver.KeyMinus)
    115 	KeyNumLock      Key = Key(driver.KeyNumLock)
    116 	KeyPageDown     Key = Key(driver.KeyPageDown)
    117 	KeyPageUp       Key = Key(driver.KeyPageUp)
    118 	KeyPause        Key = Key(driver.KeyPause)
    119 	KeyPeriod       Key = Key(driver.KeyPeriod)
    120 	KeyPrintScreen  Key = Key(driver.KeyPrintScreen)
    121 	KeyRight        Key = Key(driver.KeyRight)
    122 	KeyRightBracket Key = Key(driver.KeyRightBracket)
    123 	KeyScrollLock   Key = Key(driver.KeyScrollLock)
    124 	KeySemicolon    Key = Key(driver.KeySemicolon)
    125 	KeySlash        Key = Key(driver.KeySlash)
    126 	KeySpace        Key = Key(driver.KeySpace)
    127 	KeyTab          Key = Key(driver.KeyTab)
    128 	KeyUp           Key = Key(driver.KeyUp)
    129 	KeyAlt          Key = Key(driver.KeyReserved0)
    130 	KeyControl      Key = Key(driver.KeyReserved1)
    131 	KeyShift        Key = Key(driver.KeyReserved2)
    132 	KeyMax          Key = KeyShift
    133 )
    134 
    135 func (k Key) isValid() bool {
    136 	switch k {
    137 	case Key0:
    138 		return true
    139 	case Key1:
    140 		return true
    141 	case Key2:
    142 		return true
    143 	case Key3:
    144 		return true
    145 	case Key4:
    146 		return true
    147 	case Key5:
    148 		return true
    149 	case Key6:
    150 		return true
    151 	case Key7:
    152 		return true
    153 	case Key8:
    154 		return true
    155 	case Key9:
    156 		return true
    157 	case KeyA:
    158 		return true
    159 	case KeyB:
    160 		return true
    161 	case KeyC:
    162 		return true
    163 	case KeyD:
    164 		return true
    165 	case KeyE:
    166 		return true
    167 	case KeyF:
    168 		return true
    169 	case KeyG:
    170 		return true
    171 	case KeyH:
    172 		return true
    173 	case KeyI:
    174 		return true
    175 	case KeyJ:
    176 		return true
    177 	case KeyK:
    178 		return true
    179 	case KeyL:
    180 		return true
    181 	case KeyM:
    182 		return true
    183 	case KeyN:
    184 		return true
    185 	case KeyO:
    186 		return true
    187 	case KeyP:
    188 		return true
    189 	case KeyQ:
    190 		return true
    191 	case KeyR:
    192 		return true
    193 	case KeyS:
    194 		return true
    195 	case KeyT:
    196 		return true
    197 	case KeyU:
    198 		return true
    199 	case KeyV:
    200 		return true
    201 	case KeyW:
    202 		return true
    203 	case KeyX:
    204 		return true
    205 	case KeyY:
    206 		return true
    207 	case KeyZ:
    208 		return true
    209 	case KeyAlt:
    210 		return true
    211 	case KeyApostrophe:
    212 		return true
    213 	case KeyBackslash:
    214 		return true
    215 	case KeyBackspace:
    216 		return true
    217 	case KeyCapsLock:
    218 		return true
    219 	case KeyComma:
    220 		return true
    221 	case KeyControl:
    222 		return true
    223 	case KeyDelete:
    224 		return true
    225 	case KeyDown:
    226 		return true
    227 	case KeyEnd:
    228 		return true
    229 	case KeyEnter:
    230 		return true
    231 	case KeyEqual:
    232 		return true
    233 	case KeyEscape:
    234 		return true
    235 	case KeyF1:
    236 		return true
    237 	case KeyF2:
    238 		return true
    239 	case KeyF3:
    240 		return true
    241 	case KeyF4:
    242 		return true
    243 	case KeyF5:
    244 		return true
    245 	case KeyF6:
    246 		return true
    247 	case KeyF7:
    248 		return true
    249 	case KeyF8:
    250 		return true
    251 	case KeyF9:
    252 		return true
    253 	case KeyF10:
    254 		return true
    255 	case KeyF11:
    256 		return true
    257 	case KeyF12:
    258 		return true
    259 	case KeyGraveAccent:
    260 		return true
    261 	case KeyHome:
    262 		return true
    263 	case KeyInsert:
    264 		return true
    265 	case KeyKP0:
    266 		return true
    267 	case KeyKP1:
    268 		return true
    269 	case KeyKP2:
    270 		return true
    271 	case KeyKP3:
    272 		return true
    273 	case KeyKP4:
    274 		return true
    275 	case KeyKP5:
    276 		return true
    277 	case KeyKP6:
    278 		return true
    279 	case KeyKP7:
    280 		return true
    281 	case KeyKP8:
    282 		return true
    283 	case KeyKP9:
    284 		return true
    285 	case KeyKPAdd:
    286 		return true
    287 	case KeyKPDecimal:
    288 		return true
    289 	case KeyKPDivide:
    290 		return true
    291 	case KeyKPEnter:
    292 		return true
    293 	case KeyKPEqual:
    294 		return true
    295 	case KeyKPMultiply:
    296 		return true
    297 	case KeyKPSubtract:
    298 		return true
    299 	case KeyLeft:
    300 		return true
    301 	case KeyLeftBracket:
    302 		return true
    303 	case KeyMenu:
    304 		return true
    305 	case KeyMinus:
    306 		return true
    307 	case KeyNumLock:
    308 		return true
    309 	case KeyPageDown:
    310 		return true
    311 	case KeyPageUp:
    312 		return true
    313 	case KeyPause:
    314 		return true
    315 	case KeyPeriod:
    316 		return true
    317 	case KeyPrintScreen:
    318 		return true
    319 	case KeyRight:
    320 		return true
    321 	case KeyRightBracket:
    322 		return true
    323 	case KeyScrollLock:
    324 		return true
    325 	case KeySemicolon:
    326 		return true
    327 	case KeyShift:
    328 		return true
    329 	case KeySlash:
    330 		return true
    331 	case KeySpace:
    332 		return true
    333 	case KeyTab:
    334 		return true
    335 	case KeyUp:
    336 		return true
    337 
    338 	default:
    339 		return false
    340 	}
    341 }
    342 
    343 // String returns a string representing the key.
    344 //
    345 // If k is an undefined key, String returns an empty string.
    346 func (k Key) String() string {
    347 	switch k {
    348 	case Key0:
    349 		return "0"
    350 	case Key1:
    351 		return "1"
    352 	case Key2:
    353 		return "2"
    354 	case Key3:
    355 		return "3"
    356 	case Key4:
    357 		return "4"
    358 	case Key5:
    359 		return "5"
    360 	case Key6:
    361 		return "6"
    362 	case Key7:
    363 		return "7"
    364 	case Key8:
    365 		return "8"
    366 	case Key9:
    367 		return "9"
    368 	case KeyA:
    369 		return "A"
    370 	case KeyB:
    371 		return "B"
    372 	case KeyC:
    373 		return "C"
    374 	case KeyD:
    375 		return "D"
    376 	case KeyE:
    377 		return "E"
    378 	case KeyF:
    379 		return "F"
    380 	case KeyG:
    381 		return "G"
    382 	case KeyH:
    383 		return "H"
    384 	case KeyI:
    385 		return "I"
    386 	case KeyJ:
    387 		return "J"
    388 	case KeyK:
    389 		return "K"
    390 	case KeyL:
    391 		return "L"
    392 	case KeyM:
    393 		return "M"
    394 	case KeyN:
    395 		return "N"
    396 	case KeyO:
    397 		return "O"
    398 	case KeyP:
    399 		return "P"
    400 	case KeyQ:
    401 		return "Q"
    402 	case KeyR:
    403 		return "R"
    404 	case KeyS:
    405 		return "S"
    406 	case KeyT:
    407 		return "T"
    408 	case KeyU:
    409 		return "U"
    410 	case KeyV:
    411 		return "V"
    412 	case KeyW:
    413 		return "W"
    414 	case KeyX:
    415 		return "X"
    416 	case KeyY:
    417 		return "Y"
    418 	case KeyZ:
    419 		return "Z"
    420 	case KeyAlt:
    421 		return "Alt"
    422 	case KeyApostrophe:
    423 		return "Apostrophe"
    424 	case KeyBackslash:
    425 		return "Backslash"
    426 	case KeyBackspace:
    427 		return "Backspace"
    428 	case KeyCapsLock:
    429 		return "CapsLock"
    430 	case KeyComma:
    431 		return "Comma"
    432 	case KeyControl:
    433 		return "Control"
    434 	case KeyDelete:
    435 		return "Delete"
    436 	case KeyDown:
    437 		return "Down"
    438 	case KeyEnd:
    439 		return "End"
    440 	case KeyEnter:
    441 		return "Enter"
    442 	case KeyEqual:
    443 		return "Equal"
    444 	case KeyEscape:
    445 		return "Escape"
    446 	case KeyF1:
    447 		return "F1"
    448 	case KeyF2:
    449 		return "F2"
    450 	case KeyF3:
    451 		return "F3"
    452 	case KeyF4:
    453 		return "F4"
    454 	case KeyF5:
    455 		return "F5"
    456 	case KeyF6:
    457 		return "F6"
    458 	case KeyF7:
    459 		return "F7"
    460 	case KeyF8:
    461 		return "F8"
    462 	case KeyF9:
    463 		return "F9"
    464 	case KeyF10:
    465 		return "F10"
    466 	case KeyF11:
    467 		return "F11"
    468 	case KeyF12:
    469 		return "F12"
    470 	case KeyGraveAccent:
    471 		return "GraveAccent"
    472 	case KeyHome:
    473 		return "Home"
    474 	case KeyInsert:
    475 		return "Insert"
    476 	case KeyKP0:
    477 		return "KP0"
    478 	case KeyKP1:
    479 		return "KP1"
    480 	case KeyKP2:
    481 		return "KP2"
    482 	case KeyKP3:
    483 		return "KP3"
    484 	case KeyKP4:
    485 		return "KP4"
    486 	case KeyKP5:
    487 		return "KP5"
    488 	case KeyKP6:
    489 		return "KP6"
    490 	case KeyKP7:
    491 		return "KP7"
    492 	case KeyKP8:
    493 		return "KP8"
    494 	case KeyKP9:
    495 		return "KP9"
    496 	case KeyKPAdd:
    497 		return "KPAdd"
    498 	case KeyKPDecimal:
    499 		return "KPDecimal"
    500 	case KeyKPDivide:
    501 		return "KPDivide"
    502 	case KeyKPEnter:
    503 		return "KPEnter"
    504 	case KeyKPEqual:
    505 		return "KPEqual"
    506 	case KeyKPMultiply:
    507 		return "KPMultiply"
    508 	case KeyKPSubtract:
    509 		return "KPSubtract"
    510 	case KeyLeft:
    511 		return "Left"
    512 	case KeyLeftBracket:
    513 		return "LeftBracket"
    514 	case KeyMenu:
    515 		return "Menu"
    516 	case KeyMinus:
    517 		return "Minus"
    518 	case KeyNumLock:
    519 		return "NumLock"
    520 	case KeyPageDown:
    521 		return "PageDown"
    522 	case KeyPageUp:
    523 		return "PageUp"
    524 	case KeyPause:
    525 		return "Pause"
    526 	case KeyPeriod:
    527 		return "Period"
    528 	case KeyPrintScreen:
    529 		return "PrintScreen"
    530 	case KeyRight:
    531 		return "Right"
    532 	case KeyRightBracket:
    533 		return "RightBracket"
    534 	case KeyScrollLock:
    535 		return "ScrollLock"
    536 	case KeySemicolon:
    537 		return "Semicolon"
    538 	case KeyShift:
    539 		return "Shift"
    540 	case KeySlash:
    541 		return "Slash"
    542 	case KeySpace:
    543 		return "Space"
    544 	case KeyTab:
    545 		return "Tab"
    546 	case KeyUp:
    547 		return "Up"
    548 	}
    549 	return ""
    550 }
    551 
    552 func keyNameToKeyCode(name string) (Key, bool) {
    553 	switch strings.ToLower(name) {
    554 	case "0":
    555 		return Key0, true
    556 	case "1":
    557 		return Key1, true
    558 	case "2":
    559 		return Key2, true
    560 	case "3":
    561 		return Key3, true
    562 	case "4":
    563 		return Key4, true
    564 	case "5":
    565 		return Key5, true
    566 	case "6":
    567 		return Key6, true
    568 	case "7":
    569 		return Key7, true
    570 	case "8":
    571 		return Key8, true
    572 	case "9":
    573 		return Key9, true
    574 	case "a":
    575 		return KeyA, true
    576 	case "b":
    577 		return KeyB, true
    578 	case "c":
    579 		return KeyC, true
    580 	case "d":
    581 		return KeyD, true
    582 	case "e":
    583 		return KeyE, true
    584 	case "f":
    585 		return KeyF, true
    586 	case "g":
    587 		return KeyG, true
    588 	case "h":
    589 		return KeyH, true
    590 	case "i":
    591 		return KeyI, true
    592 	case "j":
    593 		return KeyJ, true
    594 	case "k":
    595 		return KeyK, true
    596 	case "l":
    597 		return KeyL, true
    598 	case "m":
    599 		return KeyM, true
    600 	case "n":
    601 		return KeyN, true
    602 	case "o":
    603 		return KeyO, true
    604 	case "p":
    605 		return KeyP, true
    606 	case "q":
    607 		return KeyQ, true
    608 	case "r":
    609 		return KeyR, true
    610 	case "s":
    611 		return KeyS, true
    612 	case "t":
    613 		return KeyT, true
    614 	case "u":
    615 		return KeyU, true
    616 	case "v":
    617 		return KeyV, true
    618 	case "w":
    619 		return KeyW, true
    620 	case "x":
    621 		return KeyX, true
    622 	case "y":
    623 		return KeyY, true
    624 	case "z":
    625 		return KeyZ, true
    626 	case "alt":
    627 		return KeyAlt, true
    628 	case "apostrophe":
    629 		return KeyApostrophe, true
    630 	case "backslash":
    631 		return KeyBackslash, true
    632 	case "backspace":
    633 		return KeyBackspace, true
    634 	case "capslock":
    635 		return KeyCapsLock, true
    636 	case "comma":
    637 		return KeyComma, true
    638 	case "control":
    639 		return KeyControl, true
    640 	case "delete":
    641 		return KeyDelete, true
    642 	case "down":
    643 		return KeyDown, true
    644 	case "end":
    645 		return KeyEnd, true
    646 	case "enter":
    647 		return KeyEnter, true
    648 	case "equal":
    649 		return KeyEqual, true
    650 	case "escape":
    651 		return KeyEscape, true
    652 	case "f1":
    653 		return KeyF1, true
    654 	case "f2":
    655 		return KeyF2, true
    656 	case "f3":
    657 		return KeyF3, true
    658 	case "f4":
    659 		return KeyF4, true
    660 	case "f5":
    661 		return KeyF5, true
    662 	case "f6":
    663 		return KeyF6, true
    664 	case "f7":
    665 		return KeyF7, true
    666 	case "f8":
    667 		return KeyF8, true
    668 	case "f9":
    669 		return KeyF9, true
    670 	case "f10":
    671 		return KeyF10, true
    672 	case "f11":
    673 		return KeyF11, true
    674 	case "f12":
    675 		return KeyF12, true
    676 	case "graveaccent":
    677 		return KeyGraveAccent, true
    678 	case "home":
    679 		return KeyHome, true
    680 	case "insert":
    681 		return KeyInsert, true
    682 	case "kp0":
    683 		return KeyKP0, true
    684 	case "kp1":
    685 		return KeyKP1, true
    686 	case "kp2":
    687 		return KeyKP2, true
    688 	case "kp3":
    689 		return KeyKP3, true
    690 	case "kp4":
    691 		return KeyKP4, true
    692 	case "kp5":
    693 		return KeyKP5, true
    694 	case "kp6":
    695 		return KeyKP6, true
    696 	case "kp7":
    697 		return KeyKP7, true
    698 	case "kp8":
    699 		return KeyKP8, true
    700 	case "kp9":
    701 		return KeyKP9, true
    702 	case "kpadd":
    703 		return KeyKPAdd, true
    704 	case "kpdecimal":
    705 		return KeyKPDecimal, true
    706 	case "kpdivide":
    707 		return KeyKPDivide, true
    708 	case "kpenter":
    709 		return KeyKPEnter, true
    710 	case "kpequal":
    711 		return KeyKPEqual, true
    712 	case "kpmultiply":
    713 		return KeyKPMultiply, true
    714 	case "kpsubtract":
    715 		return KeyKPSubtract, true
    716 	case "left":
    717 		return KeyLeft, true
    718 	case "leftbracket":
    719 		return KeyLeftBracket, true
    720 	case "menu":
    721 		return KeyMenu, true
    722 	case "minus":
    723 		return KeyMinus, true
    724 	case "numlock":
    725 		return KeyNumLock, true
    726 	case "pagedown":
    727 		return KeyPageDown, true
    728 	case "pageup":
    729 		return KeyPageUp, true
    730 	case "pause":
    731 		return KeyPause, true
    732 	case "period":
    733 		return KeyPeriod, true
    734 	case "printscreen":
    735 		return KeyPrintScreen, true
    736 	case "right":
    737 		return KeyRight, true
    738 	case "rightbracket":
    739 		return KeyRightBracket, true
    740 	case "scrolllock":
    741 		return KeyScrollLock, true
    742 	case "semicolon":
    743 		return KeySemicolon, true
    744 	case "shift":
    745 		return KeyShift, true
    746 	case "slash":
    747 		return KeySlash, true
    748 	case "space":
    749 		return KeySpace, true
    750 	case "tab":
    751 		return KeyTab, true
    752 	case "up":
    753 		return KeyUp, true
    754 	}
    755 	return 0, false
    756 }