internal KeyInfo(Scancode Key, SDL1_Keycode storage, string Name, string Description) { this.Scancode = Key; this.Name = Name; this.Description = Description; this.StorageCode = (int)storage; }
private bool KeyReleased(SDL2.SDL.SDL_Scancode scanCode) { return(CurrentKeys[(int)scanCode] == 0 && PreviousKeys[(int)scanCode] == 1); }
/// <summary> /// Looks up the Keycode for a Scancode in Keys array /// </summary> /// <returns>Corresponding Keycode or Keycode.SDLK_UNKNOWN</returns> /// <param name="value">The scancode for search.</param> private static int LookupScancode(Scancode value){ for(int k = 0; k < Keys.Length; k++){ int i; if ((k & 1) == 0) { i = (currentIndex + (k >> 1) + Keys.Length) % Keys.Length; } else { i = (currentIndex - (k + 1 >> 1) + Keys.Length) % Keys.Length; } if (Keys[i].Scancode == value) { currentIndex = (i + 1) % Keys.Length; return Keys[i].StorageCode; } } return (int)SDL1_Keycode.SDLK_UNKNOWN; }