Documentation ¶
Overview ¶
Package binding implements simple B system on top of window input methods
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type S ¶
type S []state
S is collection of bindings, advantage over using just window is that you can send input over network easily and keep inputstate for each player. The way you should set up an inputstate is as follows:
const ( Forward binding.B = iota Right Left Backwards ) var Bindings = binging.New(key.W, key.D, key.A, key.S) // its a slice and you index into it with constants
Then each frame you can call Bindings.Update(win), though better approach is to Clone then and store with player for example. You can now create bindings with any key combination and listen to them with same constants. Other advantage is that you can Write and read bindings to netw.Buffer so stransporting input is lot easier.
func (S) JustPressed ¶
Pressed returns whether binding was pressed in this frame
panics at sam cases as State
func (S) JustReleased ¶
Pressed returns whether binding was released in this frame
panics at sam cases as State
func (S) State ¶
State returns state of binding
panics if bid is indexing out of bounds, for example you registered les keys then there is iota constants