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
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
)
Draw A decal with given position and uv (You probably don’t want to use this)
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)
Draw a decal from the given position
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
)
Draw a decal with a given scale
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
)
Draw a partial decal from the given position
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
)
Draw a partial decal with a given scale
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)
Draw a decal where all Corner are given, this will set the uv correctly to allow texture
warping
The points are in order: Read more
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
)
Draw a decal where all Corner are given, this will set the uv correctly to allow texture
warping
The points are in order: Read more
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
)
Draw a decal rotated
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
)
Same as
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
)
Draw a zone of a decal and rotate it
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
)
Draw a zone of a decal, rotate it and scaled it
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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
)
Same as the non tinted variant, but with an tint color parameter
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)
Set the
PixelMode
source§fn get_pixel<P: Into<Vi2d>>(&self, pos: P) -> Option<Color>
fn get_pixel<P: Into<Vi2d>>(&self, pos: P) -> Option<Color>
Get the Pixel Data at the given coordinates
source§fn set_blend_factor(&mut self, f: f32)
fn set_blend_factor(&mut self, f: f32)
Set the Blend Factor
Used for alpha calculations Read more
source§fn get_textsheet(&self) -> &'static Sprite
fn get_textsheet(&self) -> &'static Sprite
Get The textsheet (A
Sprite
)source§fn get_pixel_mode(&self) -> PixelMode
fn get_pixel_mode(&self) -> PixelMode
Return the
PixelMode
source§fn get_blend_factor(&self) -> f32
fn get_blend_factor(&self) -> f32
Get the Blend Factor
Used for alpha calculations Read more
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>>,
Draw a dotted line
§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>>,
Draw text to the screen
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>>,
Draw a line between two points,
You don’t need to do anything with the points for it to work, it will swap them it needed. Read more
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>>,
Draw a rectangle with the top left corner at
(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>>,
Fill a rectangle with the top left corner at
(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>>,
Draw a circle with center
(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>>,
Fill a circle with center
(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>>,
Draw a Sprite with the top left corner at
(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>>,
Draw a chunk of the given
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