pub struct Assets { /* private fields */ }Expand description
Gestor de assets (texturas) Nota: La carga de texturas se hace desde RyDit usando raylib directamente
Implementations§
Source§impl Assets
impl Assets
pub fn new() -> Self
Sourcepub fn load_texture_from_path(path: &str) -> Result<Texture2D, String>
pub fn load_texture_from_path(path: &str) -> Result<Texture2D, String>
Cargar textura desde archivo (función estática usando FFI)
Sourcepub fn insert_texture(&mut self, id: String, texture: Texture2D)
pub fn insert_texture(&mut self, id: String, texture: Texture2D)
Insertar textura cargada desde RyDit
Sourcepub fn get_texture(&self, id: &str) -> Option<&Texture2D>
pub fn get_texture(&self, id: &str) -> Option<&Texture2D>
Obtener textura por ID
Sourcepub fn unload_texture(&mut self, id: &str) -> bool
pub fn unload_texture(&mut self, id: &str) -> bool
Descargar textura y liberar memoria
Sourcepub fn draw_texture(
&self,
d: &mut RaylibDrawHandle<'_>,
id: &str,
x: f32,
y: f32,
_w: f32,
_h: f32,
color: Color,
)
pub fn draw_texture( &self, d: &mut RaylibDrawHandle<'_>, id: &str, x: f32, y: f32, _w: f32, _h: f32, color: Color, )
Sourcepub fn draw_texture_scaled(
&self,
d: &mut RaylibDrawHandle<'_>,
id: &str,
x: f32,
y: f32,
scale: f32,
color: Color,
)
pub fn draw_texture_scaled( &self, d: &mut RaylibDrawHandle<'_>, id: &str, x: f32, y: f32, scale: f32, color: Color, )
Dibujar textura escalada
Sourcepub fn draw_texture_ex_by_id(
&self,
d: &mut RaylibDrawHandle<'_>,
id: &str,
x: f32,
y: f32,
scale: f32,
rotation: f32,
color: ColorRydit,
)
pub fn draw_texture_ex_by_id( &self, d: &mut RaylibDrawHandle<'_>, id: &str, x: f32, y: f32, scale: f32, rotation: f32, color: ColorRydit, )
Dibujar textura con rotación y escala (para RenderQueue)
Sourcepub fn draw_texture_rec(
&self,
d: &mut RaylibDrawHandle<'_>,
id: &str,
source: Rectangle,
dest: Rectangle,
color: Color,
)
pub fn draw_texture_rec( &self, d: &mut RaylibDrawHandle<'_>, id: &str, source: Rectangle, dest: Rectangle, color: Color, )
Dibujar rectángulo de textura (para tilesets)
Sourcepub fn has_texture(&self, id: &str) -> bool
pub fn has_texture(&self, id: &str) -> bool
Verificar si existe una textura
Sourcepub fn texture_count(&self) -> usize
pub fn texture_count(&self) -> usize
Cantidad de texturas cargadas
Sourcepub fn load_texture_sdl2<'a>(
path: &str,
texture_creator: &'a TextureCreator<WindowContext>,
) -> Result<Texture<'a>, String>
pub fn load_texture_sdl2<'a>( path: &str, texture_creator: &'a TextureCreator<WindowContext>, ) -> Result<Texture<'a>, String>
Cargar textura SDL2 desde archivo (usando FFI nativo) Retorna la textura que debe ser gestionada por el caller Nota: El lifetime de la textura está ligado al texture_creator
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Assets
impl RefUnwindSafe for Assets
impl Send for Assets
impl Sync for Assets
impl Unpin for Assets
impl UnsafeUnpin for Assets
impl UnwindSafe for Assets
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