Struct raylib::core::RaylibHandle [−][src]
pub struct RaylibHandle(_);
Expand description
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.
Implementations
Sets camera mode.
Updates camera position for selected mode.
Sets camera pan key to combine with mouse movement (free camera).
Sets camera alt key to combine with mouse movement (free camera).
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
)
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
)
Sets camera move controls (1st person and 3rd person cameras).
Seems like all draw commands must be issued from the main thread
Setup canvas (framebuffer) to start drawing
Checks if a file has been dropped into the window.
Gets dropped filenames.
Clears dropped files paths buffer.
Detect if a key has been pressed once.
Detect if a key is being pressed.
Detect if a key has been released once.
Detect if a key is NOT being pressed.
Gets latest key pressed.
Gets latest key pressed.
Sets a custom key to exit program (default is ESC).
Detect if a gamepad is available.
Checks gamepad name (if available).
Returns gamepad internal name id.
Detect if a gamepad button has been pressed once.
Detect if a gamepad button is being pressed.
Detect if a gamepad button has been released once.
Detect if a gamepad button is NOT being pressed.
Gets the last gamepad button pressed.
Returns gamepad axis count for a gamepad.
Returns axis movement value for a gamepad axis.
Detect if a mouse button has been pressed once.
Detect if a mouse button is being pressed.
Detect if a mouse button has been released once.
Detect if a mouse button is NOT being pressed.
Returns mouse position X.
Returns mouse position Y.
Returns mouse position.
Sets mouse position.
Sets mouse offset.
Sets mouse scaling.
Returns mouse wheel movement Y.
Returns touch position X for touch point 0 (relative to screen size).
Returns touch position Y for touch point 0 (relative to screen size).
Returns touch position XY for a touch point index (relative to screen size).
Enables a set of gestures using flags.
Checks if a gesture have been detected.
Gets latest detected gesture.
Gets touch points count.
Gets gesture hold time in milliseconds.
Gets gesture drag vector.
Gets gesture drag angle.
Gets gesture pinch delta.
Gets gesture pinch angle.
Takes a screenshot of current screen (saved a .png)
Loads model from files (mesh and material).
pub fn load_model_from_mesh(
&mut self,
_: &RaylibThread,
mesh: WeakMesh
) -> Result<Model, String>
pub fn load_model_animations(
&mut self,
_: &RaylibThread,
filename: &str
) -> Result<Vec<ModelAnimation>, String>
pub fn update_model_animation(
&mut self,
_: &RaylibThread,
model: impl AsMut<Model>,
anim: impl AsRef<ModelAnimation>,
frame: i32
)
Weak materials will leak memeory if they are not unlaoded Unload material from GPU memory (VRAM)
Weak models will leak memeory if they are not unlaoded Unload model from GPU memory (VRAM)
pub unsafe fn unload_model_animation(
&mut self,
_: &RaylibThread,
model_animation: WeakModelAnimation
)
pub unsafe fn unload_model_animation(
&mut self,
_: &RaylibThread,
model_animation: WeakModelAnimation
)
Weak model_animations will leak memeory if they are not unlaoded Unload model_animation from GPU memory (VRAM)
Weak meshs will leak memeory if they are not unlaoded Unload mesh from GPU memory (VRAM)
pub fn load_shader(
&mut self,
_: &RaylibThread,
vs_filename: Option<&str>,
fs_filename: Option<&str>
) -> Result<Shader, String>
pub fn load_shader(
&mut self,
_: &RaylibThread,
vs_filename: Option<&str>,
fs_filename: Option<&str>
) -> Result<Shader, String>
Loads a custom shader and binds default locations.
pub fn load_shader_from_memory(
&mut self,
_: &RaylibThread,
vs_code: Option<&str>,
fs_code: Option<&str>
) -> Shader
pub fn load_shader_from_memory(
&mut self,
_: &RaylibThread,
vs_code: Option<&str>,
fs_code: Option<&str>
) -> Shader
Loads shader from code strings and binds default locations.
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>
pub fn load_font_ex(
&mut self,
_: &RaylibThread,
filename: &str,
font_size: i32,
chars: FontLoadEx<'_>
) -> Result<Font, String>
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>
pub fn load_font_from_image(
&mut self,
_: &RaylibThread,
image: &Image,
key: impl Into<Color>,
first_char: i32
) -> Result<Font, String>
Load font from Image (XNA style)
Gets the default font.
Loads texture from file into GPU memory (VRAM).
pub fn load_texture_cubemap(
&mut self,
_: &RaylibThread,
image: &Image,
layout: CubemapLayout
) -> Result<Texture2D, String>
pub fn load_texture_cubemap(
&mut self,
_: &RaylibThread,
image: &Image,
layout: CubemapLayout
) -> Result<Texture2D, String>
Load cubemap from image, multiple image cubemap layouts supported
pub fn load_texture_from_image(
&mut self,
_: &RaylibThread,
image: &Image
) -> Result<Texture2D, String>
pub fn load_texture_from_image(
&mut self,
_: &RaylibThread,
image: &Image
) -> Result<Texture2D, String>
Loads texture from image data.
pub fn load_render_texture(
&mut self,
_: &RaylibThread,
width: u32,
height: u32
) -> Result<RenderTexture2D, String>
pub fn load_render_texture(
&mut self,
_: &RaylibThread,
width: u32,
height: u32
) -> Result<RenderTexture2D, String>
Loads texture for rendering (framebuffer).
Weak Textures will leak memeory if they are not unlaoded Unload textures from GPU memory (VRAM)
pub unsafe fn unload_render_texture(
&mut self,
_: &RaylibThread,
texture: WeakRenderTexture2D
)
pub unsafe fn unload_render_texture(
&mut self,
_: &RaylibThread,
texture: WeakRenderTexture2D
)
Weak RenderTextures will leak memeory if they are not unlaoded Unload RenderTextures from GPU memory (VRAM)
pub fn load_vr_stereo_config(
&mut self,
_: &RaylibThread,
device: impl Into<VrDeviceInfo>
) -> VrStereoConfig
Returns a ray trace from mouse position
Returns the screen space position for a 3d world space position
Returns the screen space position for a 2d camera world space position
Returns size position for a 3d world space position
Checks if KEY_ESCAPE
or Close icon was pressed.
Checks if window has been initialized successfully.
Checks if window has been minimized (or lost focus).
Checks if window has been resized.
Checks if window has been hidden.
Returns whether or not window is in fullscreen mode
Check if window is currently focused (only PLATFORM_DESKTOP)
Check if cursor is on the current screen.
Set mouse cursor
Toggles fullscreen mode (only on desktop platforms).
Set window configuration state using flags
Clear window configuration state flags
Get the window config state
Sets icon for window (only on desktop platforms).
Sets title for window (only on desktop platforms).
Sets window position on screen (only on desktop platforms).
Sets monitor for the current window (fullscreen mode).
Sets minimum window dimensions (for FLAG_WINDOW_RESIZABLE
).
Sets window dimensions.
Gets current screen width.
Gets current screen height.
Get window position
Shows mouse cursor.
Hides mouse cursor.
Checks if mouse cursor is not visible.
Enables mouse cursor (unlock cursor).
Disables mouse cursor (lock cursor).
Get native window handle
Global gui modification functions
Enable gui controls (global state)
Disable gui controls (global state)
Unlock gui controls (global state)
Set gui state (global state)
Get gui state (global state)
Set gui custom font (global state)
Get gui custom font (global state)
Set one style property SHOULD use one of the Gui*Property enums
Get one style property SHOULD use one of the Gui*Property enums
Load style file (.rgs)
Load style default over global style