Documentation ¶
Index ¶
- type AgentRender
- func (mj *AgentRender) MarshalJSON() ([]byte, error)
- func (mj *AgentRender) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (ar *AgentRender) TranslateToViewport(v Viewport, dw float64, dh float64)
- func (uj *AgentRender) UnmarshalJSON(input []byte) error
- func (uj *AgentRender) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- type DrawList
- type Pos2D
- type Viewport
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 (*DrawList) MarshalJSONBuf ¶
func (mj *DrawList) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*DrawList) UnmarshalJSON ¶
func (*DrawList) UnmarshalJSONFFLexer ¶
type Pos2D ¶
Pos2D is the pixel 2D projection from vector position.
func (*Pos2D) MarshalJSON ¶
func (*Pos2D) MarshalJSONBuf ¶
func (mj *Pos2D) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*Pos2D) UnmarshalJSON ¶
func (*Pos2D) UnmarshalJSONFFLexer ¶
type Viewport ¶
Viewport holds the resolution / scale of the front-end JS gfx
func (*Viewport) MarshalJSON ¶
func (*Viewport) MarshalJSONBuf ¶
func (mj *Viewport) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*Viewport) UnmarshalJSON ¶
func (*Viewport) UnmarshalJSONFFLexer ¶
Click to show internal directories.
Click to hide internal directories.