keyhandlers

package
v0.0.0-...-29fc142 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyboardToKeypad = map[pixelgl.Button]byte{
	pixelgl.Key1: 1,
	pixelgl.Key2: 2,
	pixelgl.Key3: 3,
	pixelgl.Key4: 0xC,
	pixelgl.KeyQ: 4,
	pixelgl.KeyW: 5,
	pixelgl.KeyE: 6,
	pixelgl.KeyR: 0xD,
	pixelgl.KeyA: 7,
	pixelgl.KeyS: 8,
	pixelgl.KeyD: 9,
	pixelgl.KeyF: 0xE,
	pixelgl.KeyZ: 0xA,
	pixelgl.KeyX: 0,
	pixelgl.KeyC: 0xB,
	pixelgl.KeyV: 0xF,
}

KeyboardToKeypad maps the keys a computer keyboard to the keys of a chip8 keypad, following the conversion:

Computer Keyboard  Keypad
 |1|2|3|4|        |1|2|3|C|
|Q|W|E|R|         |4|5|6|D|
|A|S|D|F|         |7|8|9|E|
|Z|X|C|V|         |A|0|B|F|

Functions

This section is empty.

Types

type Cmd

type Cmd map[pixelgl.Button]func()

type HexKeypad

type HexKeypad [16]byte

type KeyHandler

type KeyHandler interface {
	ExecuteInputs()
}

func NewKeyHandler

func NewKeyHandler(window *pixelgl.Window, cmd *Cmd) KeyHandler

NewKeyHandler receives a Window to embed, and a map with keys to handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL