input

package module
v0.0.0-...-a1d9a0b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 2 Imported by: 2

README

ebiten-input

Map keys to actions in ebiten

Usage

import input "github.com/tducasse/ebiten-input"

keys := map[string][]ebiten.Key{
    "up":    {ebiten.KeyArrowUp, ebiten.KeyW},
    "down":  {ebiten.KeyArrowDown, ebiten.KeyS},
    "right": {ebiten.KeyArrowRight, ebiten.KeyD},
    "left":  {ebiten.KeyArrowLeft, ebiten.KeyA},
  }
input.Init(keys)

// add actions later with
input.AddAction("action", []ebiten.Key{ebiten.KeySpace})

// check the status with 
if input.IsPressed("up") {
  // do something here
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Input map[string][]ebiten.Key

Functions

func AddAction

func AddAction(action string, keys []ebiten.Key)

func Init

func Init(keys map[string][]ebiten.Key)

func IsPressed

func IsPressed(action string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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