radar

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

README

radar

The radar component displays points of interest at a customizable scaled down ratio, for things like displaying points of interest on a minimap.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	X, Y *float64
}

Point is a utility function for location

type Radar

type Radar struct {
	render.LayeredPoint

	sync.Mutex
	// contains filtered or unexported fields
}

Radar displays points of interest on a radar map

func NewRadar

func NewRadar(w, h int, points map[Point]color.Color, center Point, ratio float64) *Radar

NewRadar creates a radar that will display at 0,0 with the given dimensions. The points given will be displayed on the radar relative to the center point, With the absolute distance reduced by the given ratio

func (*Radar) AddPoint

func (r *Radar) AddPoint(loc Point, c color.Color)

AddPoint adds an additional point to the radar to be tracked

func (*Radar) AddTrackedPoint

func (r *Radar) AddTrackedPoint(loc Point, id int, c color.Color)

AddTrackedPoint to the radar. Enables display and later lookup by id (usually the CID of the caller).

func (*Radar) Draw

func (r *Radar) Draw(buff draw.Image, xOff, yOff float64)

Draw draws the radar at a given offset

func (*Radar) GetRGBA

func (r *Radar) GetRGBA() *image.RGBA

GetRGBA returns this radar's image

func (*Radar) LookupPoint

func (r *Radar) LookupPoint(id int) (*Point, bool)

LookupPoint by the provided id. This only works if the point was tracked on creation.

func (*Radar) RemovePointByLookup

func (r *Radar) RemovePointByLookup(id int) error

RemovePointByLookup removes a point if it is present. If it is not, it does nothing.

func (*Radar) SetOutline

func (r *Radar) SetOutline(outline *render.Sprite)

SetOutline of the radar to be the provided outline

func (*Radar) SetPos

func (r *Radar) SetPos(x, y float64)

SetPos sets the position of the radar on the screen

Jump to

Keyboard shortcuts

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