[GH-ISSUE #6565] own_background on NativeScreen, for screens that aren't a rectangle #2137

Closed
opened 2026-11-02 15:52:25 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @JuanLuci on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6565

Originally assigned to: @fy2ne on GitHub.

Summary

A field own_background on NativeScreen, so a mod screen that isn't a rectangle can leave out the plain panel Horizon draws under it.

Why

draw_native_screen always fills a black and grey rectangle of width by height, and draws the frames of the inventory's slots over it, before calling native_screen_draw. A mod drawing its own texture covers that up only if the texture is an opaque rectangle of the same size. In Java, an AbstractContainerScreen draws its own background, so plenty of screens aren't: side tabs, side panels, a scrollbar or an upgrades column sticking out of the window. Their see-through corners show Horizon's panel.

width also centres the window, so shrinking the panel to hide the corner moves the screen.

Proposal

  • pub own_background: bool on NativeScreen, beside own_labels. When true, draw_native_screen draws no panel and no slot frames, and the mod's native_screen_draw draws all of it. Slots, clicks, labels and centring stay as they are.
  • Since NativeScreen derives Default, a bundle using ..Default::default() keeps today's look. One writing every field out needs the new one.

On my port

The Storage Terminal of Tom's Simple Storage (tom5454, MIT) has a texture 194 wide: the storage part is that wide because of its scrollbar, and the inventory part below is 176, so the lower right corner is see-through.

Tested on Nightly c9d474d. With width: 194.0, a grey panel with a black border filled that corner, beside the inventory, where the window should have ended. draw_native_screen does the same on main at f8bfa06b9.

The workaround: width: 176.0, with the texture and its scrollbar sticking out of the panel by 18 pixels. It looks right, and the scrollbar still gets its clicks, since native_screen_click runs first. But the window sits 9 pixels off centre, and the workaround only fits a shape whose narrow part is the panel.

Originally created by @JuanLuci on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6565 Originally assigned to: @fy2ne on GitHub. ## Summary A field `own_background` on `NativeScreen`, so a mod screen that isn't a rectangle can leave out the plain panel Horizon draws under it. ## Why `draw_native_screen` always fills a black and grey rectangle of `width` by `height`, and draws the frames of the inventory's slots over it, before calling `native_screen_draw`. A mod drawing its own texture covers that up only if the texture is an opaque rectangle of the same size. In Java, an `AbstractContainerScreen` draws its own background, so plenty of screens aren't: side tabs, side panels, a scrollbar or an upgrades column sticking out of the window. Their see-through corners show Horizon's panel. `width` also centres the window, so shrinking the panel to hide the corner moves the screen. ## Proposal - `pub own_background: bool` on `NativeScreen`, beside `own_labels`. When true, `draw_native_screen` draws no panel and no slot frames, and the mod's `native_screen_draw` draws all of it. Slots, clicks, labels and centring stay as they are. - Since `NativeScreen` derives `Default`, a bundle using `..Default::default()` keeps today's look. One writing every field out needs the new one. ## On my port The Storage Terminal of Tom's Simple Storage (tom5454, MIT) has a texture 194 wide: the storage part is that wide because of its scrollbar, and the inventory part below is 176, so the lower right corner is see-through. Tested on Nightly c9d474d. With `width: 194.0`, a grey panel with a black border filled that corner, beside the inventory, where the window should have ended. `draw_native_screen` does the same on main at f8bfa06b9. The workaround: `width: 176.0`, with the texture and its scrollbar sticking out of the panel by 18 pixels. It looks right, and the scrollbar still gets its clicks, since `native_screen_click` runs first. But the window sits 9 pixels off centre, and the workaround only fits a shape whose narrow part is the panel.
Author
Owner

@fy2ne commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6565723685 --> @fy2ne commented on GitHub (Nov 1, 2026): /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2137
No description provided.