[−][src]Module vxdraw::dyntex
Methods and types to control dynamic textures
A dynamic texture is a texture from which you can spawn sprites. The dynamic
part of the name
refers to the sprites. A sprite is a rectangular view into the texture. The sprites can be
changed freely during runtime. This allows movement of sprites, animations, and warping of
their form.
Example - Drawing a sprite
use cgmath::{prelude::*, Deg, Matrix4}; use vxdraw::{dyntex::{ImgData, LayerOptions, Sprite}, void_logger, ShowWindow, VxDraw}; fn main() { static TESTURE: &ImgData = &ImgData::PNGBytes(include_bytes!["../images/testure.png"]); #[cfg(feature = "doctest-headless")] let mut vx = VxDraw::new(void_logger(), ShowWindow::Headless1k); #[cfg(not(feature = "doctest-headless"))] let mut vx = VxDraw::new(void_logger(), ShowWindow::Enable); let mut dyntex = vx.dyntex(); let tex = dyntex.add_layer(TESTURE, &LayerOptions::new()); vx.dyntex().add(&tex, Sprite::new().scale(0.5)); vx.draw_frame(); #[cfg(not(feature = "doctest-headless"))] std::thread::sleep(std::time::Duration::new(3, 0)); }
Structs
Dyntex | Accessor object to all dynamic textures |
Handle | A view into a texture (a sprite) |
Layer | Handle to a layer (a single texture) |
LayerOptions | Options for creating a layer of a dynamic texture with sprites |
Sprite | Sprite creation builder |
Enums
Filter | Specify filter options |
ImgData | Specify the type of incoming texture data |
WrapMode | Specify texture wrapping mode |