Polyphase Game Engine
Loading...
Searching...
No Matches
SecondScreenPreview.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include <cstdint>
6#include "imgui.h"
7
8class World;
9class Image;
10class Scene;
11
12class SecondScreenPreview
13{
14public:
15 void Enable();
16 void Disable();
17 void Update(float deltaTime);
18 void Render();
19 void DrawPanel();
20
21 void BeginInputRemap();
22 void EndInputRemap();
23
24 bool IsEnabled() const { return mEnabled; }
25
26private:
27 struct ScreenState
28 {
29 World* mWorld = nullptr;
30 Image* mColorTarget = nullptr;
31 Image* mDepthTarget = nullptr;
32 ImTextureID mImGuiTexId = 0;
33 Scene* mCurrentScene = nullptr;
34 };
35
36 bool mEnabled = false;
37 ScreenState mTop;
38 ScreenState mBottom;
39
40 // Bottom screen image rect (captured by DrawPanel, used by BeginInputRemap)
41 ImVec2 mBottomImageMin = {0, 0};
42 ImVec2 mBottomImageMax = {0, 0};
43
44 // Saved state for input remap
45 int32_t mSavedMouseX = 0;
46 int32_t mSavedMouseY = 0;
47 uint32_t mSavedVpX = 0;
48 uint32_t mSavedVpY = 0;
49 uint32_t mSavedVpW = 0;
50 uint32_t mSavedVpH = 0;
51 bool mInputRemapActive = false;
52
53 static constexpr uint32_t kTopWidth = 400;
54 static constexpr uint32_t kTopHeight = 240;
55 static constexpr uint32_t kBottomWidth = 320;
56 static constexpr uint32_t kBottomHeight = 240;
57
58 void CreateScreenTargets(ScreenState& screen, uint32_t width, uint32_t height, const char* debugName);
59 void DestroyScreenTargets(ScreenState& screen);
60 Scene* FindSceneForScreen(uint8_t targetScreen);
61 void UpdateScreen(ScreenState& screen, uint8_t targetScreen, float deltaTime);
62};
63
64SecondScreenPreview* GetSecondScreenPreview();
65
66#endif
bool Update()
Definition Engine.cpp:710
Definition Scene.h:36
Definition World.h:24
void Enable(bool enable)
Definition ImGuizmo.cpp:1055