pub struct TextureLoader;Expand description
Asset loader for texture images.
Uses the image crate to decode image files into RGBA8 pixel data.
Supports PNG, JPEG, BMP, TGA, GIF, WebP, ICO, and TIFF formats.
§Example
use goud_engine::assets::{AssetServer, loaders::texture::{TextureLoader, TextureAsset, TextureSettings}};
let mut server = AssetServer::new();
server.register_loader(TextureLoader::default());
// Load with default settings
let texture = server.load::<TextureAsset>("player.png");
// Load with custom settings
let mut settings = TextureSettings::default();
settings.flip_vertical = false;
server.register_loader_with_settings(TextureLoader::default(), settings);Implementations§
Source§impl TextureLoader
impl TextureLoader
Trait Implementations§
Source§impl AssetLoader for TextureLoader
impl AssetLoader for TextureLoader
Source§type Asset = TextureAsset
type Asset = TextureAsset
The type of asset this loader produces.
Source§type Settings = TextureSettings
type Settings = TextureSettings
The settings type for this loader. Read more
Source§fn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
Returns the file extensions supported by this loader. Read more
Source§fn load<'a>(
&'a self,
bytes: &'a [u8],
settings: &'a Self::Settings,
context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, AssetLoadError>
fn load<'a>( &'a self, bytes: &'a [u8], settings: &'a Self::Settings, context: &'a mut LoadContext<'_>, ) -> Result<Self::Asset, AssetLoadError>
Loads an asset from raw bytes. Read more
Source§impl Clone for TextureLoader
impl Clone for TextureLoader
Source§fn clone(&self) -> TextureLoader
fn clone(&self) -> TextureLoader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextureLoader
impl Debug for TextureLoader
Source§impl Default for TextureLoader
impl Default for TextureLoader
Source§fn default() -> TextureLoader
fn default() -> TextureLoader
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TextureLoader
impl RefUnwindSafe for TextureLoader
impl Send for TextureLoader
impl Sync for TextureLoader
impl Unpin for TextureLoader
impl UnsafeUnpin for TextureLoader
impl UnwindSafe for TextureLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().