...

Source file src/code.rocketnine.space/tslocum/kibodo/keys.go

Documentation: code.rocketnine.space/tslocum/kibodo

     1  package kibodo
     2  
     3  import "github.com/hajimehoshi/ebiten/v2"
     4  
     5  // KeysQWERTY is a standard QWERTY keyboard layout.
     6  var KeysQWERTY = [][]*Key{
     7  	{
     8  		{
     9  			LowerLabel: "`",
    10  			UpperLabel: "~",
    11  			LowerInput: &Input{Rune: '`'},
    12  			UpperInput: &Input{Rune: '~'},
    13  		},
    14  		{
    15  			LowerLabel: "1",
    16  			UpperLabel: "!",
    17  			LowerInput: &Input{Rune: '1'},
    18  			UpperInput: &Input{Rune: '!'},
    19  		},
    20  		{
    21  			LowerLabel: "2",
    22  			UpperLabel: "@",
    23  			LowerInput: &Input{Rune: '2'},
    24  			UpperInput: &Input{Rune: '@'},
    25  		},
    26  		{
    27  			LowerLabel: "3",
    28  			UpperLabel: "#",
    29  			LowerInput: &Input{Rune: '3'},
    30  			UpperInput: &Input{Rune: '#'},
    31  		},
    32  		{
    33  			LowerLabel: "4",
    34  			UpperLabel: "$",
    35  			LowerInput: &Input{Rune: '4'},
    36  			UpperInput: &Input{Rune: '$'},
    37  		},
    38  		{
    39  			LowerLabel: "5",
    40  			UpperLabel: "%",
    41  			LowerInput: &Input{Rune: '5'},
    42  			UpperInput: &Input{Rune: '%'},
    43  		},
    44  		{
    45  			LowerLabel: "6",
    46  			UpperLabel: "^",
    47  			LowerInput: &Input{Rune: '6'},
    48  			UpperInput: &Input{Rune: '^'},
    49  		},
    50  		{
    51  			LowerLabel: "7",
    52  			UpperLabel: "&",
    53  			LowerInput: &Input{Rune: '7'},
    54  			UpperInput: &Input{Rune: '&'},
    55  		},
    56  		{
    57  			LowerLabel: "8",
    58  			UpperLabel: "*",
    59  			LowerInput: &Input{Rune: '8'},
    60  			UpperInput: &Input{Rune: '*'},
    61  		},
    62  		{
    63  			LowerLabel: "9",
    64  			UpperLabel: "(",
    65  			LowerInput: &Input{Rune: '9'},
    66  			UpperInput: &Input{Rune: '('},
    67  		},
    68  		{
    69  			LowerLabel: "0",
    70  			UpperLabel: ")",
    71  			LowerInput: &Input{Rune: '0'},
    72  			UpperInput: &Input{Rune: ')'},
    73  		},
    74  		{
    75  			LowerLabel: "-",
    76  			UpperLabel: "_",
    77  			LowerInput: &Input{Rune: '-'},
    78  			UpperInput: &Input{Rune: '_'},
    79  		},
    80  		{
    81  			LowerLabel: "=",
    82  			UpperLabel: "+",
    83  			LowerInput: &Input{Rune: '='},
    84  			UpperInput: &Input{Rune: '+'},
    85  		},
    86  		{
    87  			LowerLabel: "Backspace",
    88  			UpperLabel: "BACKSPACE",
    89  			LowerInput: &Input{Key: ebiten.KeyBackspace},
    90  			UpperInput: &Input{Key: ebiten.KeyBackspace},
    91  		},
    92  	},
    93  	{
    94  		{
    95  			LowerLabel: "q",
    96  			UpperLabel: "Q",
    97  			LowerInput: &Input{Rune: 'q'},
    98  			UpperInput: &Input{Rune: 'Q'},
    99  		},
   100  		{
   101  			LowerLabel: "w",
   102  			UpperLabel: "W",
   103  			LowerInput: &Input{Rune: 'w'},
   104  			UpperInput: &Input{Rune: 'W'},
   105  		},
   106  		{
   107  			LowerLabel: "e",
   108  			UpperLabel: "E",
   109  			LowerInput: &Input{Rune: 'e'},
   110  			UpperInput: &Input{Rune: 'E'},
   111  		},
   112  		{
   113  			LowerLabel: "r",
   114  			UpperLabel: "R",
   115  			LowerInput: &Input{Rune: 'r'},
   116  			UpperInput: &Input{Rune: 'R'},
   117  		},
   118  		{
   119  			LowerLabel: "t",
   120  			UpperLabel: "T",
   121  			LowerInput: &Input{Rune: 't'},
   122  			UpperInput: &Input{Rune: 'T'},
   123  		},
   124  		{
   125  			LowerLabel: "y",
   126  			UpperLabel: "Y",
   127  			LowerInput: &Input{Rune: 'y'},
   128  			UpperInput: &Input{Rune: 'Y'},
   129  		},
   130  		{
   131  			LowerLabel: "u",
   132  			UpperLabel: "U",
   133  			LowerInput: &Input{Rune: 'u'},
   134  			UpperInput: &Input{Rune: 'U'},
   135  		},
   136  		{
   137  			LowerLabel: "i",
   138  			UpperLabel: "I",
   139  			LowerInput: &Input{Rune: 'i'},
   140  			UpperInput: &Input{Rune: 'I'},
   141  		},
   142  		{
   143  			LowerLabel: "o",
   144  			UpperLabel: "O",
   145  			LowerInput: &Input{Rune: 'o'},
   146  			UpperInput: &Input{Rune: 'O'},
   147  		},
   148  		{
   149  			LowerLabel: "p",
   150  			UpperLabel: "P",
   151  			LowerInput: &Input{Rune: 'p'},
   152  			UpperInput: &Input{Rune: 'P'},
   153  		},
   154  		{
   155  			LowerLabel: "[",
   156  			UpperLabel: "{",
   157  			LowerInput: &Input{Rune: '['},
   158  			UpperInput: &Input{Rune: '{'},
   159  		},
   160  		{
   161  			LowerLabel: "]",
   162  			UpperLabel: "}",
   163  			LowerInput: &Input{Rune: ']'},
   164  			UpperInput: &Input{Rune: '}'},
   165  		},
   166  		{
   167  			LowerLabel: "\\",
   168  			UpperLabel: "|",
   169  			LowerInput: &Input{Rune: '\\'},
   170  			UpperInput: &Input{Rune: '|'},
   171  		},
   172  	},
   173  	{
   174  		{
   175  			LowerLabel: "a",
   176  			UpperLabel: "A",
   177  			LowerInput: &Input{Rune: 'a'},
   178  			UpperInput: &Input{Rune: 'A'},
   179  		},
   180  		{
   181  			LowerLabel: "s",
   182  			UpperLabel: "S",
   183  			LowerInput: &Input{Rune: 's'},
   184  			UpperInput: &Input{Rune: 'S'},
   185  		},
   186  		{
   187  			LowerLabel: "d",
   188  			UpperLabel: "D",
   189  			LowerInput: &Input{Rune: 'd'},
   190  			UpperInput: &Input{Rune: 'D'},
   191  		},
   192  		{
   193  			LowerLabel: "f",
   194  			UpperLabel: "F",
   195  			LowerInput: &Input{Rune: 'f'},
   196  			UpperInput: &Input{Rune: 'F'},
   197  		},
   198  		{
   199  			LowerLabel: "g",
   200  			UpperLabel: "G",
   201  			LowerInput: &Input{Rune: 'g'},
   202  			UpperInput: &Input{Rune: 'G'},
   203  		},
   204  		{
   205  			LowerLabel: "h",
   206  			UpperLabel: "H",
   207  			LowerInput: &Input{Rune: 'h'},
   208  			UpperInput: &Input{Rune: 'H'},
   209  		},
   210  		{
   211  			LowerLabel: "j",
   212  			UpperLabel: "J",
   213  			LowerInput: &Input{Rune: 'j'},
   214  			UpperInput: &Input{Rune: 'J'},
   215  		},
   216  		{
   217  			LowerLabel: "k",
   218  			UpperLabel: "K",
   219  			LowerInput: &Input{Rune: 'k'},
   220  			UpperInput: &Input{Rune: 'K'},
   221  		},
   222  		{
   223  			LowerLabel: "l",
   224  			UpperLabel: "L",
   225  			LowerInput: &Input{Rune: 'l'},
   226  			UpperInput: &Input{Rune: 'L'},
   227  		},
   228  		{
   229  			LowerLabel: ";",
   230  			UpperLabel: ":",
   231  			LowerInput: &Input{Rune: ';'},
   232  			UpperInput: &Input{Rune: ':'},
   233  		},
   234  		{
   235  			LowerLabel: `'`,
   236  			UpperLabel: `"`,
   237  			LowerInput: &Input{Rune: '\''},
   238  			UpperInput: &Input{Rune: '"'},
   239  		},
   240  		{
   241  			LowerLabel: "Enter",
   242  			UpperLabel: "ENTER",
   243  			LowerInput: &Input{Key: ebiten.KeyEnter},
   244  			UpperInput: &Input{Key: ebiten.KeyEnter},
   245  		},
   246  	},
   247  	{
   248  		{
   249  			LowerLabel: "Shift",
   250  			UpperLabel: "SHIFT",
   251  			LowerInput: &Input{Key: ebiten.KeyShift},
   252  			UpperInput: &Input{Key: ebiten.KeyShift},
   253  		},
   254  		{
   255  			LowerLabel: "z",
   256  			UpperLabel: "Z",
   257  			LowerInput: &Input{Rune: 'z'},
   258  			UpperInput: &Input{Rune: 'Z'},
   259  		},
   260  		{
   261  			LowerLabel: "x",
   262  			UpperLabel: "X",
   263  			LowerInput: &Input{Rune: 'x'},
   264  			UpperInput: &Input{Rune: 'X'},
   265  		},
   266  		{
   267  			LowerLabel: "c",
   268  			UpperLabel: "C",
   269  			LowerInput: &Input{Rune: 'c'},
   270  			UpperInput: &Input{Rune: 'C'},
   271  		},
   272  		{
   273  			LowerLabel: "v",
   274  			UpperLabel: "V",
   275  			LowerInput: &Input{Rune: 'v'},
   276  			UpperInput: &Input{Rune: 'V'},
   277  		},
   278  		{
   279  			LowerLabel: "b",
   280  			UpperLabel: "B",
   281  			LowerInput: &Input{Rune: 'b'},
   282  			UpperInput: &Input{Rune: 'B'},
   283  		},
   284  		{
   285  			LowerLabel: "n",
   286  			UpperLabel: "N",
   287  			LowerInput: &Input{Rune: 'n'},
   288  			UpperInput: &Input{Rune: 'N'},
   289  		},
   290  		{
   291  			LowerLabel: "m",
   292  			UpperLabel: "M",
   293  			LowerInput: &Input{Rune: 'm'},
   294  			UpperInput: &Input{Rune: 'M'},
   295  		},
   296  		{
   297  			LowerLabel: ",",
   298  			UpperLabel: "<",
   299  			LowerInput: &Input{Rune: ','},
   300  			UpperInput: &Input{Rune: '<'},
   301  		},
   302  		{
   303  			LowerLabel: ".",
   304  			UpperLabel: ">",
   305  			LowerInput: &Input{Rune: '.'},
   306  			UpperInput: &Input{Rune: '>'},
   307  		},
   308  		{
   309  			LowerLabel: "/",
   310  			UpperLabel: "?",
   311  			LowerInput: &Input{Rune: '/'},
   312  			UpperInput: &Input{Rune: '?'},
   313  		},
   314  	},
   315  	{
   316  		{
   317  			LowerLabel: "Space",
   318  			UpperLabel: "SPACE",
   319  			LowerInput: &Input{Rune: ' '},
   320  			UpperInput: &Input{Rune: ' '},
   321  		},
   322  	},
   323  }
   324  
   325  var allKeys = []ebiten.Key{
   326  	ebiten.KeyA,
   327  	ebiten.KeyB,
   328  	ebiten.KeyC,
   329  	ebiten.KeyD,
   330  	ebiten.KeyE,
   331  	ebiten.KeyF,
   332  	ebiten.KeyG,
   333  	ebiten.KeyH,
   334  	ebiten.KeyI,
   335  	ebiten.KeyJ,
   336  	ebiten.KeyK,
   337  	ebiten.KeyL,
   338  	ebiten.KeyM,
   339  	ebiten.KeyN,
   340  	ebiten.KeyO,
   341  	ebiten.KeyP,
   342  	ebiten.KeyQ,
   343  	ebiten.KeyR,
   344  	ebiten.KeyS,
   345  	ebiten.KeyT,
   346  	ebiten.KeyU,
   347  	ebiten.KeyV,
   348  	ebiten.KeyW,
   349  	ebiten.KeyX,
   350  	ebiten.KeyY,
   351  	ebiten.KeyZ,
   352  	ebiten.KeyAltLeft,
   353  	ebiten.KeyAltRight,
   354  	ebiten.KeyArrowDown,
   355  	ebiten.KeyArrowLeft,
   356  	ebiten.KeyArrowRight,
   357  	ebiten.KeyArrowUp,
   358  	ebiten.KeyBackquote,
   359  	ebiten.KeyBackslash,
   360  	ebiten.KeyBackspace,
   361  	ebiten.KeyBracketLeft,
   362  	ebiten.KeyBracketRight,
   363  	ebiten.KeyCapsLock,
   364  	ebiten.KeyComma,
   365  	ebiten.KeyContextMenu,
   366  	ebiten.KeyControlLeft,
   367  	ebiten.KeyControlRight,
   368  	ebiten.KeyDelete,
   369  	ebiten.KeyDigit0,
   370  	ebiten.KeyDigit1,
   371  	ebiten.KeyDigit2,
   372  	ebiten.KeyDigit3,
   373  	ebiten.KeyDigit4,
   374  	ebiten.KeyDigit5,
   375  	ebiten.KeyDigit6,
   376  	ebiten.KeyDigit7,
   377  	ebiten.KeyDigit8,
   378  	ebiten.KeyDigit9,
   379  	ebiten.KeyEnd,
   380  	ebiten.KeyEnter,
   381  	ebiten.KeyEqual,
   382  	ebiten.KeyEscape,
   383  	ebiten.KeyF1,
   384  	ebiten.KeyF2,
   385  	ebiten.KeyF3,
   386  	ebiten.KeyF4,
   387  	ebiten.KeyF5,
   388  	ebiten.KeyF6,
   389  	ebiten.KeyF7,
   390  	ebiten.KeyF8,
   391  	ebiten.KeyF9,
   392  	ebiten.KeyF10,
   393  	ebiten.KeyF11,
   394  	ebiten.KeyF12,
   395  	ebiten.KeyHome,
   396  	ebiten.KeyInsert,
   397  	ebiten.KeyMetaLeft,
   398  	ebiten.KeyMetaRight,
   399  	ebiten.KeyMinus,
   400  	ebiten.KeyNumLock,
   401  	ebiten.KeyNumpad0,
   402  	ebiten.KeyNumpad1,
   403  	ebiten.KeyNumpad2,
   404  	ebiten.KeyNumpad3,
   405  	ebiten.KeyNumpad4,
   406  	ebiten.KeyNumpad5,
   407  	ebiten.KeyNumpad6,
   408  	ebiten.KeyNumpad7,
   409  	ebiten.KeyNumpad8,
   410  	ebiten.KeyNumpad9,
   411  	ebiten.KeyNumpadAdd,
   412  	ebiten.KeyNumpadDecimal,
   413  	ebiten.KeyNumpadDivide,
   414  	ebiten.KeyNumpadEnter,
   415  	ebiten.KeyNumpadEqual,
   416  	ebiten.KeyNumpadMultiply,
   417  	ebiten.KeyNumpadSubtract,
   418  	ebiten.KeyPageDown,
   419  	ebiten.KeyPageUp,
   420  	ebiten.KeyPause,
   421  	ebiten.KeyPeriod,
   422  	ebiten.KeyPrintScreen,
   423  	ebiten.KeyQuote,
   424  	ebiten.KeyScrollLock,
   425  	ebiten.KeySemicolon,
   426  	ebiten.KeyShiftLeft,
   427  	ebiten.KeyShiftRight,
   428  	ebiten.KeySlash,
   429  	ebiten.KeySpace,
   430  	ebiten.KeyTab,
   431  	ebiten.KeyAlt,
   432  	ebiten.KeyControl,
   433  	ebiten.KeyShift,
   434  	ebiten.KeyMeta,
   435  	ebiten.KeyMax,
   436  }
   437  

View as plain text