diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-25 13:50:09 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-25 13:50:09 +0200 |
commit | ecb6ff15c24841dc08ab8f5c3b347c8080720ac4 (patch) | |
tree | d53db2a61a6151af970f9d27a617d12e0cac7588 /pixel-client/src/render/mod.rs | |
parent | bc210b2632891ca163d31fb57bc0c41769249bf5 (diff) | |
download | hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar.bz2 hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar.zst |
pc: main menu background
Diffstat (limited to 'pixel-client/src/render/mod.rs')
-rw-r--r-- | pixel-client/src/render/mod.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pixel-client/src/render/mod.rs b/pixel-client/src/render/mod.rs index 9b3132f9..74c282f3 100644 --- a/pixel-client/src/render/mod.rs +++ b/pixel-client/src/render/mod.rs @@ -21,6 +21,7 @@ pub mod sprite; use font::FontTextures; use hurrycurry_protocol::glam::Vec2; +use misc::MiscTextures; use sdl2::{ pixels::PixelFormatEnum, rect::{FRect, Rect}, @@ -34,8 +35,10 @@ pub struct Renderer<'a> { metadata: AtlasLayout, font_textures: FontTextures, + pub misc_textures: MiscTextures, pub size: Vec2, + pub ui_size: Vec2, texture: Texture<'a>, world_scale: Vec2, @@ -109,6 +112,8 @@ impl<'a> Renderer<'a> { Self { ui_scale: Vec2::ZERO, + ui_size: Vec2::ZERO, + misc_textures: MiscTextures::init(&atlas_layout), texture, font_textures: FontTextures::init(&atlas_layout), size: Vec2::ONE, @@ -123,6 +128,10 @@ impl<'a> Renderer<'a> { self.world_offset = offset; self.world_scale = Vec2::new(32., 24.) * scale; } + pub fn set_ui_view(&mut self, scale: f32) { + self.ui_scale = Vec2::splat(scale); + self.ui_size = self.size / self.ui_scale; + } pub fn get_world_scale(&self) -> Vec2 { self.world_scale } |