Gamerig Library: its own smooth gradient backdrop under the glass by default
CI / test (push) Successful in 7m13s
CI / test (push) Successful in 7m13s
The desktop wallpaper's logo showing through the cards looked like a glitch. Background now offers Gradient (default: 4 px bands with faint amber and blue glows), Wallpaper and Solid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hgvjzw8hHirxRsXSsE
This commit is contained in:
4 files changed
+49
-7
No files matched your search
@@ -34,8 +34,9 @@ or pick **Gamerig Library** in Settings > Desktop.
|
|||||||
Escape edit the search; the wheel scrolls the grid.
|
Escape edit the search; the wheel scrolls the grid.
|
||||||
* It fits the screen: when the cards don't fit, they get narrower and say less (fewer
|
* It fits the screen: when the cards don't fit, they get narrower and say less (fewer
|
||||||
description and hint lines, then name and buttons only) before the grid would scroll.
|
description and hint lines, then name and buttons only) before the grid would scroll.
|
||||||
* It is the desktop's "wallpaper": panels and cards are glassy and the desktop wallpaper shows
|
* It is the desktop's "wallpaper": panels and cards are glassy over an even gamerig gradient
|
||||||
through. Module settings (right-click the desktop): Background, *Wallpaper* or *Solid*
|
(no pattern or logo behind the cards). Module settings (right-click the desktop): Background,
|
||||||
|
*Gradient* (the default), *Wallpaper* (the desktop wallpaper through the glass) or *Solid*
|
||||||
(gamerig's own background colour); Colours, *Follow desktop* (gamerig dark or light
|
(gamerig's own background colour); Colours, *Follow desktop* (gamerig dark or light
|
||||||
after the desktop theme), *Dark* or *Light*.
|
after the desktop theme), *Dark* or *Light*.
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 175 KiB |
@@ -171,13 +171,20 @@ test "disconnected: says it is waiting, and the error" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
test "nine games fit a 1280x720 desktop without scrolling, and the wallpaper shows through" {
|
test "nine games fit a 1280x720 desktop without scrolling; gradient, wallpaper and solid backdrops" {
|
||||||
let lib = @gamelib.Library::new()
|
let lib = @gamelib.Library::new()
|
||||||
let base = sample_state().games[1]
|
let base = sample_state().games[1]
|
||||||
let games = Array::makei(9, i => { ..base, id: "g" + i.to_string(), featured: i < 2 })
|
let games = Array::makei(9, i => { ..base, id: "g" + i.to_string(), featured: i < 2 })
|
||||||
let ops = lib.render(games, [], @gamelib.Rig::unknown(), { w: 1280, h: 720 }, tokens())
|
let ops = lib.render(games, [], @gamelib.Rig::unknown(), { w: 1280, h: 720 }, tokens())
|
||||||
assert_true(lib.content_h <= lib.view_h, msg="grid \{lib.content_h} > view \{lib.view_h}")
|
assert_true(lib.content_h <= lib.view_h, msg="grid \{lib.content_h} > view \{lib.view_h}")
|
||||||
// No opaque full-screen background in the default Wallpaper mode.
|
// The default Gradient backdrop: even 4 px bands, no full-screen fill.
|
||||||
|
match ops[0] {
|
||||||
|
FillRect(f) => assert_eq(f.rect.h, 4)
|
||||||
|
_ => fail("no gradient")
|
||||||
|
}
|
||||||
|
// Over the desktop wallpaper: no opaque full-screen background.
|
||||||
|
assert_true(lib.set_config("background", "Wallpaper"))
|
||||||
|
let ops = lib.render(games, [], @gamelib.Rig::unknown(), { w: 1280, h: 720 }, tokens())
|
||||||
match ops[0] {
|
match ops[0] {
|
||||||
FillRect(f) => assert_true(f.rect.h != 720 || f.color.a.to_int() < 255)
|
FillRect(f) => assert_true(f.rect.h != 720 || f.color.a.to_int() < 255)
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|||||||
+37
-3
@@ -50,8 +50,9 @@ pub(all) struct ConfigEntry {
|
|||||||
///|
|
///|
|
||||||
pub let colors_choices : Array[String] = ["Follow desktop", "Dark", "Light"]
|
pub let colors_choices : Array[String] = ["Follow desktop", "Dark", "Light"]
|
||||||
|
|
||||||
///| Behind the library: the desktop's wallpaper through glassy panels, or gamerig's solid colour.
|
///| Behind the library: its own smooth gradient under glassy panels, the desktop's wallpaper
|
||||||
pub let background_choices : Array[String] = ["Wallpaper", "Solid"]
|
/// through those panels, or gamerig's solid colour.
|
||||||
|
pub let background_choices : Array[String] = ["Gradient", "Wallpaper", "Solid"]
|
||||||
|
|
||||||
///| Gamerig's colours.
|
///| Gamerig's colours.
|
||||||
pub(all) struct Pal {
|
pub(all) struct Pal {
|
||||||
@@ -158,7 +159,7 @@ pub fn Library::new() -> Library {
|
|||||||
selected: "",
|
selected: "",
|
||||||
focused: false,
|
focused: false,
|
||||||
colors: "Follow desktop",
|
colors: "Follow desktop",
|
||||||
background: "Wallpaper",
|
background: "Gradient",
|
||||||
regions: [],
|
regions: [],
|
||||||
shown: [],
|
shown: [],
|
||||||
content_h: 0,
|
content_h: 0,
|
||||||
@@ -541,6 +542,37 @@ pub fn grid_fit(games : Array[Game], inner_w : Int, inner_h : Int) -> (Array[(In
|
|||||||
last
|
last
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| The library's own backdrop: an even, gently lit gradient with no pattern or text in it, so
|
||||||
|
/// nothing behind the glassy cards reads as a glitch. Bands of 4 px and glows of many faint rings
|
||||||
|
/// keep each step below one colour level.
|
||||||
|
fn draw_gradient(ops : Array[@types.DrawOp], w : Int, h : Int, dark : Bool) -> Unit {
|
||||||
|
let (top, bottom) = if dark {
|
||||||
|
(c(31, 35, 54), c(13, 14, 21))
|
||||||
|
} else {
|
||||||
|
(c(236, 239, 247), c(205, 211, 228))
|
||||||
|
}
|
||||||
|
let band = 4
|
||||||
|
let n = (h + band - 1) / band
|
||||||
|
for i in 0..<n {
|
||||||
|
ops.push(@ui.fill_rect(@ui.rect(0, i * band, w, band), @ui.lerp_color(top, bottom, i, if n > 1 { n - 1 } else { 1 })))
|
||||||
|
}
|
||||||
|
// Two soft glows: gamerig's amber up right, a cool blue down left.
|
||||||
|
let glow = (cx : Int, cy : Int, r : Int, col : @types.Color, a : Int) => {
|
||||||
|
let rings = 24
|
||||||
|
for k in 0..<rings {
|
||||||
|
ops.push(@ui.circle(cx, cy, r - r * k / rings, @ui.with_alpha(col, a)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let big = if w > h { w } else { h }
|
||||||
|
if dark {
|
||||||
|
glow(w * 4 / 5, h / 6, big * 2 / 5, c(246, 183, 46), 1)
|
||||||
|
glow(w / 6, h * 5 / 6, big * 2 / 5, c(80, 110, 220), 2)
|
||||||
|
} else {
|
||||||
|
glow(w * 4 / 5, h / 6, big * 2 / 5, c(246, 183, 46), 2)
|
||||||
|
glow(w / 6, h * 5 / 6, big * 2 / 5, c(120, 150, 240), 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///| Draw the whole library for an output `size`.
|
///| Draw the whole library for an output `size`.
|
||||||
pub fn Library::render(
|
pub fn Library::render(
|
||||||
self : Library,
|
self : Library,
|
||||||
@@ -559,6 +591,8 @@ pub fn Library::render(
|
|||||||
let ops : Array[@types.DrawOp] = []
|
let ops : Array[@types.DrawOp] = []
|
||||||
if self.background == "Solid" {
|
if self.background == "Solid" {
|
||||||
ops.push(@ui.fill_rect(@ui.rect(0, 0, w, h), p.bg))
|
ops.push(@ui.fill_rect(@ui.rect(0, 0, w, h), p.bg))
|
||||||
|
} else if self.background == "Gradient" {
|
||||||
|
draw_gradient(ops, w, h, p.dark)
|
||||||
} else {
|
} else {
|
||||||
// A light veil under the top bar keeps its text readable on any wallpaper.
|
// A light veil under the top bar keeps its text readable on any wallpaper.
|
||||||
ops.push(@ui.fill_rect(@ui.rect(0, 0, w, top_h), @ui.with_alpha(p.panel, 120)))
|
ops.push(@ui.fill_rect(@ui.rect(0, 0, w, top_h), @ui.with_alpha(p.panel, 120)))
|
||||||
|
|||||||
Reference in new issue
Block a user