shapes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 6

Documentation

Overview

Package shapes contains various drawable shapes

Index

Constants

This section is empty.

Variables

View Source
var Get = gets{

	Box: func(e *goecs.Entity) Box {
		return e.Get(TYPE.Box).(Box)
	},

	SolidBox: func(e *goecs.Entity) SolidBox {
		return e.Get(TYPE.SolidBox).(SolidBox)
	},

	Line: func(e *goecs.Entity) Line {
		return e.Get(TYPE.Line).(Line)
	},
}

Get a geometry component

TYPE hold the goecs.ComponentType for our shapes components

Functions

This section is empty.

Types

type Box

type Box struct {
	Size      geometry.Size // The box size
	Scale     float32       // The box scale
	Thickness int32         // Thickness of the line
}

Box is a rectangular outline that we could draw in a geometry.Point with a color.Solid

func (Box) Contains

func (b Box) Contains(at geometry.Point, point geometry.Point) bool

Contains return if a box at a geometry.Point contains a point

func (Box) GetReactAt added in v0.1.13

func (b Box) GetReactAt(at geometry.Point) geometry.Rect

GetReactAt return return a geometry.Rect at a given point

func (Box) Type added in v0.3.0

func (b Box) Type() goecs.ComponentType

Type return this goecs.ComponentType

type Line added in v0.1.6

type Line struct {
	To        geometry.Point // To where the line goes
	Thickness float32        // Thickness of the line
}

Line is a component that represent a line

func (Line) Type added in v0.3.0

func (l Line) Type() goecs.ComponentType

Type return this goecs.ComponentType

type SolidBox added in v0.1.8

type SolidBox struct {
	Size  geometry.Size // The box size
	Scale float32       // The box scale
}

SolidBox is a rectangular shape that we could draw in a geometry.Point with a color.Solid or color.Gradient

func (SolidBox) Contains added in v0.1.8

func (b SolidBox) Contains(at geometry.Point, point geometry.Point) bool

Contains return if a box at a geometry.Point contains a point

func (SolidBox) Type added in v0.3.0

func (b SolidBox) Type() goecs.ComponentType

Type return this goecs.ComponentType

Jump to

Keyboard shortcuts

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