levels

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CeilingTexture

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

CeilingTexture returns the properties for the ceiling.

func FloorTexture

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

FloorTexture returns the properties for the floor.

func WallTexture

func WallTexture(tile *level.TileMapEntry) (atlasIndex level.AtlasIndex, 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(columns, rows int)

Render renders the grid.

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 are listed below.

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(level.TilePosition) [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(levels *edit.EditableLevels, levelSelection *edit.LevelSelectionService, editor *edit.LevelEditorService,
	guiScale float32, textCache *text.Cache, textureCache *graphics.TextureCache,
	registry cmd.Registry) *ControlView

NewControlView returns a new instance.

func (*ControlView) Render

func (view *ControlView) Render()

Render renders the view.

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 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 the renderable.

type MapDisplay

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

MapDisplay renders a level map.

func NewMapDisplay

func NewMapDisplay(gameObjects *edit.GameObjectsService, levelSelection *edit.LevelSelectionService, editor *edit.LevelEditorService,
	gl opengl.OpenGL, guiScale float32,
	textureQuery TextureQuery) *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(
	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(columns, rows int, mapper TileMapper)

Render renders the grid.

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.

func (MapPosition) Fine added in v1.8.0

func (pos MapPosition) Fine() level.FinePosition

Fine returns the fine position of the exact position.

func (MapPosition) Tile added in v1.8.0

func (pos MapPosition) Tile() level.TilePosition

Tile returns the tile position of the exact position.

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 the textures.

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(gameObjects *edit.GameObjectsService,
	editor *edit.LevelEditorService,
	levelSelection *edit.LevelSelectionService,
	varInfoProvider archive.GameVariableInfoProvider,
	guiScale float32, textCache *text.Cache, textureCache *graphics.TextureCache,
	registry cmd.Registry, gl opengl.OpenGL) *ObjectsView

NewObjectsView returns a new instance.

func (*ObjectsView) Render added in v0.4.0

func (view *ObjectsView) Render()

Render renders the view.

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 are listed below.

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 level.AtlasIndex, textureRotations int)

TextureDisplayFunc is one that resolves texture properties.

type TextureQuery

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

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

type TileMapper

type TileMapper interface {
	MapGridInfo(pos level.TilePosition) (level.TileType, level.TileSlopeControl, level.WallHeights)
}

TileMapper returns basic information to draw a 2D map.

type TileTextureQuery

type TileTextureQuery func(pos level.TilePosition) (tileType level.TileType, textureIndex level.TextureIndex, 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(editor *edit.LevelEditorService,
	guiScale float32, textCache *text.Cache, textureCache *graphics.TextureCache, registry cmd.Registry) *TilesView

NewTilesView returns a new instance.

func (TilesView) ColorDisplay

func (view TilesView) ColorDisplay() ColorDisplay

ColorDisplay returns the current setting which colors should be displayed.

func (*TilesView) Render

func (view *TilesView) Render()

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