Places and moves the enemies of a wave with the mouse, and the waves in time.
More...
#include </__w/project-rtype/project-rtype/client/network/include/rtype/level_editor.hpp>
|
| | LevelEditor (LevelDraft draft, std::string type="bydos_slave") |
| | Edits a draft, from its first wave.
|
| |
| const LevelDraft & | draft () const noexcept |
| | The waves edited.
|
| |
| std::size_t | wave () const noexcept |
| | Index of the wave edited.
|
| |
| void | next_wave () noexcept |
| | Edits the next wave, or the first after the last.
|
| |
| void | previous_wave () noexcept |
| | Edits the wave before, or the last before the first.
|
| |
| std::vector< WaveSpan > | timeline () const |
| | When each wave plays, as the server plays them: a wave starts its delay after the last enemy of the wave before appeared.
|
| |
| void | add_wave () |
| | Adds an empty wave after the one edited, 2 seconds after it, and edits it.
|
| |
| void | shift_delay (float seconds) |
| | Moves the wave edited in time: changes its delay, and so moves the waves after.
|
| |
| void | move_wave (bool later) |
| | Moves the wave edited before or after its neighbour, which takes its place; the wave stays the one edited.
|
| |
| bool | dragging_wave () const noexcept |
| | Tells whether the wave edited follows the mouse on the timeline.
|
| |
| std::span< const DraftEnemy > | enemies () const noexcept |
| | The enemies of the wave edited.
|
| |
| void | update (const EditorPointer &pointer, const EditorView &view={}) |
| | Applies the mouse of a frame.
|
| |
| std::optional< std::size_t > | hovered () const noexcept |
| | The enemy under the mouse, at the last update().
|
| |
| std::optional< std::size_t > | dragged () const noexcept |
| | The enemy following the mouse.
|
| |
| bool | changed () const noexcept |
| | Tells whether the waves changed since the editor opened or they were saved.
|
| |
| void | mark_saved () noexcept |
| | Tells the editor that its waves were saved: changed() is false again.
|
| |
|
| static constexpr float | pick_radius = 20.0F |
| | Distance from an enemy's position within which the mouse is over it.
|
| |
Places and moves the enemies of a wave with the mouse, and the waves in time.
The left button places an enemy of the current type where it is clicked, or takes the enemy under the mouse; either follows the mouse while the button is held. The right button removes the enemy under the mouse. Positions are whole logical pixels, kept within the play area and the strip beyond its right edge (EditorView::strip). On the timeline, a click on a wave edits it, and the wave follows the mouse while the button is held: its delay changes, and the waves after it move with it.
◆ LevelEditor()
| rtype::LevelEditor::LevelEditor |
( |
LevelDraft |
draft, |
|
|
std::string |
type = "bydos_slave" |
|
) |
| |
|
explicit |
Edits a draft, from its first wave.
- Parameters
-
| draft | Waves to edit; a draft without waves gets an empty one. |
| type | Type of the enemies placed. |
◆ add_wave()
| void rtype::LevelEditor::add_wave |
( |
| ) |
|
Adds an empty wave after the one edited, 2 seconds after it, and edits it.
◆ changed()
| bool rtype::LevelEditor::changed |
( |
| ) |
const |
|
noexcept |
Tells whether the waves changed since the editor opened or they were saved.
- Returns
true once an enemy or a wave changed.
◆ draft()
| const LevelDraft & rtype::LevelEditor::draft |
( |
| ) |
const |
|
noexcept |
The waves edited.
- Returns
- The draft.
◆ dragged()
| std::optional< std::size_t > rtype::LevelEditor::dragged |
( |
| ) |
const |
|
noexcept |
The enemy following the mouse.
- Returns
- Its index in enemies(), or nothing while the left button is up.
◆ dragging_wave()
| bool rtype::LevelEditor::dragging_wave |
( |
| ) |
const |
|
noexcept |
Tells whether the wave edited follows the mouse on the timeline.
- Returns
true while a wave is dragged there.
◆ enemies()
| std::span< const DraftEnemy > rtype::LevelEditor::enemies |
( |
| ) |
const |
|
noexcept |
The enemies of the wave edited.
- Returns
- Its enemies.
◆ hovered()
| std::optional< std::size_t > rtype::LevelEditor::hovered |
( |
| ) |
const |
|
noexcept |
The enemy under the mouse, at the last update().
- Returns
- Its index in enemies(), or nothing.
◆ mark_saved()
| void rtype::LevelEditor::mark_saved |
( |
| ) |
|
|
noexcept |
Tells the editor that its waves were saved: changed() is false again.
◆ move_wave()
| void rtype::LevelEditor::move_wave |
( |
bool |
later | ) |
|
Moves the wave edited before or after its neighbour, which takes its place; the wave stays the one edited.
- Parameters
-
| later | true to swap it with the wave after, false with the one before; nothing at the ends. |
◆ next_wave()
| void rtype::LevelEditor::next_wave |
( |
| ) |
|
|
noexcept |
Edits the next wave, or the first after the last.
◆ previous_wave()
| void rtype::LevelEditor::previous_wave |
( |
| ) |
|
|
noexcept |
Edits the wave before, or the last before the first.
◆ shift_delay()
| void rtype::LevelEditor::shift_delay |
( |
float |
seconds | ) |
|
Moves the wave edited in time: changes its delay, and so moves the waves after.
- Parameters
-
| seconds | Seconds later (positive) or earlier (negative); the delay stays at least 0 and is rounded to a tenth of a second. |
◆ timeline()
| std::vector< WaveSpan > rtype::LevelEditor::timeline |
( |
| ) |
const |
When each wave plays, as the server plays them: a wave starts its delay after the last enemy of the wave before appeared.
- Returns
- One span per wave, in order.
◆ update()
Applies the mouse of a frame.
- Parameters
-
| pointer | The mouse, in logical pixels of the screen. |
| view | Where the play area is drawn. |
◆ wave()
| std::size_t rtype::LevelEditor::wave |
( |
| ) |
const |
|
noexcept |
Index of the wave edited.
- Returns
- From 0.
◆ pick_radius
| constexpr float rtype::LevelEditor::pick_radius = 20.0F |
|
staticconstexpr |
Distance from an enemy's position within which the mouse is over it.
The documentation for this class was generated from the following file: