Documentation ¶
Index ¶
- Constants
- func AddCommands()
- func InitScene(prevScene string, data interface{})
- func LoopScene() bool
- func PolygonFromFace(f *dcel.Face) *render.Polygon
- type Button
- type DynamicTicker
- type InteractivePoint
- type InteractivePolyhedron
- type Polyhedron
- func (p *Polyhedron) RotX(theta float64)
- func (p *Polyhedron) RotY(theta float64)
- func (p *Polyhedron) RotZ(theta float64)
- func (p *Polyhedron) Scale(factor float64)
- func (p *Polyhedron) ShiftX(x float64)
- func (p *Polyhedron) ShiftY(y float64)
- func (p *Polyhedron) String() string
- func (p *Polyhedron) Update()
- type Slider
Constants ¶
const ( ROTATE mouseMode = iota MOVE_POINT POINT_LOCATE ADD_DCEL LAST_MODE ADDING_DCEL LOCATING )
control mode constant
const ( SLAB_DECOMPOSITION = iota TRAPEZOID_MAP PLUMB_LINE LAST_PL_MODE KIRKPATRICK_MONOTONE KIRKPATRICK_TRAPEZOID )
Point Location Mode Const
Variables ¶
This section is empty.
Functions ¶
func AddCommands ¶
func AddCommands()
AddCommands opens up some command line functions to the application.
func InitScene ¶
func InitScene(prevScene string, data interface{})
InitScene is called whenever the scene 'demo' starts. it creates the objects in our application.
Types ¶
type Button ¶
type Button struct { entities.Solid Text *render.Text TxtX, TxtY float64 Font *render.Font Layer int }
A Button is a UI element that has transient background, overlayed text, collision space, and binds to mouse events.
func NewButton ¶
NewButton returns a new button rendering with a given font, bound to a given bindable function on being clicked.
func (*Button) SetSpace ¶
SetSpace overwrites entities.Solid, pointing this button to use the mouse collision Rtree instead of the entity collision space.
type DynamicTicker ¶
type DynamicTicker struct {
// contains filtered or unexported fields
}
A DynamicTicker is a ticker which can be sent signals in the form of durations to change how often it ticks.
func NewDynamicTicker ¶
func NewDynamicTicker() *DynamicTicker
NewDynamicTicker returns a null-initialized dynamic ticker
func (*DynamicTicker) SetTick ¶
func (dt *DynamicTicker) SetTick(d time.Duration)
SetTick changes the rate at which a dynamic ticker ticks
func (*DynamicTicker) Step ¶
func (dt *DynamicTicker) Step()
Step will force the dynamic ticker to tick, once. If the forced tick is not received, multiple calls to step will do nothing.
type InteractivePoint ¶
InteractivePoint is a struct to wrap around dcel points and extend them to be bindable and have collision space.
func NewInteractivePoint ¶
func NewInteractivePoint(v *dcel.Vertex, i int) *InteractivePoint
NewInteractivePoint creates a new ip given a dcel point to base it off of.
func (*InteractivePoint) Init ¶
func (ip *InteractivePoint) Init() event.CID
Init allows ip to satisfy the event.Entity interface, so it may be stored with other entities in a global list managed by oak.
type InteractivePolyhedron ¶
type InteractivePolyhedron struct { *Polyhedron // contains filtered or unexported fields }
An InteractivePolyhedron is a wrapper around an oak polyhedron which defines mouse collision areas to interact with parts of the underlying DCEL structure.
func (*InteractivePolyhedron) Init ¶
func (ip *InteractivePolyhedron) Init() event.CID
Init establishes ip's non-polyhedron variables.
func (*InteractivePolyhedron) UpdateSpaces ¶
func (ip *InteractivePolyhedron) UpdateSpaces()
UpdateSpaces is a helper function to polyhedron's Update which similarly resets parts of the ip as it is moved through space. In this case the large job here is making sure all of the vertex collision areas stay in the right spots.
type Polyhedron ¶
type Polyhedron struct { *render.Sprite dcel.DCEL FaceColors []color.Color EdgeColors []color.Color Center physics.Vector }
Polyhedron is a type which extends render.Renderable, allowing it to be drawn to screen through oak's drawing functionality. Polyhedron specifically draws a DCEL, given some defined colors for the DCEL's faces and Edges. Vertices are given a generic color because they are barely visibile anyway with our drawing scheme. Polyhedrons are not drawn in a very sophisticated manner.
func NewPolyhedronFromDCEL ¶
func NewPolyhedronFromDCEL(dc *dcel.DCEL, x, y float64) *Polyhedron
NewPolyhedronFromDCEL creates a polyhedron from a dcel and an initial screen position
func (*Polyhedron) RotX ¶
func (p *Polyhedron) RotX(theta float64)
RotX rotates the polyhedron around the X axis
func (*Polyhedron) RotY ¶
func (p *Polyhedron) RotY(theta float64)
RotY rotates the polyhedron around the Y axis
func (*Polyhedron) RotZ ¶
func (p *Polyhedron) RotZ(theta float64)
RotZ rotates the polyhedron around the Z axis
func (*Polyhedron) Scale ¶
func (p *Polyhedron) Scale(factor float64)
Scale scales up or down the given polyhedron
func (*Polyhedron) ShiftX ¶
func (p *Polyhedron) ShiftX(x float64)
ShiftX moves a polyhedron and its center along the x axis
func (*Polyhedron) ShiftY ¶
func (p *Polyhedron) ShiftY(y float64)
ShiftY moves a polyhedron and its center along the y axis
func (*Polyhedron) Update ¶
func (p *Polyhedron) Update()
Update keeps a polyhedron's drawn elements consistent with changes in the underlying DCEL.
type Slider ¶
type Slider struct { *Button // contains filtered or unexported fields }
Slider is a little UI element with a movable slider representing a range. It has a specific purpose of setting visualization delay, but eventually it might be expanded to a more generalized structure.
func NewSlider ¶
NewSlider returns a slider with initialized values using the given font to render its text.
func (*Slider) Init ¶
Init returns a CID for the Slider.
Note on engine internals: All entities as defined by the engine need to have this function defined on them. this is because an entity is only a meaningful concept in terms of the engine for an entity's ability to have events bound to it and triggered on it, which this CID (caller ID) represents.
Its literal meaning is, in our event bus, the value passed into NextID (which is the only way to get a legitimate CID), is stored at the array index of the returned CID.