[][src]Struct raylib::core::RaylibHandle

pub struct RaylibHandle(_);

The main interface into the Raylib API.

This is the way in which you will use the vast majority of Raylib's functionality. A RaylibHandle can be constructed using the init_window function or through a RaylibBuilder obtained with the init function.

Methods

impl RaylibHandle[src]

pub fn set_camera_mode(&mut self, camera: impl Into<Camera3D>, mode: CameraMode)[src]

Sets camera mode.

pub fn update_camera(&self, camera: &mut Camera3D)[src]

Updates camera position for selected mode.

pub fn set_camera_pan_control(&mut self, pan_key: KeyboardKey)[src]

Sets camera pan key to combine with mouse movement (free camera).

pub fn set_camera_alt_control(&mut self, alt_key: KeyboardKey)[src]

Sets camera alt key to combine with mouse movement (free camera).

pub fn set_camera_smooth_zoom_control(&mut self, sz_key: KeyboardKey)[src]

Sets camera smooth zoom key to combine with mouse (free camera).

pub fn set_camera_move_controls(
    &mut self,
    front_key: KeyboardKey,
    back_key: KeyboardKey,
    right_key: KeyboardKey,
    left_key: KeyboardKey,
    up_key: KeyboardKey,
    down_key: KeyboardKey
)
[src]

Sets camera move controls (1st person and 3rd person cameras).

impl RaylibHandle[src]

Seems like all draw commands must be issued from the main thread

pub fn begin_drawing(&mut self, _: &RaylibThread) -> RaylibDrawHandle[src]

Setup canvas (framebuffer) to start drawing

impl RaylibHandle[src]

pub fn is_key_pressed(&self, key: KeyboardKey) -> bool[src]

Detect if a key has been pressed once.

pub fn is_key_down(&self, key: KeyboardKey) -> bool[src]

Detect if a key is being pressed.

pub fn is_key_released(&self, key: KeyboardKey) -> bool[src]

Detect if a key has been released once.

pub fn is_key_up(&self, key: KeyboardKey) -> bool[src]

Detect if a key is NOT being pressed.

pub fn get_key_pressed(&self) -> Option<KeyboardKey>[src]

Gets latest key pressed.

pub fn get_key_pressed_number(&self) -> Option<u32>[src]

Gets latest key pressed.

pub fn set_exit_key(&mut self, key: Option<KeyboardKey>)[src]

Sets a custom key to exit program (default is ESC).

pub fn is_gamepad_available(&self, gamepad: u32) -> bool[src]

Detect if a gamepad is available.

pub fn is_gamepad_name(&self, gamepad: u32, name: &str) -> bool[src]

Checks gamepad name (if available).

pub fn get_gamepad_name(&self, gamepad: u32) -> Option<String>[src]

Returns gamepad internal name id.

pub fn is_gamepad_button_pressed(
    &self,
    gamepad: u32,
    button: GamepadButton
) -> bool
[src]

Detect if a gamepad button has been pressed once.

pub fn is_gamepad_button_down(
    &self,
    gamepad: u32,
    button: GamepadButton
) -> bool
[src]

Detect if a gamepad button is being pressed.

pub fn is_gamepad_button_released(
    &self,
    gamepad: u32,
    button: GamepadButton
) -> bool
[src]

Detect if a gamepad button has been released once.

pub fn is_gamepad_button_up(&self, gamepad: u32, button: GamepadButton) -> bool[src]

Detect if a gamepad button is NOT being pressed.

pub fn get_gamepad_button_pressed(&self) -> Option<GamepadButton>[src]

Gets the last gamepad button pressed.

pub fn get_gamepad_axis_count(&self, gamepad: u32) -> i32[src]

Returns gamepad axis count for a gamepad.

pub fn get_gamepad_axis_movement(&self, gamepad: u32, axis: u32) -> f32[src]

Returns axis movement value for a gamepad axis.

pub fn is_mouse_button_pressed(&self, button: MouseButton) -> bool[src]

Detect if a mouse button has been pressed once.

pub fn is_mouse_button_down(&self, button: MouseButton) -> bool[src]

Detect if a mouse button is being pressed.

pub fn is_mouse_button_released(&self, button: MouseButton) -> bool[src]

Detect if a mouse button has been released once.

pub fn is_mouse_button_up(&self, button: MouseButton) -> bool[src]

Detect if a mouse button is NOT being pressed.

pub fn get_mouse_x(&self) -> i32[src]

Returns mouse position X.

pub fn get_mouse_y(&self) -> i32[src]

Returns mouse position Y.

pub fn get_mouse_position(&self) -> Vector2[src]

Returns mouse position.

pub fn set_mouse_position(&mut self, position: impl Into<Vector2>)[src]

Sets mouse position.

pub fn set_mouse_scale(&mut self, scale_x: f32, scale_y: f32)[src]

Sets mouse scaling.

pub fn get_mouse_wheel_move(&self) -> i32[src]

Returns mouse wheel movement Y.

pub fn get_touch_x(&self) -> i32[src]

Returns touch position X for touch point 0 (relative to screen size).

pub fn get_touch_y(&self) -> i32[src]

Returns touch position Y for touch point 0 (relative to screen size).

pub fn get_touch_position(&self, index: u32) -> Vector2[src]

Returns touch position XY for a touch point index (relative to screen size).

pub fn set_gestures_enabled(&self, gesture_flags: u32)[src]

Enables a set of gestures using flags.

pub fn is_gesture_detected(&self, gesture: GestureType) -> bool[src]

Checks if a gesture have been detected.

pub fn get_gesture_detected(&self) -> u32[src]

Gets latest detected gesture.

pub fn get_touch_points_count(&self) -> u32[src]

Gets touch points count.

pub fn get_gesture_hold_duration(&self) -> f32[src]

Gets gesture hold time in milliseconds.

pub fn get_gesture_drag_vector(&self) -> Vector2[src]

Gets gesture drag vector.

pub fn get_gesture_drag_angle(&self) -> f32[src]

Gets gesture drag angle.

pub fn get_gesture_pinch_vector(&self) -> Vector2[src]

Gets gesture pinch delta.

pub fn get_gesture_pinch_angle(&self) -> f32[src]

Gets gesture pinch angle.

impl RaylibHandle[src]

pub fn get_screen_data(&mut self, _: &RaylibThread) -> Image[src]

pub fn take_screenshot(&mut self, _: &RaylibThread, filename: &str)[src]

Takes a screenshot of current screen (saved a .png)

impl RaylibHandle[src]

pub fn load_model(
    &mut self,
    _: &RaylibThread,
    filename: &str
) -> Result<Model, String>
[src]

Loads model from files (mesh and material).

impl RaylibHandle[src]

pub fn load_meshes(
    &mut self,
    _: &RaylibThread,
    filename: &str
) -> Result<Vec<Mesh>, String>
[src]

Load meshes from model file

impl RaylibHandle[src]

pub fn load_shader(
    &mut self,
    _: &RaylibThread,
    vs_filename: Option<&str>,
    fs_filename: Option<&str>
) -> Result<Shader, String>
[src]

Loads a custom shader and binds default locations.

pub fn load_shader_code(
    &mut self,
    _: &RaylibThread,
    vs_code: Option<&str>,
    fs_code: Option<&str>
) -> Shader
[src]

Loads shader from code strings and binds default locations.

impl RaylibHandle[src]

pub fn set_matrix_projection(&mut self, _: &RaylibThread, proj: Matrix)[src]

Sets a custom projection matrix (replaces internal projection matrix).

pub fn set_matrix_modelview(&mut self, _: &RaylibThread, view: Matrix)[src]

Sets a custom modelview matrix (replaces internal modelview matrix).

pub fn get_matrix_modelview(&self) -> Matrix[src]

Gets internal modelview matrix.

impl RaylibHandle[src]

pub fn storage_save_value(&mut self, position: i32, value: i32)[src]

Saves integer value to storage file (to defined position).

pub fn storage_load_value(&self, position: i32) -> i32[src]

Loads integer value from storage file (from defined position).

impl RaylibHandle[src]

pub fn unload_font(&mut self, font: WeakFont)[src]

pub fn load_font(
    &mut self,
    _: &RaylibThread,
    filename: &str
) -> Result<Font, String>
[src]

Loads font from file into GPU memory (VRAM).

pub fn load_font_ex(
    &mut self,
    _: &RaylibThread,
    filename: &str,
    font_size: i32,
    chars: FontLoadEx
) -> Result<Font, String>
[src]

Loads font from file with extended parameters.

pub fn load_font_from_image(
    &mut self,
    _: &RaylibThread,
    image: &Image,
    key: impl Into<Color>,
    first_char: i32
) -> Result<Font, String>
[src]

Load font from Image (XNA style)

pub fn load_font_data(
    &mut self,
    filename: &str,
    font_size: i32,
    chars: Option<&[i32]>,
    sdf: i32
) -> Vec<CharInfo>
[src]

Loads font data for further use (see also Font::from_data).

impl RaylibHandle[src]

pub fn get_font_default(&self) -> WeakFont[src]

Gets the default font.

impl RaylibHandle[src]

pub fn load_texture(
    &mut self,
    _: &RaylibThread,
    filename: &str
) -> Result<Texture2D, String>
[src]

Loads texture from file into GPU memory (VRAM).

pub fn load_texture_from_image(
    &mut self,
    _: &RaylibThread,
    image: &Image
) -> Result<Texture2D, String>
[src]

Loads texture from image data.

pub fn load_render_texture(
    &mut self,
    _: &RaylibThread,
    width: u32,
    height: u32
) -> Result<RenderTexture2D, String>
[src]

Loads texture for rendering (framebuffer).

impl RaylibHandle[src]

pub fn get_clipboard_text(&self) -> Result<String, Utf8Error>[src]

Get clipboard text content

pub fn set_clipboard_text(&mut self, text: &str) -> Result<(), NulError>[src]

Set clipboard text content

impl RaylibHandle[src]

pub fn get_mouse_ray(
    &self,
    mouse_position: impl Into<Vector2>,
    camera: impl Into<Camera>
) -> Ray
[src]

Returns a ray trace from mouse position

pub fn get_world_to_screen(
    &self,
    position: impl Into<Vector3>,
    camera: impl Into<Camera>
) -> Vector2
[src]

Returns the screen space position for a 3d world space position

impl RaylibHandle[src]

pub fn set_target_fps(&mut self, fps: u32)[src]

Set target FPS (maximum)

pub fn get_fps(&self) -> u32[src]

Returns current FPS

pub fn get_frame_time(&self) -> f32[src]

Returns time in seconds for last frame drawn

pub fn get_time(&self) -> f64[src]

Returns elapsed time in seconds since InitWindow()

impl RaylibHandle[src]

pub fn window_should_close(&self) -> bool[src]

Checks if KEY_ESCAPE or Close icon was pressed.

pub fn is_window_ready(&self) -> bool[src]

Checks if window has been initialized successfully.

pub fn is_window_minimized(&self) -> bool[src]

Checks if window has been minimized (or lost focus).

pub fn is_window_resized(&self) -> bool[src]

Checks if window has been resized.

pub fn is_window_hidden(&self) -> bool[src]

Checks if window has been hidden.

pub fn toggle_fullscreen(&mut self)[src]

Toggles fullscreen mode (only on desktop platforms).

pub fn unhide_window(&mut self)[src]

Show the window.

pub fn hide_window(&mut self)[src]

Hide the window.

pub fn set_window_title(&self, _: &RaylibThread, title: &str)[src]

TODO uncomment this when imaging is up Sets title for window (only on desktop platforms).

pub fn set_window_position(&mut self, x: i32, y: i32)[src]

Sets window position on screen (only on desktop platforms).

pub fn set_window_monitor(&mut self, monitor: i32)[src]

Sets monitor for the current window (fullscreen mode).

pub fn set_window_min_size(&mut self, width: i32, height: i32)[src]

Sets minimum window dimensions (for FLAG_WINDOW_RESIZABLE).

pub fn set_window_size(&mut self, width: i32, height: i32)[src]

Sets window dimensions.

pub fn get_screen_width(&self) -> i32[src]

Gets current screen width.

pub fn get_screen_height(&self) -> i32[src]

Gets current screen height.

impl RaylibHandle[src]

pub fn show_cursor(&mut self)[src]

Shows mouse cursor.

pub fn hide_cursor(&mut self)[src]

Hides mouse cursor.

pub fn is_cursor_hidden(&self) -> bool[src]

Checks if mouse cursor is not visible.

pub fn enable_cursor(&mut self)[src]

Enables mouse cursor (unlock cursor).

pub fn disable_cursor(&mut self)[src]

Disables mouse cursor (lock cursor).

pub unsafe fn get_window_handle(&mut self) -> *mut c_void[src]

Get the raw window Handle

Trait Implementations

impl Debug for RaylibHandle[src]

impl Drop for RaylibHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.