Repository navigation
Add typed component access, entity names, release events and lambda loads - #2
Merged
Merged
Conversation
…oads Batch 1 of ROADMAP.md, the queue of planned engine improvements. - Entity::getComponent<T>(), getComponents<T>(), hasComponent<T>() and addComponent<T>(args...). They match subclasses and skip dead components. - Entities have an optional name, serialised only when set so older save files load unchanged. Scene::findEntity, findEntities and getEntitiesWith<T>() look entities up. Names show in the inspector, where they can be edited, and in the entities console command. - KeyListener::isKeyEndDown and MouseListener::isMouseEndDown report a release for one frame. A press and release within one frame now still reports begin down. Mouse world coordinates are skipped when no scene exists, so MouseListener::endFrame is safe before start. - Pancake::load and Window::load take std::function, so capturing lambdas work. The load queue is moved out before running, so a load function that queues another can't reallocate the vector holding the running function. Tests: new unit test test_entity, and test_engine now covers name lookup across a save and reload, getEntitiesWith, and capturing and nested loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015cNAkNqoDWA5gFReD1AsqV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch 1 of the new
ROADMAP.md, which queues the planned engine improvements in batches of related work.Changes
Entity::getComponent<T>(),getComponents<T>(),hasComponent<T>()andaddComponent<T>(args...). They match subclasses (getComponent<ForceGenerator>()finds aGravity) and skip dead components. The demo now uses them instead ofdynamic_caston a type-name string.name. It is serialised only when set, so older save files load unchanged, and a non-string name is rejected as malformed.Scene::findEntity(name),findEntities(name)andgetEntitiesWith<T>().entitiesconsole command.KeyListener::isKeyEndDownandMouseListener::isMouseEndDownare true for the frame a key or button is released.MouseListenerskips the world-coordinate update when no scene exists, soendFrameis safe beforestart.loadtakes any callable:Pancake::loadandWindow::loadtakestd::function<void(Scene*)>, so capturing lambdas work. Existing calls with plain functions still compile.CLAUDE.mdpoints at the roadmap.Testing
tests/test_entity.cppcovers typed components, names round-tripping through JSON, and key and mouse press/release, including a tap within one frame.tests/test_engine.cppnow checks that names survive a save and reload, thatgetEntitiesWith<Rigidbody>()works, and that a capturing load lambda that queues a second one runs both in the same frame.🤖 Generated with Claude Code
https://claude.ai/code/session_015cNAkNqoDWA5gFReD1AsqV
Generated by Claude Code