Part of #1: Scene-Based Architecture
Overview
Implement a Scene class that acts as the root component, owning the window and renderer lifecycle while providing a simplified interface for applications.
Requirements
- Scene component should own
IWindow* and IRenderer*
- Manage
EventDispatcher internally
- Automatically fill window dimensions
- Handle window resize events and propagate to children
- Provide simple
update(), render(), present() interface
- Support attach/detach from window
Implementation Details
Class Structure
namespace bombfork::prong {
class Scene : public Component {
private:
IWindow* window;
IRenderer* renderer;
std::unique_ptr<EventDispatcher> eventDispatcher;
public:
Scene(IWindow* window, IRenderer* renderer);
// Lifecycle
void attach();
void detach();
// Main loop interface
void update(double deltaTime) override;
void render() override;
void present();
// Window events
void onWindowResize(int width, int height);
};
}
Key Features
- Automatic Bounds: Scene automatically sets its bounds to window size
- Event Management: Creates and manages EventDispatcher internally
- Child Registration: Automatically registers children with event dispatcher
- Resize Propagation: Notifies all children when window resizes
Acceptance Criteria
Example Usage
// In main.cpp
auto window = std::make_unique<GLFWWindowAdapter>(glfwWindow);
auto renderer = std::make_unique<OpenGLRenderer>();
auto scene = std::make_unique<DemoScene>(window.get(), renderer.get());
scene->attach();
while (!window->shouldClose()) {
double deltaTime = calculateDeltaTime();
scene->update(deltaTime);
scene->render();
scene->present();
}
scene->detach();
Part of #1: Scene-Based Architecture
Overview
Implement a
Sceneclass that acts as the root component, owning the window and renderer lifecycle while providing a simplified interface for applications.Requirements
IWindow*andIRenderer*EventDispatcherinternallyupdate(),render(),present()interfaceImplementation Details
Class Structure
Key Features
Acceptance Criteria
include/bombfork/prong/core/scene.hExample Usage