Struct pixel_engine::Engine
source · Expand description
Bone of the Engine, join everything;
Fields§
§title: String
Main title of the window, Window’s full title will be Title - fps
You can modify it to change the title
elapsed: f64
Time between current frame and last frame, useful 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) -> Vu2d
pub fn get_mouse_location(&self) -> Vu2d
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 get_held(&self) -> HashSet<Keycodes>
pub fn get_held(&self) -> HashSet<Keycodes>
Get all the keys that were held during the last frame
sourcepub fn get_released(&self) -> HashSet<Keycodes>
pub fn get_released(&self) -> HashSet<Keycodes>
Get all the keys that were released 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 clear_input_buffer(&mut self)
pub fn clear_input_buffer(&mut self)
Will clear the input buffer and set the cursor to 0
sourcepub fn set_input_buffer(&mut self, value: impl AsRef<str>)
pub fn set_input_buffer(&mut self, value: impl AsRef<str>)
Set the input buffer to the desired value and put the input cursor at the end of the text
Warning
The value must be an ascii string
sourcepub fn insert_input_buffer(&mut self, value: impl AsRef<str>)
pub fn insert_input_buffer(&mut self, value: impl AsRef<str>)
Insert the given string into the input buffer at the input cursor
Warning
if the string is not only ASCII characters it will silently do nothing
sourcepub fn append_input_buffer(&mut self, value: impl AsRef<str>)
pub fn append_input_buffer(&mut self, value: impl AsRef<str>)
Append the given string onto the input buffer
Warning
if the string is not only ASCII characters it will silently do nothing
sourcepub fn add_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
pub fn add_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
Add keys onto the input pass through list
sourcepub fn remove_input_passthrough(
&mut self,
iterator: impl Iterator<Item = Keycodes>
)
pub fn remove_input_passthrough(
&mut self,
iterator: impl Iterator<Item = Keycodes>
)
Remove keys onto the input pass through list
sourcepub fn set_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
pub fn set_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
Set the input to the iterator
sourcepub fn set_ignore_passthrough_chars(&mut self, val: bool)
pub fn set_ignore_passthrough_chars(&mut self, val: bool)
If set to true, any key that is passed through when in input mode won’t have the char appended to the input buffer
sourcepub fn get_input_buffer(&self) -> &str
pub fn get_input_buffer(&self) -> &str
Return a view into the input buffer
sourcepub fn get_input_cursor(&self) -> usize
pub fn get_input_cursor(&self) -> usize
Return the input cursor
sourcepub fn start_input(&mut self)
pub fn start_input(&mut self)
Switch to text input mode, return true if it wasn’t in this mode before
sourcepub fn force_stop_input_mode(&mut self)
pub fn force_stop_input_mode(&mut self)
This will clear the input buffer, reset the input cursor and stop the input mode
sourcepub fn is_in_input_mode(&self) -> bool
pub fn is_in_input_mode(&self) -> bool
Is the engine in input mode
sourcepub fn end_input_mode(&mut self) -> &str
pub fn end_input_mode(&mut self) -> &str
Stop the input mode right there, and return a &str to the current buffer. This is if you need to leave the mode but retain the input buffer for a later re-entry
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 decalsource§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 draw<P: Into<Vi2d>>(&mut self, pos: P, col: Color)
fn draw<P: Into<Vi2d>>(&mut self, pos: P, col: Color)
PixelMode
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 screensource§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)source§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)source§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)source§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()