display

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CeilingShadow

func CeilingShadow(x, y int, properties *model.TileProperties, query TilePropertiesQuery) [4]graphics.Color

CeilingShadow returns the colors for the ceiling darkness.

func CeilingTexture

func CeilingTexture(properties *model.RealWorldTileProperties) (textureIndex int, textureRotations int)

CeilingTexture returns the information for the ceiling.

func FloorShadow

func FloorShadow(x, y int, properties *model.TileProperties, query TilePropertiesQuery) [4]graphics.Color

FloorShadow returns the colors for the floor darkness.

func FloorTexture

func FloorTexture(properties *model.RealWorldTileProperties) (textureIndex int, textureRotations int)

FloorTexture returns the information for the floor.

func WallTexture

func WallTexture(properties *model.RealWorldTileProperties) (textureIndex int, textureRotations int)

WallTexture returns the information for the wall.

Types

type Area

type Area interface {
	Center() (x, y float32)
	Size() (width, height float32)
}

Area describes a rectangular area with a center.

func NewSimpleArea

func NewSimpleArea(centerX, centerY float32, width, height float32) Area

NewSimpleArea returns an immutable area with given properties.

type BasicHighlighter

type BasicHighlighter struct {
	// contains filtered or unexported fields
}

BasicHighlighter draws a simple highlighting of a rectangular area.

func NewBasicHighlighter

func NewBasicHighlighter(context *graphics.RenderContext) *BasicHighlighter

NewBasicHighlighter returns a new instance of BasicHighlighter.

func (*BasicHighlighter) Dispose

func (highlighter *BasicHighlighter) Dispose()

Dispose releases all resources.

func (*BasicHighlighter) Render

func (highlighter *BasicHighlighter) Render(areas []Area, color graphics.Color)

Render renders the highlights.

type ColorQuery

type ColorQuery func(x, y int, properties *model.TileProperties, query TilePropertiesQuery) [4]graphics.Color

ColorQuery returns the 4 colors for the specified tile. Returned order: bottom-left, top-left, top-right, bottom-right.

type Context

type Context interface {
	ModelAdapter() *model.Adapter
	NewRenderContext(viewMatrix *mgl.Mat4) *graphics.RenderContext
	ForGraphics() graphics.Context
}

Context provides some global resources.

type GridRenderable

type GridRenderable struct {
	// contains filtered or unexported fields
}

GridRenderable renders a grid with transparent holes.

func NewGridRenderable

func NewGridRenderable(context *graphics.RenderContext) *GridRenderable

NewGridRenderable returns a new instance of GridRenderable.

func (*GridRenderable) Render

func (renderable *GridRenderable) Render()

Render renders

type MapDisplay

type MapDisplay struct {
	// contains filtered or unexported fields
}

MapDisplay is a display for a level map

func NewMapDisplay

func NewMapDisplay(context Context, parent *ui.Area, scale float32) *MapDisplay

NewMapDisplay returns a new instance.

func (*MapDisplay) ClearHighlightedTile

func (display *MapDisplay) ClearHighlightedTile()

ClearHighlightedTile requests to remove any tile highlight.

func (*MapDisplay) SetDisplayedObjects

func (display *MapDisplay) SetDisplayedObjects(objects []*model.LevelObject)

SetDisplayedObjects requests to show the given set of objects.

func (*MapDisplay) SetHighlightedObject

func (display *MapDisplay) SetHighlightedObject(object *model.LevelObject)

SetHighlightedObject registers an object that shall be highlighted.

func (*MapDisplay) SetHighlightedTile

func (display *MapDisplay) SetHighlightedTile(coord model.TileCoordinate)

SetHighlightedTile requests to highlight the identified tile.

func (*MapDisplay) SetSelectedObjects

func (display *MapDisplay) SetSelectedObjects(objects []*model.LevelObject)

SetSelectedObjects requests to show the given set of objects as selected.

func (*MapDisplay) SetSelectedTiles

func (display *MapDisplay) SetSelectedTiles(tiles []model.TileCoordinate)

SetSelectedTiles requests to show the given set of tiles as selected.

func (*MapDisplay) SetTextureIndexQuery

func (display *MapDisplay) SetTextureIndexQuery(query TextureIndexQuery)

SetTextureIndexQuery sets which texture shall be shown.

func (*MapDisplay) SetTileColoring

func (display *MapDisplay) SetTileColoring(colorQuery ColorQuery)

SetTileColoring sets the query function for coloring tiles.

func (*MapDisplay) SetVisible

func (display *MapDisplay) SetVisible(visible bool)

SetVisible sets the display visibility state.

func (*MapDisplay) WorldCoordinatesForPixel

func (display *MapDisplay) WorldCoordinatesForPixel(pixelX, pixelY float32) (x, y float32)

WorldCoordinatesForPixel returns the world coordinates at the given pixel position.

type PlacedIcon

type PlacedIcon interface {
	Center() (x, y float32)
	Texture() *graphics.BitmapTexture
}

PlacedIcon is an icon bitmap with a location.

type PlacedIconsRenderable

type PlacedIconsRenderable struct {
	// contains filtered or unexported fields
}

PlacedIconsRenderable is a renderable for simple bitmaps.

func NewPlacedIconsRenderable

func NewPlacedIconsRenderable(context *graphics.RenderContext, paletteTexture graphics.Texture) *PlacedIconsRenderable

NewPlacedIconsRenderable returns a new instance of a simple bitmap renderable

func (*PlacedIconsRenderable) Render

func (renderable *PlacedIconsRenderable) Render(icons []PlacedIcon)

Render renders the icons with their center at given position

type TextureIndexQuery

type TextureIndexQuery func(properties *model.RealWorldTileProperties) (textureIndex int, textureRotations int)

TextureIndexQuery is a getter function to retrieve the texture index and rotations from given tile properties.

type TextureQuery

type TextureQuery func(index int) *graphics.BitmapTexture

TextureQuery is a getter function to retrieve the texture for the given level texture index.

type TileColorMapRenderable

type TileColorMapRenderable struct {
	// contains filtered or unexported fields
}

TileColorMapRenderable is a renderable for the tile colorings.

func NewTileColorMapRenderable

func NewTileColorMapRenderable(context *graphics.RenderContext) *TileColorMapRenderable

NewTileColorMapRenderable returns a new instance of a renderable for tile colorings.

func (*TileColorMapRenderable) Clear

func (renderable *TileColorMapRenderable) Clear()

Clear resets all tiles.

func (*TileColorMapRenderable) Dispose

func (renderable *TileColorMapRenderable) Dispose()

Dispose releases any internal resources

func (*TileColorMapRenderable) Render

func (renderable *TileColorMapRenderable) Render()

Render renders

func (*TileColorMapRenderable) SetColorQuery

func (renderable *TileColorMapRenderable) SetColorQuery(colorQuery ColorQuery)

SetColorQuery sets the query function for the coloring. nil disables coloring.

func (*TileColorMapRenderable) SetTile

func (renderable *TileColorMapRenderable) SetTile(x, y int, properties *model.TileProperties)

SetTile sets the properties for the specified tile coordinate.

type TileGridMapRenderable

type TileGridMapRenderable struct {
	// contains filtered or unexported fields
}

TileGridMapRenderable is a renderable for the tile grid.

func NewTileGridMapRenderable

func NewTileGridMapRenderable(context *graphics.RenderContext) *TileGridMapRenderable

NewTileGridMapRenderable returns a new instance of a renderable for tile grids.

func (*TileGridMapRenderable) Clear

func (renderable *TileGridMapRenderable) Clear()

Clear resets all tiles.

func (*TileGridMapRenderable) Dispose

func (renderable *TileGridMapRenderable) Dispose()

Dispose releases any internal resources

func (*TileGridMapRenderable) Render

func (renderable *TileGridMapRenderable) Render()

Render renders

func (*TileGridMapRenderable) SetTile

func (renderable *TileGridMapRenderable) SetTile(x, y int, properties *model.TileProperties)

SetTile sets the properties for the specified tile coordinate.

type TilePropertiesQuery

type TilePropertiesQuery func(x, y int) *model.TileProperties

TilePropertiesQuery is a function to return the properties of requested tile, or nil if not available.

type TileSlopeMapRenderable

type TileSlopeMapRenderable struct {
	// contains filtered or unexported fields
}

TileSlopeMapRenderable is a renderable for the tile slopes.

func NewTileSlopeMapRenderable

func NewTileSlopeMapRenderable(context *graphics.RenderContext) *TileSlopeMapRenderable

NewTileSlopeMapRenderable returns a new instance of a renderable for tile slopes.

func (*TileSlopeMapRenderable) Clear

func (renderable *TileSlopeMapRenderable) Clear()

Clear resets all tiles.

func (*TileSlopeMapRenderable) Dispose

func (renderable *TileSlopeMapRenderable) Dispose()

Dispose releases any internal resources

func (*TileSlopeMapRenderable) Render

func (renderable *TileSlopeMapRenderable) Render()

Render renders

func (*TileSlopeMapRenderable) SetTile

func (renderable *TileSlopeMapRenderable) SetTile(x, y int, properties *model.TileProperties)

SetTile sets the properties for the specified tile coordinate.

type TileTextureMapRenderable

type TileTextureMapRenderable struct {
	// contains filtered or unexported fields
}

TileTextureMapRenderable is a renderable for textures.

func NewTileTextureMapRenderable

func NewTileTextureMapRenderable(context *graphics.RenderContext, paletteTexture graphics.Texture,
	textureQuery TextureQuery) *TileTextureMapRenderable

NewTileTextureMapRenderable returns a new instance of a renderable for tile map textures.

func (*TileTextureMapRenderable) Clear

func (renderable *TileTextureMapRenderable) Clear()

Clear resets all tiles.

func (*TileTextureMapRenderable) Dispose

func (renderable *TileTextureMapRenderable) Dispose()

Dispose releases any internal resources

func (*TileTextureMapRenderable) Render

func (renderable *TileTextureMapRenderable) Render()

Render renders

func (*TileTextureMapRenderable) SetTextureIndexQuery

func (renderable *TileTextureMapRenderable) SetTextureIndexQuery(query TextureIndexQuery)

SetTextureIndexQuery sets which texture shall be shown.

func (*TileTextureMapRenderable) SetTile

func (renderable *TileTextureMapRenderable) SetTile(x, y int, properties *model.TileProperties)

SetTile sets the properties for the specified tile coordinate.

Jump to

Keyboard shortcuts

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