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:
1 parent
8c33051913
commit
5f70992cfb
2 files changed
+16
-2
No files matched your search
+15
-2
@@ -332,6 +332,15 @@ fn earth_px(x: i32, y: i32, v: u32) -> Color {
|
|||||||
shade(base, (big + fine) as i32)
|
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
|
// ---- 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/
|
// (the page keeps its colours), 64x64 and 16x16; see art/generated/textures/materials/
|
||||||
macro_rules! material {
|
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) {
|
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(
|
draw_texture_ex(
|
||||||
&self.atlas,
|
tex,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
color,
|
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() },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -481,6 +481,7 @@ fn apply_settings(s: &Settings, r3d: &mut R3d) {
|
|||||||
r3d.max_lights = s.max_lights as usize;
|
r3d.max_lights = s.max_lights as usize;
|
||||||
r3d.pixel_rows = settings::pixel_rows(s.pixel_rows);
|
r3d.pixel_rows = settings::pixel_rows(s.pixel_rows);
|
||||||
holiday::set_override(s.debug_holiday);
|
holiday::set_override(s.debug_holiday);
|
||||||
|
gfx::set_high_res_ui(r3d.pixel_rows >= settings::HIGH_RES_ROWS as u32);
|
||||||
audio::set_volumes(s.music_volume, s.volume, s.muted);
|
audio::set_volumes(s.music_volume, s.volume, s.muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user