mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-10-03 08:48:14 -07:00
7ccd938f9b
## Link to GitHub Issue or related Pull Request, if one exists Fixes #840 ## Description of change Currently, for subscreen games, mouse events are still delivered even when the subscreen overlay window is not visible. Change this so that the subscreen overlay must be active and under the mouse cursor for the mouse-to-touch transformation to occur. Applies to both native and wintouchemu. ## Testing Needs to test everything again.. iidx: - [ ] full screen with overlay - [ ] single window with overlay - [ ] two window Test: mouse, poke, api, real touch screen sdvx: - [ ] full screen with overlay - [ ] windowed popn - [x] full screen with overlay - [x] window with overlay - [x] dedicated window gitadora - [x] single window with overlay - [x] dedicated sub window nostalgia - [x] fullscreen - [x] windowed test: poke wintouchemu - [ ] Do all of the above again with wintouchemu
68 lines
2.1 KiB
C++
68 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "external/imgui/imgui.h"
|
|
#include "external/imgui/misc/cpp/imgui_stdlib.h"
|
|
#include "overlay.h"
|
|
|
|
namespace overlay {
|
|
|
|
class Window {
|
|
public:
|
|
virtual ~Window();
|
|
|
|
// an opportunity to calculate initial window position and size within the ImGui
|
|
// window context, since it may not be possible in the Window constructor
|
|
virtual void calculate_initial_window() {}
|
|
|
|
virtual void build_content() = 0;
|
|
virtual void update();
|
|
virtual void after_render() {};
|
|
|
|
void build();
|
|
void toggle_active();
|
|
void set_active(bool active);
|
|
bool get_active();
|
|
bool is_mouse_hovered();
|
|
|
|
// raise this window to the top of the z-order on its next build. only
|
|
// call in response to an explicit user action (keyboard toggle, UI
|
|
// button) - not for auto-show / programmatic shows.
|
|
void bring_to_front();
|
|
protected:
|
|
|
|
// state
|
|
SpiceOverlay *overlay;
|
|
bool active = false;
|
|
// set when the window transitions to visible so build() raises it to the
|
|
// top of the z-order on the next frame
|
|
bool request_focus = false;
|
|
bool mouse_hovered = false;
|
|
std::vector<Window*> children;
|
|
|
|
// settings
|
|
bool remove_window_padding = false;
|
|
// custom inner window padding, applied before Begin() (preserving border /
|
|
// rounding) when x >= 0; ignored if remove_window_padding is set
|
|
ImVec2 window_padding = ImVec2(-1, -1);
|
|
bool draws_window = true;
|
|
ImGuiSizeCallback resize_callback = nullptr;
|
|
std::string title = "Title";
|
|
ImGuiWindowFlags flags = 0;
|
|
size_t toggle_button = ~0u;
|
|
bool toggle_button_state = false;
|
|
|
|
// init settings
|
|
// calculate_initial_window() runs only once; results feed ImGuiCond_Once
|
|
bool initial_window_calculated = false;
|
|
ImVec2 init_pos = ImVec2(0, 0);
|
|
ImVec2 init_size = ImVec2(0, 0);
|
|
ImVec2 size_min = ImVec2(0, 0);
|
|
ImVec2 size_max = ImVec2(-1, -1);
|
|
float bg_alpha = 0.96f;
|
|
|
|
Window(SpiceOverlay *overlay);
|
|
};
|
|
}
|