High-res: bestiary shows the detailed sprites, toolbar buttons on stone
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ffad92b641
commit
0ada04f4fb
3 files changed
+23
-2
No files matched your search
@@ -343,6 +343,10 @@ pub fn set_high_res_ui(on: bool) {
|
||||
HIGH_RES_UI.with(|h| h.set(on));
|
||||
}
|
||||
|
||||
pub fn high_res_ui() -> bool {
|
||||
HIGH_RES_UI.with(|h| h.get())
|
||||
}
|
||||
|
||||
// ---- 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 {
|
||||
|
||||
+11
-1
@@ -305,8 +305,18 @@ impl Menu {
|
||||
}
|
||||
}
|
||||
|
||||
// a unit sprite with the gear of a level, scaled up
|
||||
// a unit sprite with the gear of a level, scaled up; the high-res style shows the detailed
|
||||
// sprite (front view, 64x64 level; without the gear)
|
||||
fn draw_sprite(gfx: &Gfx, kind: EK, level: u32, x: f32, y: f32, size: f32) {
|
||||
if crate::gfx::high_res_ui() {
|
||||
if let Some(pic) = Gfx::hd_picture(kind, 0, None, false) {
|
||||
let uv = Gfx::hd_uv(pic, true);
|
||||
let (w, h) = crate::gfx::hd_tex_size(true);
|
||||
let src = Rect::new(uv.x * w as f32, uv.y * h as f32, uv.w * w as f32, uv.h * h as f32);
|
||||
draw_texture_ex(&gfx.hd_sprites, x, y, WHITE, DrawTextureParams { source: Some(src), dest_size: Some(vec2(size, size)), ..Default::default() });
|
||||
return;
|
||||
}
|
||||
}
|
||||
let src = Gfx::sprite_cell(kind, false, level);
|
||||
draw_texture_ex(&gfx.sprites, x, y, WHITE, DrawTextureParams { source: Some(src), dest_size: Some(vec2(size, size)), ..Default::default() });
|
||||
}
|
||||
@@ -912,7 +912,14 @@ impl Ui {
|
||||
// locked tools (campaign: not yet available) are drawn dark
|
||||
let tool_button = |bx: f32, by: f32, bw: f32, icon_id: u32, key: &str, label: &str, sel: bool, hovered: bool, locked: bool| {
|
||||
let r = Rect::new(bx + px, by, bw - 2.0 * px, 3.0 * CH());
|
||||
draw_rectangle(r.x, r.y, r.w, r.h, if sel { Color::new(0.42, 0.26, 0.1, 1.0) } else if hovered { Color::new(0.18, 0.13, 0.1, 1.0) } else { Color::new(0.1, 0.07, 0.07, 1.0) });
|
||||
let fill = if sel { Color::new(0.42, 0.26, 0.1, 1.0) } else if hovered { Color::new(0.18, 0.13, 0.1, 1.0) } else { Color::new(0.1, 0.07, 0.07, 1.0) };
|
||||
if crate::gfx::high_res_ui() {
|
||||
// high-res: a slab of stone in the button's colour (the material is light grey)
|
||||
let k = 1.6;
|
||||
draw_texture_ex(&gfx.materials[1], r.x, r.y, Color::new(fill.r * k, fill.g * k, fill.b * k, 1.0), DrawTextureParams { dest_size: Some(vec2(r.w, r.h)), ..Default::default() });
|
||||
} else {
|
||||
draw_rectangle(r.x, r.y, r.w, r.h, fill);
|
||||
}
|
||||
// the active tool: pulsing frame
|
||||
let frame = if sel { if pulse { WHITE } else { FRAME_HI } } else { Color::new(0.35, 0.28, 0.2, 1.0) };
|
||||
draw_rectangle_lines(r.x, r.y, r.w, r.h, if sel { 3.0 * px } else { 2.0 * px }, frame);
|
||||
|
||||
Reference in new issue
Block a user