Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ A selected object is not just a rectangle. It may be authored, runtime-created,

## Must do first

- Keep player/controller ownership scene-specific unless a genuinely shared abstraction appears.
- Introduce an editor command/change model before implementing undo/redo.
- Keep undo/redo editor-only at first.
- [x] Keep player/controller ownership scene-specific unless a genuinely shared abstraction appears.
- [x] Introduce an editor command/change model before implementing undo/redo.
- [x] Keep undo/redo editor-only at first.
- [x] Keep scene activation separate from default scene creation so loading cannot be overwritten by `on_enter()`.

## Phase targets

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ Current priorities:
- [x] Command model for editor changes
- [x] Undo/Redo on top of the command model
- [x] Command history panel
- [ ] Multi-select
- [x] Multi-select
- [x] Multi-select move/delete
- [ ] Tool mode state
- [ ] Scale tool
- [ ] Basic audio hooks
Expand Down
3 changes: 2 additions & 1 deletion src/prune/app/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace prune {
m_input = std::make_unique<Input>();
m_time = std::make_unique<Time>();
m_scene = SceneFactory::create(SceneType::Platformer, m_window->width(), m_window->height());
m_scene->new_scene();
m_scene->on_enter();
m_ui = std::make_unique<Ui>();

Expand Down Expand Up @@ -99,7 +100,7 @@ namespace prune {
m_window->height()
);

m_scene->new_scene();
m_scene->new_scene();
m_scene->on_enter();
m_ui->set_file_status("Created new scene", false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/prune/scene/artillery/artillery_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace prune {

void ArtilleryScene::on_enter()
{
new_scene();
// Scene activation hook only. Default content is created explicitly via new_scene().
}

void ArtilleryScene::on_exit()
Expand Down
2 changes: 1 addition & 1 deletion src/prune/scene/platformer/platformer_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace prune {

void PlatformerScene::on_enter()
{
new_scene();
// Scene activation hook only. Default content is created explicitly via new_scene().
}

void PlatformerScene::on_exit()
Expand Down
4 changes: 4 additions & 0 deletions src/prune/scene/scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ namespace prune {
Scene(const Scene&) = delete;
Scene& operator=(const Scene&) = delete;

// Called when an already-created scene becomes active. Must not create or restore default content.
virtual void on_enter() = 0;

// Creates the default authored content for a new scene. Must not be called after loading a scene from disk.
virtual void new_scene() = 0;

virtual void on_exit() = 0;
virtual void update(float dt, const Input& input) = 0;
virtual void update_editor(float, const Input&) {}
Expand Down
2 changes: 1 addition & 1 deletion src/prune/scene/simple_shooter/simple_shooter_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace prune {

void SimpleShooterScene::on_enter()
{
new_scene();
// Scene activation hook only. Default content is created explicitly via new_scene().
}

void SimpleShooterScene::on_exit()
Expand Down
Loading