mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-15 08:12:32 -06:00
refactor: use 'unsafe_textures' sdl2 feature to hide lifetimes & obscure leaks into upstream
This commit is contained in:
@@ -23,7 +23,7 @@ fn f32_to_u8(value: f32) -> u8 {
|
||||
}
|
||||
|
||||
/// Resource to hold the debug texture for persistent rendering
|
||||
pub struct DebugTextureResource(pub Texture<'static>);
|
||||
pub struct DebugTextureResource(pub Texture);
|
||||
|
||||
/// Resource to hold the debug font
|
||||
pub struct DebugFontResource(pub Font<'static, 'static>);
|
||||
|
||||
@@ -100,10 +100,10 @@ pub fn linear_render_system(dt: Res<DeltaTime>, mut query: Query<(&mut LinearAni
|
||||
}
|
||||
|
||||
/// A non-send resource for the map texture. This just wraps the texture with a type so it can be differentiated when exposed as a resource.
|
||||
pub struct MapTextureResource(pub Texture<'static>);
|
||||
pub struct MapTextureResource(pub Texture);
|
||||
|
||||
/// A non-send resource for the backbuffer texture. This just wraps the texture with a type so it can be differentiated when exposed as a resource.
|
||||
pub struct BackbufferResource(pub Texture<'static>);
|
||||
pub struct BackbufferResource(pub Texture);
|
||||
|
||||
/// Renders the HUD (score, lives, etc.) on top of the game.
|
||||
pub fn hud_render_system(
|
||||
|
||||
@@ -79,7 +79,7 @@ impl AtlasTile {
|
||||
/// and optional default color modulation configuration.
|
||||
pub struct SpriteAtlas {
|
||||
/// The combined texture containing all sprite frames
|
||||
texture: Texture<'static>,
|
||||
texture: Texture,
|
||||
/// Mapping from sprite names to their pixel coordinates within the texture
|
||||
tiles: HashMap<String, MapperFrame>,
|
||||
default_color: Option<Color>,
|
||||
@@ -88,7 +88,7 @@ pub struct SpriteAtlas {
|
||||
}
|
||||
|
||||
impl SpriteAtlas {
|
||||
pub fn new(texture: Texture<'static>, mapper: AtlasMapper) -> Self {
|
||||
pub fn new(texture: Texture, mapper: AtlasMapper) -> Self {
|
||||
Self {
|
||||
texture,
|
||||
tiles: mapper.frames,
|
||||
@@ -117,7 +117,7 @@ impl SpriteAtlas {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn texture(&self) -> &Texture<'static> {
|
||||
pub fn texture(&self) -> &Texture {
|
||||
&self.texture
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user