mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
gitadora: (arena model) single window mode + subscreen overlay (#486)
## Link to GitHub Issue, if one exists #477 ## Description of change This is a work in progress. What works: - [x] subscreen overlay shows the touch screen image (in windowed mode) - [x] touch works in the overlay - [x] only the main window is shown, other windows are not launched What doesn't: - [ ] game occasionally crashes when entering test menu? - [ ] full screen mode is not tested at all due to monitor requirements - [ ] need more polish (various options to control the behavior)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#include "avs/game.h"
|
||||
#include "gfdm_sub.h"
|
||||
#include "games/gitadora/gitadora.h"
|
||||
#include "hooks/graphics/graphics.h"
|
||||
#include "touch/touch.h"
|
||||
|
||||
namespace overlay::windows {
|
||||
|
||||
GitaDoraSubScreen::GitaDoraSubScreen(SpiceOverlay *overlay) : GenericSubScreen(overlay) {
|
||||
this->title = "GITADORA Subscreen";
|
||||
|
||||
if (!games::gitadora::is_arena_model()) {
|
||||
this->disabled_message = "Requires Arena Model!";
|
||||
}
|
||||
|
||||
this->resize_callback = keep_10_by_16;
|
||||
|
||||
// medium size - perfect for "layout B" in GW Delta, though in drums it covers the pacemaker
|
||||
float size = 0.64f;
|
||||
if (games::gitadora::SUBSCREEN_OVERLAY_SIZE.has_value()) {
|
||||
if (games::gitadora::SUBSCREEN_OVERLAY_SIZE.value() == "large") {
|
||||
// enough to not cover the FPS overlay
|
||||
size = 0.88f;
|
||||
} else if (games::gitadora::SUBSCREEN_OVERLAY_SIZE.value() == "small") {
|
||||
size = 0.48f;
|
||||
}
|
||||
}
|
||||
|
||||
const float height = ImGui::GetIO().DisplaySize.y * size;
|
||||
const float width = height * 10 / 16;
|
||||
this->init_size = ImVec2(width, height + ImGui::GetFrameHeight());
|
||||
|
||||
// bottom right
|
||||
this->init_pos = ImVec2(
|
||||
ImGui::GetIO().DisplaySize.x - ImGui::GetFrameHeight() / 4 - this->init_size.x,
|
||||
ImGui::GetIO().DisplaySize.y - this->init_size.y - (ImGui::GetFrameHeight() / 4));
|
||||
}
|
||||
|
||||
void GitaDoraSubScreen::touch_transform(const ImVec2 xy_in, LONG *x_out, LONG *y_out) {
|
||||
if (!this->get_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
// Touch needs to be registered on global coords
|
||||
*x_out = SPICETOUCH_TOUCH_X + xy_in.x * SPICETOUCH_TOUCH_WIDTH;
|
||||
*y_out = SPICETOUCH_TOUCH_Y + xy_in.y * SPICETOUCH_TOUCH_HEIGHT;
|
||||
} else {
|
||||
// Fullscreen mode, scale to game coords
|
||||
*x_out = xy_in.x * ImGui::GetIO().DisplaySize.x;
|
||||
*y_out = xy_in.y * ImGui::GetIO().DisplaySize.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user