render

package
v0.0.0-...-59476ba Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentRender

type AgentRender struct {
	Type    string `json:"agent-type"`
	Pos2D   `json:"position"`
	Heading float64       `json:"heading"`
	Colour  colour.RGB256 `json:"colour"`
}

AgentRender holds the minimum required data for the data visualisation of an individual agent

func (*AgentRender) MarshalJSON

func (mj *AgentRender) MarshalJSON() ([]byte, error)

func (*AgentRender) MarshalJSONBuf

func (mj *AgentRender) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*AgentRender) TranslateToViewport

func (ar *AgentRender) TranslateToViewport(v Viewport, dw float64, dh float64)

TranslateToViewport takes the absolute model coordinates of the agent's position data and translates (and scales) them to the pixel coordinates of the Viewport v.

func (*AgentRender) UnmarshalJSON

func (uj *AgentRender) UnmarshalJSON(input []byte) error

func (*AgentRender) UnmarshalJSONFFLexer

func (uj *AgentRender) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type DrawList

type DrawList struct {
	CPP       []AgentRender `json:"cpPrey"`
	VP        []AgentRender `json:"vp"`
	BG        colour.RGB256 `json:"bg"`
	CpPreyPop string        `json:"cpPrey-pop-string"` // this and the next three entries to be displayed in a little box
	VpPop     string        `json:"vp-pop-string"`
	TurnCount string        `json:"turncount-string"`
}

DrawList contains the draw instructions for front-end JS gfx API

func (*DrawList) MarshalJSON

func (mj *DrawList) MarshalJSON() ([]byte, error)

func (*DrawList) MarshalJSONBuf

func (mj *DrawList) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*DrawList) UnmarshalJSON

func (uj *DrawList) UnmarshalJSON(input []byte) error

func (*DrawList) UnmarshalJSONFFLexer

func (uj *DrawList) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Pos2D

type Pos2D struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Pos2D is the pixel 2D projection from vector position.

func (*Pos2D) MarshalJSON

func (mj *Pos2D) MarshalJSON() ([]byte, error)

func (*Pos2D) MarshalJSONBuf

func (mj *Pos2D) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Pos2D) UnmarshalJSON

func (uj *Pos2D) UnmarshalJSON(input []byte) error

func (*Pos2D) UnmarshalJSONFFLexer

func (uj *Pos2D) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Viewport

type Viewport struct {
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
}

Viewport holds the resolution / scale of the front-end JS gfx

func (*Viewport) MarshalJSON

func (mj *Viewport) MarshalJSON() ([]byte, error)

func (*Viewport) MarshalJSONBuf

func (mj *Viewport) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Viewport) UnmarshalJSON

func (uj *Viewport) UnmarshalJSON(input []byte) error

func (*Viewport) UnmarshalJSONFFLexer

func (uj *Viewport) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

Jump to

Keyboard shortcuts

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