Struct pixel_engine::Engine
source · pub struct Engine {
pub title: String,
pub size: (u32, u32, u32),
pub elapsed: f64,
/* private fields */
}
Expand description
Bone of the Engine, join everything;
Fields§
§title: String
Main title of the window, Window’s full title will be “Title - fps”
size: (u32, u32, u32)
Size of the window, with (x-size,y-size,pixel-size)
elapsed: f64
Time between current frame and last frame, usefull for movement’s calculations
Implementations§
source§impl Engine
impl Engine
sourcepub fn get_mouse_btn(&self, btn: MouseBtn) -> Input
pub fn get_mouse_btn(&self, btn: MouseBtn) -> Input
Get the status of a Mouse Button
sourcepub fn get_mouse_location(&self) -> (u32, u32)
pub fn get_mouse_location(&self) -> (u32, u32)
Get the mouse location (in pixel) on the screen Will be defaulted to (0,0) at the start of the program
sourcepub fn get_mouse_wheel(&self) -> MouseWheel
pub fn get_mouse_wheel(&self) -> MouseWheel
Get the scroll wheel direction (If Any) during the frame
sourcepub fn get_pressed(&self) -> HashSet<Keycodes>
pub fn get_pressed(&self) -> HashSet<Keycodes>
Get all Keys pressed during the last frame
sourcepub fn create_decal(&mut self, sprite: &Sprite) -> Decal
pub fn create_decal(&mut self, sprite: &Sprite) -> Decal
Create a GPU version of Sprite
sourcepub fn destroy_decal(&mut self, decal: &Decal)
pub fn destroy_decal(&mut self, decal: &Decal)
Tell the GPU to destroy everything related to that Decal
it takes the decal by reference since it is not possible to pass by value.
trying to draw the decal afterwards will just not render anything, but may affect
performance if you try to draw lots of “zombie” decals
Trait Implementations§
source§impl DecalDraw for Engine
impl DecalDraw for Engine
source§fn draw_explicit_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
uv: [P; 4],
decal: &Decal,
tint: Color
)
fn draw_explicit_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
uv: [P; 4],
decal: &Decal,
tint: Color
)
source§fn draw_decal<P: Into<Vf2d> + Copy>(&mut self, pos: P, decal: &Decal)
fn draw_decal<P: Into<Vf2d> + Copy>(&mut self, pos: P, decal: &Decal)
source§fn draw_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
scale: P
)
fn draw_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
scale: P
)
source§fn draw_partial_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P
)
fn draw_partial_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P
)
source§fn draw_partial_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P,
scale: P
)
fn draw_partial_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P,
scale: P
)
source§fn draw_warped_decal<P: Into<Vf2d> + Copy>(&mut self, pos: [P; 4], decal: &Decal)
fn draw_warped_decal<P: Into<Vf2d> + Copy>(&mut self, pos: [P; 4], decal: &Decal)
source§fn draw_warped_partial_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
source_pos: P,
source_size: P,
decal: &Decal
)
fn draw_warped_partial_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
source_pos: P,
source_size: P,
decal: &Decal
)
source§fn draw_rotated_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P
)
fn draw_rotated_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P
)
angle
radians around center
center is an offset in pixel from the top left corner of the decal Read moresource§fn draw_rotated_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P,
scale: P
)
fn draw_rotated_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P,
scale: P
)
draw_rotated_decal
but with scalingsource§fn draw_partial_rotated_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P,
source_pos: P,
source_size: P
)
fn draw_partial_rotated_decal<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P,
source_pos: P,
source_size: P
)
source§fn draw_partial_rotated_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P,
source_pos: P,
source_size: P,
scaled: P
)
fn draw_partial_rotated_decal_scaled<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
angle: f32,
center: P,
source_pos: P,
source_size: P,
scaled: P
)
source§fn draw_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
tint: Color
)
fn draw_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
tint: Color
)
source§fn draw_decal_scaled_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
scale: P,
tint: Color
)
fn draw_decal_scaled_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
scale: P,
tint: Color
)
source§fn draw_partial_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P,
tint: Color
)
fn draw_partial_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P,
tint: Color
)
source§fn draw_partial_decal_scaled_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P,
scale: P,
tint: Color
)
fn draw_partial_decal_scaled_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
source_pos: P,
source_size: P,
scale: P,
tint: Color
)
source§fn draw_warped_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
decal: &Decal,
tint: Color
)
fn draw_warped_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
decal: &Decal,
tint: Color
)
source§fn draw_warped_partial_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
source_pos: P,
source_size: P,
decal: &Decal,
tint: Color
)
fn draw_warped_partial_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: [P; 4],
source_pos: P,
source_size: P,
decal: &Decal,
tint: Color
)
source§fn draw_rotated_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
center: P,
angle: f32,
tint: Color
)
fn draw_rotated_decal_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
center: P,
angle: f32,
tint: Color
)
source§fn draw_rotated_decal_scaled_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
center: P,
angle: f32,
scale: P,
tint: Color
)
fn draw_rotated_decal_scaled_tinted<P: Into<Vf2d> + Copy>(
&mut self,
pos: P,
decal: &Decal,
center: P,
angle: f32,
scale: P,
tint: Color
)
source§impl DrawSpriteTrait for Engine
impl DrawSpriteTrait for Engine
source§impl SmartDrawingTrait for Engine
impl SmartDrawingTrait for Engine
source§fn set_pixel_mode(&mut self, mode: PixelMode)
fn set_pixel_mode(&mut self, mode: PixelMode)
PixelMode
source§fn get_pixel<P: Into<Vi2d>>(&self, pos: P) -> Option<Color>
fn get_pixel<P: Into<Vi2d>>(&self, pos: P) -> Option<Color>
source§fn set_blend_factor(&mut self, f: f32)
fn set_blend_factor(&mut self, f: f32)
source§fn get_textsheet(&self) -> &'static Sprite
fn get_textsheet(&self) -> &'static Sprite
Sprite
)source§fn get_pixel_mode(&self) -> PixelMode
fn get_pixel_mode(&self) -> PixelMode
PixelMode
source§fn get_blend_factor(&self) -> f32
fn get_blend_factor(&self) -> f32
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !Send for Engine
impl !Sync for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
Blanket Implementations§
source§impl<T> DottedShapeTrait for Twhere
T: SmartDrawingTrait,
impl<T> DottedShapeTrait for Twhere
T: SmartDrawingTrait,
source§fn draw_line_dotted<P>(&mut self, p1: P, p2: P, col: Color, pattern: u32)where
P: Into<Vec2d<i32>>,
fn draw_line_dotted<P>(&mut self, p1: P, p2: P, col: Color, pattern: u32)where
P: Into<Vec2d<i32>>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ShapesTrait for Twhere
T: SmartDrawingTrait,
impl<T> ShapesTrait for Twhere
T: SmartDrawingTrait,
source§fn draw_text<P>(&mut self, pos: P, scale: u32, col: Color, text: &str)where
P: Into<Vec2d<i32>>,
fn draw_text<P>(&mut self, pos: P, scale: u32, col: Color, text: &str)where
P: Into<Vec2d<i32>>,
scale
must be >= 1
The textsize will be equal to scale * 8
for the height and scale * 8 * text.len()
for
the width
This will handle \n
treating it as a new line, but wont do any newline stuff if it is
drawing out of the screen Read moresource§fn draw_line<P>(&mut self, p1: P, p2: P, col: Color)where
P: Into<Vec2d<i32>>,
fn draw_line<P>(&mut self, p1: P, p2: P, col: Color)where
P: Into<Vec2d<i32>>,
source§fn draw_rect<P>(&mut self, pos: P, size: P, col: Color)where
P: Into<Vec2d<i32>>,
fn draw_rect<P>(&mut self, pos: P, size: P, col: Color)where
P: Into<Vec2d<i32>>,
(x, y)
and the bottom right corner at (x + w, y + h)
(both inclusive) Read moresource§fn fill_rect<P>(&mut self, pos: P, size: P, col: Color)where
P: Into<Vec2d<i32>>,
fn fill_rect<P>(&mut self, pos: P, size: P, col: Color)where
P: Into<Vec2d<i32>>,
(x, y)
and the bottom right corner at (x + w, y + h)
(both inclusive) Read moresource§fn draw_circle<P>(&mut self, pos: P, r: u32, col: Color)where
P: Into<Vec2d<i32>>,
fn draw_circle<P>(&mut self, pos: P, r: u32, col: Color)where
P: Into<Vec2d<i32>>,
(x, y)
and raduis r
source§fn fill_circle<P>(&mut self, pos: P, r: u32, col: Color)where
P: Into<Vec2d<i32>>,
fn fill_circle<P>(&mut self, pos: P, r: u32, col: Color)where
P: Into<Vec2d<i32>>,
(x, y)
and raduis r
source§impl<T> SpriteTrait for Twhere
T: SmartDrawingTrait,
impl<T> SpriteTrait for Twhere
T: SmartDrawingTrait,
source§fn draw_sprite<P>(
&mut self,
pos: P,
scale: u32,
sprite: &Sprite,
flip: (bool, bool)
)where
P: Into<Vec2d<i32>>,
fn draw_sprite<P>(
&mut self,
pos: P,
scale: u32,
sprite: &Sprite,
flip: (bool, bool)
)where
P: Into<Vec2d<i32>>,
(x, y)
the flip arguement will allow fliping of the axis
flip: (horizontal, vertical)
scale is the scale of the result (must be >= 1) Read moresource§fn draw_partial_sprite<P>(
&mut self,
coords: P,
sprite: &Sprite,
o: P,
size: P,
scale: u32,
flip: (bool, bool)
)where
P: Into<Vec2d<i32>>,
fn draw_partial_sprite<P>(
&mut self,
coords: P,
sprite: &Sprite,
o: P,
size: P,
scale: u32,
flip: (bool, bool)
)where
P: Into<Vec2d<i32>>,
Sprite
onto the Target
coords
is the top left corner of the Target
o
is the Top left corner of the Sprite Chunk
and size
is the (width, height)
of the chunk
flip
and scale
is the same as SpriteTrait::draw_sprite()
Read more