LayerView struct
#include <Jazz2/Editor/Common/LayerView.h>
How a layer is shown in the view.
Layers other than the sprite layer move at their own speed, so a position in the view lies on another tile of each layer. Cells here are counted from the tile (0, 0) of the layer as it's shown, without repeating — Wrap() finds the tile of the layer a cell shows.
Public functions
- auto ScreenToWorld(Vector2f screen) const -> Vector2f
- Converts a position on the screen to a position in the level.
- auto WorldToScreen(Vector2f world) const -> Vector2f
- Converts a position in the level to a position on the screen.
- auto WorldToCell(Vector2f world) const -> Vector2i
- Returns the cell at a position in the level.
- auto CellToScreen(Vector2i cell) const -> Rectf
- Returns the rectangle a cell takes on the screen.
- auto Wrap(Vector2i cell, Vector2i& tile) const -> bool
- Returns the tile of the layer a cell shows,
falseif it shows none.
Public variables
- Vector2f Origin
- Position of the tile (0, 0) of the layer in the level.
- Vector2i Size
- Size of the layer in tiles.
- bool RepeatX
- Whether the layer repeats horizontally.
- bool RepeatY
- Whether the layer repeats vertically.
- float Scale
- Pixels of the screen one pixel of the level takes.
- Vector2f ViewOrigin
- Position of the top left corner of the view in pixels of the level multiplied by the scale.
- Vector2f ScreenOffset
- Position of the view on the screen.