Cauldron2D.Wx.Keys (Cauldron2D.Wx v0.1.3)

Copy Markdown View Source

A game's keymap as a wx window reads it: Cauldron2D.Input key specs become wx key codes, and mouse buttons stay {:mouse, button} as Cauldron2D.Wx.Input takes them.

Cauldron2D.Wx.Keys.wx_keymap(%{left: [:a, :left], fire: [:" ", {:mouse, :left}]})
#=> %{?A => :left, 314 => :left, 32 => :fire, {:mouse, :left} => :fire}

A key with no wx code is left out.

Summary

Functions

The wx key code for a key spec, {:mouse, button} for a button, or nil when it has none.

Functions

code(key)

@spec code(Cauldron2D.Input.key_spec()) :: integer() | {:mouse, atom()} | nil

The wx key code for a key spec, {:mouse, button} for a button, or nil when it has none.

wx_keymap(keymap)

@spec wx_keymap(Cauldron2D.Input.keymap()) :: map()

A keymap as Cauldron2D.Wx.Input.new/2 takes it.