pub struct Core { /* private fields */ }
Expand description
Type through which you’ll be doing most your interaction with Allegro.
Implementations§
source§impl Core
impl Core
sourcepub fn init_with_config(system_config: &Config) -> Result<Core, String>
pub fn init_with_config(system_config: &Config) -> Result<Core, String>
Initializes Allegro while merging in the system_config into the system configuration.
sourcepub fn get_system_config(&self) -> &Config
pub fn get_system_config(&self) -> &Config
Returns the system config.
sourcepub fn get_system_config_mut(&mut self) -> &mut Config
pub fn get_system_config_mut(&mut self) -> &mut Config
Returns the system config.
pub fn get_num_video_adapters(&self) -> i32
pub fn get_monitor_info(&self, adapter: i32) -> Result<MonitorInfo, ()>
pub fn rest(&self, seconds: f64)
pub fn get_time(&self) -> f64
pub fn install_keyboard(&self) -> Result<(), ()>
pub fn is_keyboard_installed(&self) -> bool
pub fn get_keyboard_event_source(&self) -> Option<EventSource<'_>>
pub fn set_keyboard_leds(&self, leds: KeyModifier) -> Result<(), ()>
pub fn keycode_to_name(&self, k: KeyCode) -> String
pub fn install_mouse(&self) -> Result<(), ()>
pub fn is_mouse_installed(&self) -> bool
pub fn get_mouse_event_source(&self) -> Option<EventSource<'_>>
pub fn install_joystick(&self) -> Result<(), ()>
pub fn is_joystick_installed(&self) -> bool
pub fn get_joystick_event_source(&self) -> Option<EventSource<'_>>
pub fn reconfigure_joysticks(&self) -> Result<(), ()>
pub fn get_num_joysticks(&self) -> i32
pub fn get_mouse_num_axes(&self) -> u32
pub fn set_mouse_xy(&self, display: &Display, x: i32, y: i32) -> Result<(), ()>
pub fn set_mouse_z(&self, z: i32) -> Result<(), ()>
pub fn set_mouse_w(&self, w: i32) -> Result<(), ()>
pub fn set_mouse_axis(&self, axis: i32, value: i32) -> Result<(), ()>
pub fn grab_mouse(&self, display: &Display) -> Result<(), ()>
pub fn ungrab_mouse(&self) -> Result<(), ()>
pub fn set_new_bitmap_flags(&self, flags: BitmapFlags)
pub fn get_new_bitmap_flags(&self) -> BitmapFlags
pub fn set_new_bitmap_depth(&self, depth: i32)
pub fn get_new_bitmap_depth(&self) -> i32
pub fn set_new_bitmap_format(&self, format: PixelFormat)
pub fn get_new_bitmap_format(&self) -> PixelFormat
pub fn set_target_bitmap<T: BitmapLike>(&self, bmp: Option<&T>)
pub fn clear_to_color(&self, color: Color)
pub fn clear_depth_buffer(&self, z: f32)
pub fn draw_pixel(&self, x: f32, y: f32, color: Color)
pub fn put_pixel(&self, x: i32, y: i32, color: Color)
pub fn put_blended_pixel(&self, x: i32, y: i32, color: Color)
pub fn draw_bitmap<T: BitmapLike>( &self, bitmap: &T, dx: f32, dy: f32, flags: BitmapDrawingFlags )
pub fn draw_bitmap_region<T: BitmapLike>( &self, bitmap: &T, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, flags: BitmapDrawingFlags )
pub fn draw_scaled_bitmap<T: BitmapLike>( &self, bitmap: &T, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, dw: f32, dh: f32, flags: BitmapDrawingFlags )
pub fn draw_rotated_bitmap<T: BitmapLike>( &self, bitmap: &T, cx: f32, cy: f32, dx: f32, dy: f32, angle: f32, flags: BitmapDrawingFlags )
pub fn draw_scaled_rotated_bitmap<T: BitmapLike>( &self, bitmap: &T, cx: f32, cy: f32, dx: f32, dy: f32, xscale: f32, yscale: f32, angle: f32, flags: BitmapDrawingFlags )
pub fn draw_tinted_bitmap<T: BitmapLike>( &self, bitmap: &T, tint: Color, dx: f32, dy: f32, flags: BitmapDrawingFlags )
pub fn draw_tinted_bitmap_region<T: BitmapLike>( &self, bitmap: &T, tint: Color, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, flags: BitmapDrawingFlags )
pub fn draw_tinted_scaled_bitmap<T: BitmapLike>( &self, bitmap: &T, tint: Color, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, dw: f32, dh: f32, flags: BitmapDrawingFlags )
pub fn draw_tinted_rotated_bitmap<T: BitmapLike>( &self, bitmap: &T, tint: Color, cx: f32, cy: f32, dx: f32, dy: f32, angle: f32, flags: BitmapDrawingFlags )
pub fn draw_tinted_scaled_rotated_bitmap<T: BitmapLike>( &self, bitmap: &T, tint: Color, cx: f32, cy: f32, dx: f32, dy: f32, xscale: f32, yscale: f32, angle: f32, flags: BitmapDrawingFlags )
pub fn draw_tinted_scaled_rotated_bitmap_region<T: BitmapLike>( &self, bitmap: &T, sx: f32, sy: f32, sw: f32, sh: f32, tint: Color, cx: f32, cy: f32, dx: f32, dy: f32, xscale: f32, yscale: f32, angle: f32, flags: BitmapDrawingFlags )
pub fn set_clipping_rectangle(&self, x: i32, y: i32, width: i32, height: i32)
pub fn reset_clipping_rectangle(&self)
pub fn get_clipping_rectangle(&self) -> (i32, i32, i32, i32)
pub fn set_new_display_flags(&self, flags: DisplayFlags)
pub fn get_new_display_flags(&self) -> DisplayFlags
pub fn set_new_display_refresh_rate(&self, rate: i32)
pub fn get_new_display_refresh_rate(&self) -> i32
pub fn set_new_display_adapter(&self, adapter: i32)
pub fn get_new_display_adapter(&self) -> i32
pub fn set_new_window_position(&self, x: i32, y: i32)
pub fn get_new_window_position(&self) -> (i32, i32)
pub fn reset_new_display_options(&self)
pub fn set_new_display_option( &self, option: DisplayOption, value: i32, importance: DisplayOptionImportance )
pub fn get_new_display_option( &self, option: DisplayOption ) -> (i32, DisplayOptionImportance)
pub fn get_current_transform(&self) -> Transform
pub fn use_transform(&self, trans: &Transform)
pub fn use_projection_transform(&self, trans: &Transform)
sourcepub fn use_shader(&self, shader: Option<&Shader>) -> Result<(), ()>
pub fn use_shader(&self, shader: Option<&Shader>) -> Result<(), ()>
Set the shader as current for the current bitmap. Pass None to stop using this shader. Returns an error if the shader isn’t compatible with the bitmap.
sourcepub fn get_default_shader_source(
&self,
platform: ShaderPlatform,
shader_type: ShaderType
) -> Option<String>
pub fn get_default_shader_source( &self, platform: ShaderPlatform, shader_type: ShaderType ) -> Option<String>
Returns the source of the shader that Allegro uses by default.
pub fn flip_display(&self)
pub fn update_display_region(&self, x: i32, y: i32, width: i32, height: i32)
pub fn wait_for_vsync(&self) -> Result<(), ()>
pub fn hold_bitmap_drawing(&self, hold: bool)
pub fn is_bitmap_drawing_held(&self) -> bool
sourcepub fn set_shader_sampler<T: BitmapLike>(
&mut self,
name: &str,
bmp: &T,
unit: i32
) -> Result<(), ()>
pub fn set_shader_sampler<T: BitmapLike>( &mut self, name: &str, bmp: &T, unit: i32 ) -> Result<(), ()>
Set a sampler for a particular uniform and unit for the current shader. Different uniforms should be set to different units. Pass None to bmp to clear the sampler.
sourcepub fn set_shader_uniform<T: ShaderUniform + ?Sized>(
&self,
name: &str,
val: &T
) -> Result<(), ()>
pub fn set_shader_uniform<T: ShaderUniform + ?Sized>( &self, name: &str, val: &T ) -> Result<(), ()>
Sets a shader uniform to a value.
sourcepub fn set_shader_transform(
&self,
name: &str,
val: &Transform
) -> Result<(), ()>
pub fn set_shader_transform( &self, name: &str, val: &Transform ) -> Result<(), ()>
Sets a shader uniform to a value.
sourcepub fn set_blender(
&self,
op: BlendOperation,
source: BlendMode,
dest: BlendMode
)
pub fn set_blender( &self, op: BlendOperation, source: BlendMode, dest: BlendMode )
Set blender options.
sourcepub fn set_separate_blender(
&self,
op: BlendOperation,
source: BlendMode,
dest: BlendMode,
alpha_op: BlendOperation,
alpha_source: BlendMode,
alpha_dest: BlendMode
)
pub fn set_separate_blender( &self, op: BlendOperation, source: BlendMode, dest: BlendMode, alpha_op: BlendOperation, alpha_source: BlendMode, alpha_dest: BlendMode )
Set blender options, with alpha channel getting a separate setting.
pub fn set_depth_test(&self, function: Option<DepthFunction>)
pub fn set_app_name(&self, name: &str)
pub fn get_app_name(&self) -> &str
pub fn set_org_name(&self, name: &str)
pub fn get_org_name(&self) -> &str
pub fn get_standard_path(&self, path_id: StandardPath) -> Result<PathBuf, ()>
Auto Trait Implementations§
impl Freeze for Core
impl RefUnwindSafe for Core
impl Send for Core
impl Sync for Core
impl Unpin for Core
impl UnwindSafe for Core
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more