mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
Multiple "scenes" for screen resize (#270)
## Link to GitHub Issue, if one exists Fixes #263 ## Description of change Add "scenes" to screen resize. * UI changes - F11 menu now has a "scene switcher" for `Scene 1/2/3/4`. Clean up other UI bits. * Add hotkeys for `Screen Resize Scene 1`, `Screen Resize 2`, and so on. * Detect hot key and trigger resizes. * Add additional objects to screen_resize.json for saving and loading the new scene settings. * Existing screen resize data is backwards compatible (can be loaded/saved to JSON), and is treated as `Scene 1`. * Add API endpoint for `Resize`, allow toggling resize on/off, switching active scene * Add Python wrapper. Did not bother with the other wrappers (Dart, C++, etc)... ## Compiling 🥇 ## Testing Still testing, but seems to work fine for TDJ.
This commit is contained in:
@@ -740,9 +740,10 @@ void SurfaceHook(IDirect3DDevice9 *pReal) {
|
||||
topSurface->UnlockRect();
|
||||
|
||||
// do the actual zoom / offset math
|
||||
if (cfg::SCREENRESIZE->centered) {
|
||||
targetRect.right = (w + rectLeft) / cfg::SCREENRESIZE->scale_x;
|
||||
targetRect.bottom = (h + rectTop) / cfg::SCREENRESIZE->scale_y;
|
||||
auto& scene = cfg::SCREENRESIZE->scene_settings[cfg::SCREENRESIZE->screen_resize_current_scene];
|
||||
if (scene.centered) {
|
||||
targetRect.right = (w + rectLeft) / scene.scale_x;
|
||||
targetRect.bottom = (h + rectTop) / scene.scale_y;
|
||||
const LONG deltaH = ((targetRect.bottom - targetRect.top) - h) / 2;
|
||||
const LONG deltaW = ((targetRect.right - targetRect.left) - w) / 2;
|
||||
targetRect.top -= deltaH;
|
||||
@@ -750,12 +751,12 @@ void SurfaceHook(IDirect3DDevice9 *pReal) {
|
||||
targetRect.left -= deltaW;
|
||||
targetRect.right -= deltaW;
|
||||
} else {
|
||||
targetRect.left -= cfg::SCREENRESIZE->offset_x;
|
||||
targetRect.top += cfg::SCREENRESIZE->offset_y;
|
||||
targetRect.right = -cfg::SCREENRESIZE->offset_x;
|
||||
targetRect.right += (w + rectLeft) / cfg::SCREENRESIZE->scale_x;
|
||||
targetRect.bottom = cfg::SCREENRESIZE->offset_y;
|
||||
targetRect.bottom += (h + rectTop) / cfg::SCREENRESIZE->scale_y;
|
||||
targetRect.left -= scene.offset_x;
|
||||
targetRect.top += scene.offset_y;
|
||||
targetRect.right = -scene.offset_x;
|
||||
targetRect.right += (w + rectLeft) / scene.scale_x;
|
||||
targetRect.bottom = scene.offset_y;
|
||||
targetRect.bottom += (h + rectTop) / scene.scale_y;
|
||||
}
|
||||
|
||||
// draw to back buffer
|
||||
|
||||
Reference in New Issue
Block a user