mirror of
https://github.com/AverageConsumer/kanto-gear.git
synced 2026-08-28 18:24:42 +02:00
Hide inactive overlay surface completely
This commit is contained in:
@@ -182,6 +182,7 @@ function THEME:windowLayout(mode, width, height, swapped, overlayCorner,
|
||||
local gap = math.max(2, math.floor(math.min(width, height) * 0.01))
|
||||
local game, gear
|
||||
local showGear = true
|
||||
local showGame = true
|
||||
local gameOnTop = false
|
||||
if mode == "fullscreen" then
|
||||
game = { x = 0, y = 0, w = width, h = height }
|
||||
@@ -217,10 +218,12 @@ function THEME:windowLayout(mode, width, height, swapped, overlayCorner,
|
||||
end
|
||||
if mode == "overlay" and overlayHidden then
|
||||
showGear = swapped == true
|
||||
showGame = swapped ~= true
|
||||
gameOnTop = false
|
||||
end
|
||||
return {
|
||||
game = game, gear = gear, showGear = showGear, gameOnTop = gameOnTop,
|
||||
game = game, gear = gear, showGame = showGame,
|
||||
showGear = showGear, gameOnTop = gameOnTop,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -4847,7 +4850,7 @@ return function(mod)
|
||||
primaryBottomRect = THEME:drawCanvas(canvas, layout.gear)
|
||||
THEME:drawCanvas(context.canvas, layout.game)
|
||||
else
|
||||
THEME:drawCanvas(context.canvas, layout.game)
|
||||
if layout.showGame then THEME:drawCanvas(context.canvas, layout.game) end
|
||||
primaryBottomRect = layout.showGear
|
||||
and THEME:drawCanvas(canvas, layout.gear) or nil
|
||||
end
|
||||
@@ -4934,7 +4937,7 @@ return function(mod)
|
||||
and context and context.canvas) then
|
||||
return next(windowGame, context)
|
||||
end
|
||||
next(windowGame, context)
|
||||
if THEME.nativeWindowLayout.showGame then next(windowGame, context) end
|
||||
if not THEME.nativeWindowLayout.showGear then
|
||||
primaryBottomRect = nil
|
||||
displayReady = false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "kanto_gear",
|
||||
"name": "Kanto Gear",
|
||||
"version": "1.9.0-rc.7",
|
||||
"version": "1.9.0-rc.8",
|
||||
"api": 2,
|
||||
"entry": "main.lua",
|
||||
"category": "UI",
|
||||
|
||||
@@ -152,7 +152,8 @@ T.check(swappedOverlay.gameOnTop,
|
||||
"swapped overlay keeps the smaller Game surface visible above Gear")
|
||||
local hiddenGame = theme:windowLayout(
|
||||
"overlay", 1280, 720, true, "bottom_right", true)
|
||||
T.check(hiddenGame.showGear and not hiddenGame.gameOnTop,
|
||||
T.check(hiddenGame.showGear and not hiddenGame.showGame
|
||||
and not hiddenGame.gameOnTop,
|
||||
"hidden Gear-first overlay keeps Gear full and omits the smaller Game")
|
||||
for _, layout in ipairs({ stacked, side, overlay, swapped, swappedOverlay }) do
|
||||
for _, rect in ipairs({ layout.game, layout.gear }) do
|
||||
@@ -503,6 +504,28 @@ end, game, { phase = "pressed",
|
||||
y = overlayGameRect.y + overlayGameRect.height / 2 })
|
||||
T.eq(pointerPasses, 2,
|
||||
"the smaller Game overlay keeps native pointer input")
|
||||
overlayPressed = true
|
||||
run.loader.hooks:call("input.step", function() end, game, 1 / 60)
|
||||
local hiddenGameRect = run.loader.hooks:call("render.viewport", function(ctx)
|
||||
return { x = 0, y = 0, width = ctx.width, height = ctx.height }
|
||||
end, { width = 1280, height = 720, generation = 1 })
|
||||
local hiddenGameDraws = {}
|
||||
T.love.graphics.draw = function(image, ...)
|
||||
hiddenGameDraws[#hiddenGameDraws + 1] = image
|
||||
end
|
||||
run.loader.hooks:call("render.window", function(_, context)
|
||||
T.love.graphics.draw(context.canvas, context.x, context.y)
|
||||
end, game, {
|
||||
canvas = T.love.graphics.newCanvas(hiddenGameRect.width, hiddenGameRect.height),
|
||||
x = hiddenGameRect.x, y = hiddenGameRect.y,
|
||||
width = hiddenGameRect.width, height = hiddenGameRect.height,
|
||||
windowWidth = 1280, windowHeight = 720, generation = 1,
|
||||
})
|
||||
T.love.graphics.draw = outputDraw
|
||||
T.eq(#hiddenGameDraws, 1,
|
||||
"hidden Gear-first overlay never presents the captured Game frame")
|
||||
overlayPressed = false
|
||||
run.loader.hooks:call("input.step", function() end, game, 1 / 60)
|
||||
run.loader.modOptions.kanto_gear = {
|
||||
display_mode = "fullscreen", fullscreen_start = "game",
|
||||
screen_swap = false,
|
||||
|
||||
Reference in New Issue
Block a user