examples/2048/2048/input.go
func (i *Input) Dir() (Dir, bool) {
	if inpututil.IsKeyJustPressed(ebiten.KeyUp) {
		return DirUp, true
	}
	if inpututil.IsKeyJustPressed(ebiten.KeyLeft) {
		return DirLeft, true
	}
	if inpututil.IsKeyJustPressed(ebiten.KeyRight) {
		return DirRight, true
	}
	if inpututil.IsKeyJustPressed(ebiten.KeyDown) {
		return DirDown, true
	}
	if i.mouseState == mouseStateSettled {
		return i.mouseDir, true
	}
	if i.touchState == touchStateSettled {
		return i.touchDir, true
	}
	return 0, false
}
func (i *Input) Dir() (Dir, bool) {
	if inpututil.IsKeyJustPressed(ebiten.KeyUp) {
		return DirUp, true
	}
	if inpututil.IsKeyJustPressed(ebiten.KeyLeft) {
		return DirLeft, true
	}
	if inpututil.IsKeyJustPressed(ebiten.KeyRight) {
		return DirRight, true
	}
	if inpututil.IsKeyJustPressed(ebiten.KeyDown) {
		return DirDown, true
	}
	if i.mouseState == mouseStateSettled {
		return i.mouseDir, true
	}
	if i.touchState == touchStateSettled {
		return i.touchDir, true
	}
	return 0, false
}
func ( i * Input ) Dir ( ) ( Dir , bool ) { if inpututil . IsKeyJustPressed ( ebiten . KeyUp ) { return DirUp , true } if inpututil . IsKeyJustPressed ( ebiten . KeyLeft ) { return DirLeft , true } if inpututil . IsKeyJustPressed ( ebiten . KeyRight ) { return DirRight , true } if inpututil . IsKeyJustPressed ( ebiten . KeyDown ) { return DirDown , true } if i . mouseState == mouseStateSettled { return i . mouseDir , true } if i . touchState == touchStateSettled { return i . touchDir , true } return 0 , false }
// Dir returns a currently pressed direction.
// Dir returns false if no direction key is pressed.
Dir returns a currently pressed direction . Dir returns false if no direction key is pressed .