Only enable viewports on multimodal apps (like the editors)
* Dragging out windows on games and stuff is pointless and just adds complexity
This commit is contained in:
parent
fd4661088a
commit
878ef9c5da
5 changed files with 11 additions and 6 deletions
|
@ -30,6 +30,7 @@ namespace prism {
|
||||||
virtual void render([[maybe_unused]] GFXCommandBuffer* command_buffer) {}
|
virtual void render([[maybe_unused]] GFXCommandBuffer* command_buffer) {}
|
||||||
|
|
||||||
virtual bool wants_no_scene_rendering() { return false; }
|
virtual bool wants_no_scene_rendering() { return false; }
|
||||||
|
virtual bool is_multimodal() { return false; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ void engine::set_app(prism::app* p_app) {
|
||||||
Expects(p_app != nullptr);
|
Expects(p_app != nullptr);
|
||||||
|
|
||||||
this->current_app = p_app;
|
this->current_app = p_app;
|
||||||
|
|
||||||
|
if(platform::supports_feature(PlatformFeature::Windowing) && ::engine->get_app()->is_multimodal()) {
|
||||||
|
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::app* engine::get_app() const {
|
prism::app* engine::get_app() const {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include "assertions.hpp"
|
#include "assertions.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
|
#include "app.hpp"
|
||||||
|
|
||||||
using prism::imgui_backend;
|
using prism::imgui_backend;
|
||||||
|
|
||||||
|
@ -44,9 +45,6 @@ imgui_backend::imgui_backend() {
|
||||||
io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports;
|
io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports;
|
||||||
io.BackendPlatformName = "Prism";
|
io.BackendPlatformName = "Prism";
|
||||||
|
|
||||||
if(platform::supports_feature(PlatformFeature::Windowing))
|
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
|
||||||
|
|
||||||
for (auto& [im, pl] : imToPl)
|
for (auto& [im, pl] : imToPl)
|
||||||
io.KeyMap[im] = platform::get_keycode(pl);
|
io.KeyMap[im] = platform::get_keycode(pl);
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
virtual void asset_selected([[maybe_unused]] std::filesystem::path path, [[maybe_unused]] AssetType type) {}
|
virtual void asset_selected([[maybe_unused]] std::filesystem::path path, [[maybe_unused]] AssetType type) {}
|
||||||
|
|
||||||
bool wants_no_scene_rendering() override { return true; }
|
bool wants_no_scene_rendering() override { return true; }
|
||||||
|
bool is_multimodal() override { return true; }
|
||||||
|
|
||||||
void createDockArea();
|
void createDockArea();
|
||||||
void drawViewport(Scene* scene);
|
void drawViewport(Scene* scene);
|
||||||
|
|
|
@ -387,8 +387,9 @@ Transform stored_transform;
|
||||||
|
|
||||||
bool IsItemActiveLastFrame() {
|
bool IsItemActiveLastFrame() {
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.ActiveIdPreviousFrame)
|
// TODO: uh oh this is broken now :-(
|
||||||
return g.ActiveIdPreviousFrame == g.CurrentWindow->DC.LastItemId;
|
//if (g.ActiveIdPreviousFrame)
|
||||||
|
// return g.ActiveIdPreviousFrame == g.CurrentWindow->DC.LastItemId;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue