Skip to main content

GenericCompatibleImage

Trait GenericCompatibleImage 

Source
pub trait GenericCompatibleImage: RaylibLoadableImage {
    // Required methods
    fn load_texture(&self, ctx: &mut RaylibDrawContext<'_, '_>);
    fn get_texture(&self, ctx: &RaylibDrawContext<'_, '_>) -> Arc<Texture2D> ;
}
Expand description

Two-phase image draw: optional per-frame setup, then texture lookup from cache.

Required Methods§

Source

fn load_texture(&self, ctx: &mut RaylibDrawContext<'_, '_>)

Called before Self::get_texture during drawing (no-op for path-based types).

Source

fn get_texture(&self, ctx: &RaylibDrawContext<'_, '_>) -> Arc<Texture2D>

Returns the texture to draw. Path-based types read from RaylibDrawContext::image_cache.

§Panics

Panics if image_cache is None or the path was not preloaded.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§