imgui scale

This commit is contained in:
Green Sky 2024-03-09 15:34:48 +01:00
parent 633f885c65
commit cf39f2d14c
No known key found for this signature in database
2 changed files with 15 additions and 9 deletions

View File

@ -90,7 +90,10 @@ const static std::vector<std::pair<ImGuiKey, doom_key_t>> g_all_keys {
float DoomIMGUI::render(float time_delta) {
float doom_interval {1.f};
if (ImGui::Begin("doom")) {
if (ImGui::Begin("doom", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::SliderFloat("scale", &_size_scaler, 1.f, 5.f);
if (ImGui::IsWindowFocused()) {
for (const auto& [imkey, dokey] : g_all_keys) {
// TODO: unpress all keys on focus loss
if (ImGui::IsKeyPressed(imkey, false)) {
@ -100,9 +103,10 @@ float DoomIMGUI::render(float time_delta) {
_doom.doomKeyUp(dokey);
}
}
}
doom_interval = _doom.render(time_delta);
ImGui::Image(reinterpret_cast<void*>(_doom.getTexID()), {320, 200*1.2});
ImGui::Image(reinterpret_cast<void*>(_doom.getTexID()), {_size_scaler * 320, _size_scaler * 200 * 1.2f});
}
ImGui::End();

View File

@ -6,6 +6,8 @@ class DoomIMGUI {
// inherit instead?
Doom _doom;
float _size_scaler {2.f};
public:
DoomIMGUI(
TextureUploaderI& tu