40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <sophia/frame_info.hpp>
|
|
#include <sophia/handles.hpp>
|
|
#include <sophia/scene_view_registry.hpp>
|
|
#include <sophia/ui/panel.hpp>
|
|
#include <sophia/ui/ui.hpp>
|
|
|
|
#include "../editor_context.hpp"
|
|
|
|
/**
|
|
* Shows the active scene through its own active camera: what the game will
|
|
* see.
|
|
*/
|
|
class GamePanel : public sophia::Panel {
|
|
public:
|
|
// Renders into `target` through `view`, a SceneView with no camera of its
|
|
// own that this panel keeps pointed at the active scene.
|
|
GamePanel(sophia::UI& ui, EditorContext& context,
|
|
sophia::SceneViewRegistry& sceneViews, sophia::SceneViewHandle view,
|
|
sophia::RenderTargetHandle target)
|
|
: Panel{{.name = "Game",
|
|
.windowFlags = ImGuiWindowFlags_NoScrollbar |
|
|
ImGuiWindowFlags_NoScrollWithMouse}},
|
|
ui{ui},
|
|
context{context},
|
|
sceneViews{sceneViews},
|
|
view{view},
|
|
target{target} {}
|
|
|
|
void onUpdate(const sophia::FrameInfo& frameInfo) override;
|
|
|
|
private:
|
|
sophia::UI& ui;
|
|
EditorContext& context;
|
|
sophia::SceneViewRegistry& sceneViews;
|
|
sophia::SceneViewHandle view;
|
|
sophia::RenderTargetHandle target;
|
|
};
|