Room and tool buttons draw from the high-res atlas in the high-res style

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-07 22:50:47 +01:00
1 parent 8c33051913
commit 5f70992cfb
2 files changed
+16 -2

No files matched your search

+15 -2
View File
@@ -332,6 +332,15 @@ fn earth_px(x: i32, y: i32, v: u32) -> Color {
shade(base, (big + fine) as i32)
}
thread_local! {
// the interface draws atlas cells from the high-res atlas (the high-res graphics style)
static HIGH_RES_UI: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
}
pub fn set_high_res_ui(on: bool) {
HIGH_RES_UI.with(|h| h.set(on));
}
// ---- furniture materials (crate::props::Mat order): grey detail the furniture's colours tint
// (the page keeps its colours), 64x64 and 16x16; see art/generated/textures/materials/
macro_rules! material {
@@ -2844,13 +2853,17 @@ impl Gfx {
}
}
// an atlas cell in the interface (tool and room buttons); the high-res style shows the
// high-res atlas, so the room buttons show the rooms' new floors
pub fn draw_cell(&self, id: u32, x: f32, y: f32, w: f32, h: f32, color: Color) {
let (tex, k) = if HIGH_RES_UI.with(|h| h.get()) { (&self.atlas_hd, (HD_TILE / 16) as f32) } else { (&self.atlas, 1.0) };
let r = Self::cell(id);
draw_texture_ex(
&self.atlas,
tex,
x,
y,
color,
DrawTextureParams { dest_size: Some(vec2(w, h)), source: Some(Self::cell(id)), ..Default::default() },
DrawTextureParams { dest_size: Some(vec2(w, h)), source: Some(Rect::new(r.x * k, r.y * k, r.w * k, r.h * k)), ..Default::default() },
);
}