[−][src]Struct crystal_engine::GameState
Contains the game state. This struct is passed to Game::init and Game::update.
Fields
camera: Matrix4<f32>
The matrix of the camera currently in use.
It is currently not possible to change the near and far boundaries of the camera. This might be added in a later version.
keyboard: KeyboardState
Get the current keyboard state.
light: LightState
The state of the lights currently in the world.
Implementations
impl GameState
[src]
pub fn window(&self) -> &Window
[src]
Get a reference to the winit window. This can be used to set the title with set_title
, grap the cursor with set_cursor_grab
and set_cursor_visible
, and more.
pub fn set_cursor_position<P: Pixel>(&self, position: (P, P))
[src]
Set the cursor position. This is short for:
state.window() .set_cursor_position(winit::dpi::PhysicalPosition::new(0u32, 0u32)) .unwrap();
Platform-specific
On iOS this always returns an error, so this function is empty
pub fn terminate_game(&mut self)
[src]
Exit the game. Once this function is called, it cannot be cancelled. This does not confirm with Game::can_shutdown.
pub fn new_triangle_model(&mut self) -> ModelBuilder
[src]
Create a new triangle at the origin of the world.
See ModelHandle for information on how to move, rotate and clone the triangle.
Note: you must store the handle somewhere. When the handle is dropped, the rectangle is removed from your world and resources are unloaded.
Example
let triangle: ModelHandle = game_state.new_triangle_model() .build();
pub fn new_rectangle_model(&mut self) -> ModelBuilder
[src]
Create a new rectangle at the origin of the world. This can be useful to render simple textures in the world.
See ModelHandle for information on how to move, rotate and clone the rectangle.
Note: you must store the handle somewhere. When the handle is dropped, the rectangle is removed from your world and resources are unloaded.
Example
let rust_logo: ModelHandle = game_state.new_rectangle_model() .with_texture_from_file("assets/rust_logo.png") .build();
pub fn new_obj_model<'a>(&'a mut self, path: &'a str) -> ModelBuilder<'a>
[src]
Load a model from the given path and place it at the origin of the world. See ModelHandle for information on how to move, rotate and clone the model.
This method is only available when the format-obj
feature is enabled.
pub fn new_fbx_model<'a>(&'a mut self, path: &'a str) -> ModelBuilder<'a>
[src]
Load a model from the given path and place it at the origin of the world. See ModelHandle for information on how to move, rotate and clone the model.
This method is only available when the format-fbx
feature is enabled.
Auto Trait Implementations
impl !RefUnwindSafe for GameState
impl !Send for GameState
impl !Sync for GameState
impl Unpin for GameState
impl !UnwindSafe for GameState
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) -> Option<*mut T>
[src]
fn is_size_suitable(size: usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SafeBorrow<T> for T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,