preset

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CarComponentID       = ecs.NewComponentTypeID()
	CarKeyboardControlID = ecs.NewComponentTypeID()
	CarMouseControlID    = ecs.NewComponentTypeID()
	CarGamepadControlID  = ecs.NewComponentTypeID()
)
View Source
var (
	NodeComponentID           = ecs.NewComponentTypeID()
	ControlledComponentID     = ecs.NewComponentTypeID()
	YawPitchCameraComponentID = ecs.NewComponentTypeID()
	FollowCameraComponentID   = ecs.NewComponentTypeID()
)

Functions

This section is empty.

Types

type Axis

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

func (*Axis) LeftHub

func (a *Axis) LeftHub() *Hub

func (*Axis) LeftWheel

func (a *Axis) LeftWheel() *Wheel

func (*Axis) MaxAcceleration

func (a *Axis) MaxAcceleration() float64

func (*Axis) MaxBraking

func (a *Axis) MaxBraking() float64

func (*Axis) MaxSteeringAngle

func (a *Axis) MaxSteeringAngle() dprec.Angle

func (*Axis) ReverseRatio

func (a *Axis) ReverseRatio() float64

func (*Axis) RightHub

func (a *Axis) RightHub() *Hub

func (*Axis) RightWheel

func (a *Axis) RightWheel() *Wheel

type AxisDefinition

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

func NewAxisDefinition

func NewAxisDefinition() *AxisDefinition

func (*AxisDefinition) WithLeftHubDefinition

func (d *AxisDefinition) WithLeftHubDefinition(def *HubDefinition) *AxisDefinition

func (*AxisDefinition) WithLeftWheelDefinition

func (d *AxisDefinition) WithLeftWheelDefinition(def *WheelDefinition) *AxisDefinition

func (*AxisDefinition) WithMaxAcceleration

func (d *AxisDefinition) WithMaxAcceleration(maxAcceleration float64) *AxisDefinition

func (*AxisDefinition) WithMaxBraking

func (d *AxisDefinition) WithMaxBraking(maxBraking float64) *AxisDefinition

func (*AxisDefinition) WithMaxSteeringAngle

func (d *AxisDefinition) WithMaxSteeringAngle(maxAngle dprec.Angle) *AxisDefinition

func (*AxisDefinition) WithPosition

func (d *AxisDefinition) WithPosition(position dprec.Vec3) *AxisDefinition

func (*AxisDefinition) WithReverseRatio

func (d *AxisDefinition) WithReverseRatio(ratio float64) *AxisDefinition

func (*AxisDefinition) WithRightHubDefinition

func (d *AxisDefinition) WithRightHubDefinition(def *HubDefinition) *AxisDefinition

func (*AxisDefinition) WithRightWheelDefinition

func (d *AxisDefinition) WithRightWheelDefinition(def *WheelDefinition) *AxisDefinition

func (*AxisDefinition) WithSpringDamping

func (d *AxisDefinition) WithSpringDamping(damping float64) *AxisDefinition

func (*AxisDefinition) WithSpringFrequency

func (d *AxisDefinition) WithSpringFrequency(frequency float64) *AxisDefinition

func (*AxisDefinition) WithSpringLength

func (d *AxisDefinition) WithSpringLength(length float64) *AxisDefinition

func (*AxisDefinition) WithSuspensionLength

func (d *AxisDefinition) WithSuspensionLength(length float64) *AxisDefinition

func (*AxisDefinition) WithWidth

func (d *AxisDefinition) WithWidth(width float64) *AxisDefinition

type Car

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

func (*Car) Axes

func (c *Car) Axes() []*Axis

func (*Car) Chassis

func (c *Car) Chassis() *Chassis

func (*Car) Entity

func (c *Car) Entity() *ecs.Entity

func (*Car) Velocity

func (c *Car) Velocity() float64

type CarApplyInfo

type CarApplyInfo struct {
	Model    *game.Model
	Position dprec.Vec3
	Rotation dprec.Quat
}

type CarComponent

type CarComponent struct {
	Car            *Car
	Gear           CarGear
	SteeringAmount float64
	Acceleration   float64
	Deceleration   float64
	Recover        bool
	LightsOn       bool
}

func (*CarComponent) TypeID

func (*CarComponent) TypeID() ecs.ComponentTypeID

type CarDefinition

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

func NewCarDefinition

func NewCarDefinition() *CarDefinition

func (*CarDefinition) ApplyToModel

func (d *CarDefinition) ApplyToModel(scene *game.Scene, info CarApplyInfo) *Car

func (*CarDefinition) WithAxisDefinition

func (d *CarDefinition) WithAxisDefinition(def *AxisDefinition) *CarDefinition

func (*CarDefinition) WithChassisDefinition

func (d *CarDefinition) WithChassisDefinition(def *ChassisDefinition) *CarDefinition

type CarGamepadControl

type CarGamepadControl struct {
	Gamepad app.Gamepad
}

func (*CarGamepadControl) TypeID

type CarGear

type CarGear int
const (
	CarGearNeutral CarGear = iota
	CarGearForward
	CarGearReverse
)

type CarKeyboardControl

type CarKeyboardControl struct {
	AccelerateKey ui.KeyCode
	DecelerateKey ui.KeyCode
	TurnLeftKey   ui.KeyCode
	TurnRightKey  ui.KeyCode
	ShiftUpKey    ui.KeyCode
	ShiftDownKey  ui.KeyCode
	RecoverKey    ui.KeyCode

	AccelerationChangeSpeed float64
	DecelerationChangeSpeed float64
	SteeringAmount          float64
	SteeringChangeSpeed     float64
	SteeringRestoreSpeed    float64
}

func (*CarKeyboardControl) TypeID

type CarMouseControl

type CarMouseControl struct {
	AccelerationChangeSpeed float64
	DecelerationChangeSpeed float64
	Destination             dprec.Vec3
}

func (*CarMouseControl) TypeID

type CarSystem

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

func NewCarSystem

func NewCarSystem(ecsScene *ecs.Scene, gfxScene *graphics.Scene, gamepadProvider GamepadProvider) *CarSystem

func (*CarSystem) OnKeyboardEvent

func (s *CarSystem) OnKeyboardEvent(event ui.KeyboardEvent) bool

func (*CarSystem) OnMouseEvent

func (s *CarSystem) OnMouseEvent(element *ui.Element, event ui.MouseEvent) bool

func (*CarSystem) Update

func (s *CarSystem) Update(elapsedSeconds float64)

type Chassis

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

func (*Chassis) BeamLights

func (c *Chassis) BeamLights() []*graphics.SpotLight

func (*Chassis) Body

func (c *Chassis) Body() *physics.Body

func (*Chassis) HeadLights

func (c *Chassis) HeadLights() []*graphics.PointLight

func (*Chassis) Node

func (c *Chassis) Node() *game.Node

func (*Chassis) StopLights

func (c *Chassis) StopLights() []*graphics.PointLight

func (*Chassis) TailLights

func (c *Chassis) TailLights() []*graphics.PointLight

type ChassisDefinition

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

func NewChassisDefinition

func NewChassisDefinition() *ChassisDefinition

func (*ChassisDefinition) WithBeamLightNodeNames

func (d *ChassisDefinition) WithBeamLightNodeNames(names ...string) *ChassisDefinition

func (*ChassisDefinition) WithBodyDefinition

func (d *ChassisDefinition) WithBodyDefinition(def *physics.BodyDefinition) *ChassisDefinition

func (*ChassisDefinition) WithHeadLightNodeNames

func (d *ChassisDefinition) WithHeadLightNodeNames(names ...string) *ChassisDefinition

func (*ChassisDefinition) WithNodeName

func (d *ChassisDefinition) WithNodeName(name string) *ChassisDefinition

func (*ChassisDefinition) WithStopLightNodeNames

func (d *ChassisDefinition) WithStopLightNodeNames(names ...string) *ChassisDefinition

func (*ChassisDefinition) WithTailLightNodeNames

func (d *ChassisDefinition) WithTailLightNodeNames(names ...string) *ChassisDefinition

type ControlInput

type ControlInput int
const (
	ControlInputKeyboard ControlInput = 1 << iota
	ControlInputMouse
	ControlInputGamepad0
)

func (ControlInput) Is

func (i ControlInput) Is(query ControlInput) bool

type ControlledComponent

type ControlledComponent struct {
	Inputs ControlInput
}

func (*ControlledComponent) TypeID

type FollowCameraComponent

type FollowCameraComponent struct {
	Target         *game.Node
	AnchorPosition dprec.Vec3
	AnchorDistance float64
	CameraDistance float64
	PitchAngle     dprec.Angle
	YawAngle       dprec.Angle
	Zoom           float64
}

func (*FollowCameraComponent) TypeID

type FollowCameraSystem

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

func NewFollowCameraSystem

func NewFollowCameraSystem(ecsScene *ecs.Scene, gamepadProvider GamepadProvider) *FollowCameraSystem

func (*FollowCameraSystem) OnKeyboardEvent

func (s *FollowCameraSystem) OnKeyboardEvent(event ui.KeyboardEvent) bool

func (*FollowCameraSystem) Update

func (s *FollowCameraSystem) Update(elapsedSeconds float64)

func (*FollowCameraSystem) UseDefaults

func (s *FollowCameraSystem) UseDefaults()

type GamepadProvider

type GamepadProvider interface {
	Gamepads() [4]app.Gamepad
}

type Hub

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

func (*Hub) Body

func (h *Hub) Body() *physics.Body

func (*Hub) Node

func (h *Hub) Node() *game.Node

type HubDefinition

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

func NewHubDefinition

func NewHubDefinition() *HubDefinition

func (*HubDefinition) WithBodyDefinition

func (d *HubDefinition) WithBodyDefinition(def *physics.BodyDefinition) *HubDefinition

func (*HubDefinition) WithNodeName

func (d *HubDefinition) WithNodeName(name string) *HubDefinition

type NodeComponent

type NodeComponent struct {
	Node *game.Node
}

func (*NodeComponent) TypeID

func (*NodeComponent) TypeID() ecs.ComponentTypeID

type Wheel

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

func (*Wheel) AttachmentConstraint

func (w *Wheel) AttachmentConstraint() *physics.DBConstraint

func (*Wheel) Body

func (w *Wheel) Body() *physics.Body

func (*Wheel) DirectionSolver

func (w *Wheel) DirectionSolver() *constraint.MatchDirections

func (*Wheel) Node

func (w *Wheel) Node() *game.Node

func (*Wheel) Velocity

func (w *Wheel) Velocity() float64

type WheelDefinition

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

func NewWheelDefinition

func NewWheelDefinition() *WheelDefinition

func (*WheelDefinition) WithBodyDefinition

func (d *WheelDefinition) WithBodyDefinition(def *physics.BodyDefinition) *WheelDefinition

func (*WheelDefinition) WithNodeName

func (d *WheelDefinition) WithNodeName(name string) *WheelDefinition

type YawPitchCameraComponent

type YawPitchCameraComponent struct {
	YawAngle   dprec.Angle
	PitchAngle dprec.Angle
}

func (*YawPitchCameraComponent) TypeID

type YawPitchCameraSystem

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

func NewYawPitchCameraSystem

func NewYawPitchCameraSystem(ecsScene *ecs.Scene, gamepadProvider GamepadProvider) *YawPitchCameraSystem

func (*YawPitchCameraSystem) OnKeyboardEvent

func (s *YawPitchCameraSystem) OnKeyboardEvent(event ui.KeyboardEvent) bool

func (*YawPitchCameraSystem) Update

func (s *YawPitchCameraSystem) Update(elapsedSeconds float64)

func (*YawPitchCameraSystem) UseDefaults

func (s *YawPitchCameraSystem) UseDefaults()

Jump to

Keyboard shortcuts

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