tank

package
v0.0.0-...-00071d3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color uint8
const (
	Green Color = iota
	Blue
	Red
	Sand
)

func (Color) BarrelTextureClip

func (c Color) BarrelTextureClip(atlas *sdlkit.TextureAtlas) (sdlkit.TextureClip, error)

func (Color) BodyTextureClip

func (c Color) BodyTextureClip(atlas *sdlkit.TextureAtlas) (sdlkit.TextureClip, error)

type Control

type Control interface {
	Input() UserInput
}

type ControllerAxisEventHandler

type ControllerAxisEventHandler interface {
	HandleControllerAxisEvent(*sdl.ControllerAxisEvent) error
}

type ControllerButtonDownEventHandler

type ControllerButtonDownEventHandler interface {
	HandleControllerButtonDownEvent(*sdl.ControllerButtonEvent) error
}

type ControllerButtonEventHandler

type ControllerButtonEventHandler interface {
	HandleControllerButtonEvent(*sdl.ControllerButtonEvent) error
}

type ControllerButtonUpEventHandler

type ControllerButtonUpEventHandler interface {
	HandleControllerButtonUpEvent(*sdl.ControllerButtonEvent) error
}

type ControllerDeviceAddedEventHandler

type ControllerDeviceAddedEventHandler interface {
	HandleControllerDeviceAddedEvent(*sdl.ControllerDeviceEvent) error
}

type ControllerDeviceEventHandler

type ControllerDeviceEventHandler interface {
	HandleControllerDeviceEvent(*sdl.ControllerDeviceEvent) error
}

type ControllerDeviceMappedEventHandler

type ControllerDeviceMappedEventHandler interface {
	HandleControllerDeviceMappedEvent(*sdl.ControllerDeviceEvent) error
}

type ControllerDeviceRemovedEventHandler

type ControllerDeviceRemovedEventHandler interface {
	HandleControllerDeviceRemovedEvent(*sdl.ControllerDeviceEvent) error
}

type GameController

type GameController struct {
	Device *sdl.GameController
	// contains filtered or unexported fields
}

func (*GameController) Input

func (gc *GameController) Input() UserInput

type KeyboardMouse

type KeyboardMouse struct {
	// contains filtered or unexported fields
}

func (*KeyboardMouse) HandleKeyboardEvent

func (kc *KeyboardMouse) HandleKeyboardEvent(e *sdl.KeyboardEvent) error

func (*KeyboardMouse) Input

func (kc *KeyboardMouse) Input() UserInput

type Tank

type Tank struct {
	Turret

	Control
	// contains filtered or unexported fields
}

http://engineeringdotnet.blogspot.com/2010/04/simple-2d-car-physics-in-games.html

func NewPlayer

func NewPlayer(atlas *sdlkit.TextureAtlas, color Color, control Control) *Tank

func (*Tank) Color

func (tnk *Tank) Color() Color

func (*Tank) Draw

func (tnk *Tank) Draw(canvas *sdlkit.Canvas)

func (*Tank) GetX

func (tnk *Tank) GetX() float64

func (*Tank) GetY

func (tnk *Tank) GetY() float64

func (*Tank) Heading

func (tnk *Tank) Heading() float64

func (*Tank) RegisterEvents

func (tnk *Tank) RegisterEvents(em *event.Manager)

func (*Tank) SetHeading

func (tnk *Tank) SetHeading(heading float64)

func (*Tank) SetTurretRotation

func (tnk *Tank) SetTurretRotation(radians float64)

func (*Tank) SetX

func (tnk *Tank) SetX(x float64)

func (*Tank) SetY

func (tnk *Tank) SetY(y float64)

func (*Tank) TurretPosition

func (tnk *Tank) TurretPosition() *geom.Vector

TurretPosition is the absolute center point of the turret's dome on top of the Tank.

func (*Tank) Update

func (tnk *Tank) Update(dt float64)

type Turret

type Turret struct {
	// contains filtered or unexported fields
}

func NewTurretSmall

func NewTurretSmall(atlas *sdlkit.TextureAtlas, tank *Tank) Turret

func (*Turret) Prerender

func (tur *Turret) Prerender(canvas *sdlkit.Canvas) error

type UserInput

type UserInput struct {
	Forwards,
	Backwards,
	SteerLeft,
	SteerRight,
	Brake float64
}

Jump to

Keyboard shortcuts

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