PlayTestDebug class
Debug tools of a level played from the level editor.
The level handlers of the play-tests have one (see LevelHandler::
The level handler calls into it at the beginning and at the end of a frame and when its viewports change, it reads and changes the level handler and its objects as a part of it.
Constructors, destructors, conversion operators
- PlayTestDebug(LevelHandler& levelHandler) explicit
- Creates a new instance for a level handler.
- ~PlayTestDebug()
- PlayTestDebug(const PlayTestDebug&) deleted
Public functions
- auto operator=(const PlayTestDebug&) -> PlayTestDebug& deleted
- void SetOptions(const PlayTestDebugOptions& options)
- Sets the debug toggles.
- auto GetOptions() const -> const PlayTestDebugOptions&
- Returns the debug toggles.
- void Step()
- Advances the time of the level by exactly one update at the normal rate, and pauses it again.
-
auto TeleportPlayer(std::
int32_t playerIndex, Vector2f pos) -> bool - Moves a local player to a position in the level, or near it.
- auto FindClearPlayerPosition(Vector2f pos, float radius, Vector2f& result) const -> bool
- Finds where a player fits nearest to a position, within
radiuspixels. -
void DespawnTileEventActors(ArrayView<const std::
uint32_t> sortedCells, std:: int32_t width) - Destroys the objects spawned from the events of tiles, as if the tiles went out of range.
Called by the level handler
- auto BeginFrame(float timeMult) -> float
- Applies the toggles at the beginning of a frame, returns the time of the level in it.
- auto GetFrameTimeMult(float timeMult) const -> float
- Returns the time of the level in this frame, the same as BeginFrame() returned, for the normal
timeMult. - auto IsFrameFrozen() const -> bool
- Returns
trueif the time of the level stands still in this frame, nothing of the level goes on then. -
auto CreateRootNode() -> std::
unique_ptr<SceneNode> - Creates the node every object of the level is under, it updates them with the time of the level.
- void UpdateOverlay()
- Puts the overlay under the node of the HUD again while something of it is shown, after the viewports changed.
- void DetachOverlay()
- Takes the overlay off the scene, before the level handler takes its nodes apart.
Function documentation
void Jazz2:: Editor:: PlayTestDebug:: SetOptions(const PlayTestDebugOptions& options)
Sets the debug toggles.
The time scale and the pause change only the time of the level, not that of the HUD and the menus.
void Jazz2:: Editor:: PlayTestDebug:: Step()
Advances the time of the level by exactly one update at the normal rate, and pauses it again.
Pauses the time of the level first if it isn't paused, see PlayTestDebugOptions::
bool Jazz2:: Editor:: PlayTestDebug:: TeleportPlayer(std:: int32_t playerIndex,
Vector2f pos)
Moves a local player to a position in the level, or near it.
The player is placed where it fits nearest to pos, within 10 tiles, and stands still there. Returns false if playerIndex isn't one of the players or no place for the player was found.
bool Jazz2:: Editor:: PlayTestDebug:: FindClearPlayerPosition(Vector2f pos,
float radius,
Vector2f& result) const
Finds where a player fits nearest to a position, within radius pixels.
Searched in growing rings, up first, because the player falls down from there. Only the tiles are taken into account, the hitbox is that of a standing player.
void Jazz2:: Editor:: PlayTestDebug:: DespawnTileEventActors(ArrayView<const std:: uint32_t> sortedCells,
std:: int32_t width)
Destroys the objects spawned from the events of tiles, as if the tiles went out of range.
The tiles are given as cells of the event map, x + y * width, sorted. The events are spawned again as the event map has them then, as soon as their tiles are in range of a player, so events changed in the level editor while the level is played take effect at once.