levels

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HighlighterFragmentShaderSource = `
#version 150
precision mediump float;

uniform vec4 inColor;
out vec4 fragColor;

void main(void) {
	fragColor = inColor;
}
`
View Source
var HighlighterVertexShaderSource = `` /* 256-byte string literal not displayed */

Functions

func CeilingTexture

func CeilingTexture(tile *level.TileMapEntry) (atlasIndex int, textureRotations int)

CeilingTexture returns the properties for the ceiling.

func FloorTexture

func FloorTexture(tile *level.TileMapEntry) (atlasIndex int, textureRotations int)

FloorTexture returns the properties for the floor.

func WallTexture

func WallTexture(tile *level.TileMapEntry) (atlasIndex int, textureRotations int)

WallTexture returns the properties for the floor.

Types

type BackgroundGrid

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

BackgroundGrid renders a grid with transparent holes.

func NewBackgroundGrid

func NewBackgroundGrid(context *render.Context) *BackgroundGrid

NewBackgroundGrid returns a new instance of BackgroundGrid.

func (*BackgroundGrid) Render

func (grid *BackgroundGrid) Render()

Render renders

type ColorDisplay

type ColorDisplay int

ColorDisplay is an enumeration to how a tile should be colored.

const (
	ColorDisplayNone    ColorDisplay = 0
	ColorDisplayFloor   ColorDisplay = 1
	ColorDisplayCeiling ColorDisplay = 2
)

ColorDisplay constants

func ColorDisplays

func ColorDisplays() []ColorDisplay

ColorDisplays returns all ColorDisplay constants.

func (ColorDisplay) String

func (display ColorDisplay) String() string

String returns a textual representation.

type ColorQuery

type ColorQuery func(x, y int) [4]float32

ColorQuery returns the color for the specified tile.

type ControlView

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

ControlView is the core view for level editing.

func NewControlView

func NewControlView(mod *model.Mod, guiScale float32, textCache *text.Cache, textureCache *graphics.TextureCache,
	commander cmd.Commander, eventListener event.Listener, eventRegistry event.Registry) *ControlView

NewControlView returns a new instance.

func (*ControlView) Render

func (view *ControlView) Render(lvl *level.Level)

Render renders the view.

func (*ControlView) SelectedLevel

func (view *ControlView) SelectedLevel() int

SelectedLevel returns the currently selected level.

func (*ControlView) WindowOpen

func (view *ControlView) WindowOpen() *bool

WindowOpen returns the flag address, to be used with the main menu.

type Highlighter

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

Highlighter draws a simple highlighting of a rectangular area.

func NewHighlighter

func NewHighlighter(context *render.Context) *Highlighter

NewHighlighter returns a new instance of Highlighter.

func (*Highlighter) Dispose

func (highlighter *Highlighter) Dispose()

Dispose releases all resources.

func (*Highlighter) Render

func (highlighter *Highlighter) Render(positions []MapPosition, sideLength float32, color [4]float32)

Render renders the highlights.

type LevelSelectionSetEvent

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

LevelSelectionSetEvent notifies about the currently selected level.

type LimitedCamera

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

LimitedCamera is a camera implementation with ranged controls for zooming and moving.

func NewLimitedCamera

func NewLimitedCamera(minZoom, maxZoom float32, minPos, maxPos float32) *LimitedCamera

NewLimitedCamera returns a new instance of a LimitedCamera.

func (*LimitedCamera) MoveBy

func (cam *LimitedCamera) MoveBy(dx, dy float32)

MoveBy adjusts the requested view offset by given delta values in world coordinates.

func (*LimitedCamera) MoveTo

func (cam *LimitedCamera) MoveTo(worldX, worldY float32)

MoveTo sets the requested view offset to the given world coordinates.

func (*LimitedCamera) SetViewportSize

func (cam *LimitedCamera) SetViewportSize(width, height float32)

SetViewportSize notifies the camera how big the view is.

func (*LimitedCamera) ViewMatrix

func (cam *LimitedCamera) ViewMatrix() *mgl.Mat4

ViewMatrix implements the Viewer interface.

func (*LimitedCamera) ZoomAt

func (cam *LimitedCamera) ZoomAt(levelDelta float32, x, y float32)

ZoomAt adjusts the requested zoom level by given delta, centered around given world position. Positive values zoom in.

type MapColors

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

MapColors is a renderable for the tile colorings.

func NewMapColors

func NewMapColors(context *render.Context) *MapColors

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

func (*MapColors) Dispose

func (renderable *MapColors) Dispose()

Dispose releases any internal resources

func (*MapColors) Render

func (renderable *MapColors) Render(columnCount, rowCount int, query ColorQuery)

Render renders

type MapDisplay

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

MapDisplay renders a level map.

func NewMapDisplay

func NewMapDisplay(gl opengl.OpenGL, guiScale float32,
	textureQuery TextureQuery,
	eventListener event.Listener, eventRegistry event.Registry) *MapDisplay

NewMapDisplay returns a new instance.

func (*MapDisplay) MouseButtonDown

func (display *MapDisplay) MouseButtonDown(mouseX, mouseY float32, button uint32)

MouseButtonDown must be called when a button was pressed.

func (*MapDisplay) MouseButtonUp

func (display *MapDisplay) MouseButtonUp(mouseX, mouseY float32, button uint32, modifier input.Modifier)

MouseButtonUp must be called when a button was released.

func (*MapDisplay) MouseMoved

func (display *MapDisplay) MouseMoved(mouseX, mouseY float32)

MouseMoved must be called for a mouse move.

func (*MapDisplay) MouseScrolled

func (display *MapDisplay) MouseScrolled(mouseX, mouseY float32, deltaX, deltaY float32, modifier input.Modifier)

MouseScrolled must be called for a mouse scroll

func (*MapDisplay) Render

func (display *MapDisplay) Render(properties object.PropertiesTable, lvl *level.Level,
	paletteTexture *graphics.PaletteTexture, textureRetriever func(resource.Key) (*graphics.BitmapTexture, error),
	textureDisplay TextureDisplay, colorDisplay ColorDisplay)

Render renders the whole map display.

func (*MapDisplay) WindowResized

func (display *MapDisplay) WindowResized(width int, height int)

WindowResized must be called to notify of a change in window geometry.

type MapGrid

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

MapGrid renders the grid of the map, based on calculated wall heights.

func NewMapGrid

func NewMapGrid(context *render.Context) *MapGrid

NewMapGrid returns a new instance.

func (*MapGrid) Dispose

func (grid *MapGrid) Dispose()

Dispose releases any internal resources

func (*MapGrid) Render

func (grid *MapGrid) Render(mapper TileMapper)

Render renders

type MapIcons added in v0.4.0

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

MapIcons is a renderable for simple bitmaps.

func NewMapIcons added in v0.4.0

func NewMapIcons(context *render.Context) *MapIcons

NewMapIcons returns a new instance.

func (*MapIcons) Render added in v0.4.0

func (renderable *MapIcons) Render(paletteTexture *graphics.PaletteTexture, iconSize float32, icons []iconData)

Render renders the icons with their center at given position

type MapPosition

type MapPosition struct {
	X level.Coordinate
	Y level.Coordinate
}

MapPosition describes a specific two-dimensional point on the map.

type MapTextures

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

MapTextures is a renderable for textures.

func NewMapTextures

func NewMapTextures(context *render.Context, textureQuery TextureQuery) *MapTextures

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

func (*MapTextures) Dispose

func (renderable *MapTextures) Dispose()

Dispose releases any internal resources

func (*MapTextures) Render

func (renderable *MapTextures) Render(columns, rows int, tileTextureQuery TileTextureQuery, paletteTexture *graphics.PaletteTexture)

Render renders

type ObjectRequestCreateEvent added in v0.4.0

type ObjectRequestCreateEvent struct {
	Pos MapPosition
}

ObjectRequestCreateEvent for requesting a new object at given position.

type ObjectSelectionAddEvent added in v0.4.0

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

ObjectSelectionAddEvent notifies about added objects to the current selection.

type ObjectSelectionRemoveEvent added in v0.4.0

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

ObjectSelectionRemoveEvent notifies about removed objects from the current selection.

type ObjectSelectionSetEvent added in v0.4.0

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

ObjectSelectionSetEvent notifies about the current set of selected objects.

type ObjectsView added in v0.4.0

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

ObjectsView is for object properties.

func NewObjectsView added in v0.4.0

func NewObjectsView(mod *model.Mod, guiScale float32, textCache *text.Cache, textureCache *graphics.TextureCache,
	commander cmd.Commander, eventListener event.Listener, eventRegistry event.Registry) *ObjectsView

NewObjectsView returns a new instance.

func (*ObjectsView) Render added in v0.4.0

func (view *ObjectsView) Render(lvl *level.Level)

Render renders the view.

func (*ObjectsView) RequestCreateObject added in v0.4.0

func (view *ObjectsView) RequestCreateObject(lvl *level.Level, pos MapPosition)

RequestCreateObject requests to create a new object of the currently selected type.

func (*ObjectsView) WindowOpen added in v0.4.0

func (view *ObjectsView) WindowOpen() *bool

WindowOpen returns the flag address, to be used with the main menu.

type TextureDisplay

type TextureDisplay int

TextureDisplay is an enumeration which texture to display in a 2D map view.

const (
	TextureDisplayFloor   TextureDisplay = 0
	TextureDisplayWall    TextureDisplay = 1
	TextureDisplayCeiling TextureDisplay = 2
)

TextureDisplay constants

func TextureDisplays

func TextureDisplays() []TextureDisplay

TextureDisplays returns all TextureDisplay constants.

func (TextureDisplay) Func

func (display TextureDisplay) Func() TextureDisplayFunc

Func returns the display func for the current display setting.

func (TextureDisplay) String

func (display TextureDisplay) String() string

String returns a textual representation.

type TextureDisplayFunc

type TextureDisplayFunc func(*level.TileMapEntry) (atlasIndex int, textureRotations int)

TextureDisplayFunc is one that resolves texture properties.

type TextureQuery

type TextureQuery func(index int) (*graphics.BitmapTexture, error)

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

type TileMapper

type TileMapper interface {
	MapGridInfo(x, y int) (level.TileType, level.TileSlopeControl, level.WallHeights)
}

TileMapper returns basic information to draw a 2D map.

type TileSelectionAddEvent

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

TileSelectionAddEvent notifies about added tiles to the current selection.

type TileSelectionRemoveEvent

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

TileSelectionRemoveEvent notifies about removed tiles from the current selection.

type TileSelectionSetEvent

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

TileSelectionSetEvent notifies about the current set of selected tiles.

type TileTextureQuery

type TileTextureQuery func(x, y int) (tileType level.TileType, textureIndex int, textureRotations int)

TileTextureQuery is a getter function to retrieve properties for rendering a texture of a tile.

type TilesView

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

TilesView is for tile properties.

func NewTilesView

func NewTilesView(mod *model.Mod, guiScale float32, textCache *text.Cache, textureCache *graphics.TextureCache,
	commander cmd.Commander, eventListener event.Listener, eventRegistry event.Registry) *TilesView

NewTilesView returns a new instance.

func (TilesView) ColorDisplay

func (view TilesView) ColorDisplay(lvl *level.Level) ColorDisplay

ColorDisplay returns the current setting which colors should be displayed.

func (*TilesView) Render

func (view *TilesView) Render(lvl *level.Level)

Render renders the view.

func (TilesView) TextureDisplay

func (view TilesView) TextureDisplay() TextureDisplay

TextureDisplay returns the current setting which textures should be displayed.

func (*TilesView) WindowOpen

func (view *TilesView) WindowOpen() *bool

WindowOpen returns the flag address, to be used with the main menu.

Jump to

Keyboard shortcuts

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