Struct allegro::core::Core

source ·
pub struct Core { /* private fields */ }
Expand description

Type through which you’ll be doing most your interaction with Allegro.

Implementations§

source§

impl Core

source

pub fn init() -> Result<Core, String>

This must be called on the main thread.

source

pub fn init_with_config(system_config: &Config) -> Result<Core, String>

Initializes Allegro while merging in the system_config into the system configuration.

source

pub fn get_system_config(&self) -> &Config

Returns the system config.

source

pub fn get_system_config_mut(&mut self) -> &mut Config

Returns the system config.

source

pub fn get_num_video_adapters(&self) -> i32

source

pub fn get_monitor_info(&self, adapter: i32) -> Result<MonitorInfo, ()>

source

pub fn rest(&self, seconds: f64)

source

pub fn get_time(&self) -> f64

source

pub fn install_keyboard(&self) -> Result<(), ()>

source

pub fn is_keyboard_installed(&self) -> bool

source

pub fn get_keyboard_event_source(&self) -> Option<EventSource<'_>>

source

pub fn set_keyboard_leds(&self, leds: KeyModifier) -> Result<(), ()>

source

pub fn keycode_to_name(&self, k: KeyCode) -> String

source

pub fn install_mouse(&self) -> Result<(), ()>

source

pub fn is_mouse_installed(&self) -> bool

source

pub fn get_mouse_event_source(&self) -> Option<EventSource<'_>>

source

pub fn install_joystick(&self) -> Result<(), ()>

source

pub fn is_joystick_installed(&self) -> bool

source

pub fn get_joystick_event_source(&self) -> Option<EventSource<'_>>

source

pub fn reconfigure_joysticks(&self) -> Result<(), ()>

source

pub fn get_num_joysticks(&self) -> i32

source

pub fn get_mouse_num_buttons(&self) -> u32

source

pub fn get_mouse_num_axes(&self) -> u32

source

pub fn set_mouse_xy(&self, display: &Display, x: i32, y: i32) -> Result<(), ()>

source

pub fn set_mouse_z(&self, z: i32) -> Result<(), ()>

source

pub fn set_mouse_w(&self, w: i32) -> Result<(), ()>

source

pub fn set_mouse_axis(&self, axis: i32, value: i32) -> Result<(), ()>

source

pub fn grab_mouse(&self, display: &Display) -> Result<(), ()>

source

pub fn ungrab_mouse(&self) -> Result<(), ()>

source

pub fn set_new_bitmap_flags(&self, flags: BitmapFlags)

source

pub fn get_new_bitmap_flags(&self) -> BitmapFlags

source

pub fn set_new_bitmap_depth(&self, depth: i32)

source

pub fn get_new_bitmap_depth(&self) -> i32

source

pub fn set_new_bitmap_format(&self, format: PixelFormat)

source

pub fn get_new_bitmap_format(&self) -> PixelFormat

source

pub fn set_target_bitmap<T: BitmapLike>(&self, bmp: Option<&T>)

source

pub fn clear_to_color(&self, color: Color)

source

pub fn clear_depth_buffer(&self, z: f32)

source

pub fn draw_pixel(&self, x: f32, y: f32, color: Color)

source

pub fn put_pixel(&self, x: i32, y: i32, color: Color)

source

pub fn put_blended_pixel(&self, x: i32, y: i32, color: Color)

source

pub fn draw_bitmap<T: BitmapLike>( &self, bitmap: &T, dx: f32, dy: f32, flags: BitmapDrawingFlags )

source

pub fn draw_bitmap_region<T: BitmapLike>( &self, bitmap: &T, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, flags: BitmapDrawingFlags )

source

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 )

source

pub fn draw_rotated_bitmap<T: BitmapLike>( &self, bitmap: &T, cx: f32, cy: f32, dx: f32, dy: f32, angle: f32, flags: BitmapDrawingFlags )

source

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 )

source

pub fn draw_tinted_bitmap<T: BitmapLike>( &self, bitmap: &T, tint: Color, dx: f32, dy: f32, flags: BitmapDrawingFlags )

source

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 )

source

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 )

source

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 )

source

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 )

source

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 )

source

pub fn set_clipping_rectangle(&self, x: i32, y: i32, width: i32, height: i32)

source

pub fn reset_clipping_rectangle(&self)

source

pub fn get_clipping_rectangle(&self) -> (i32, i32, i32, i32)

source

pub fn set_new_display_flags(&self, flags: DisplayFlags)

source

pub fn get_new_display_flags(&self) -> DisplayFlags

source

pub fn set_new_display_refresh_rate(&self, rate: i32)

source

pub fn get_new_display_refresh_rate(&self) -> i32

source

pub fn set_new_display_adapter(&self, adapter: i32)

source

pub fn get_new_display_adapter(&self) -> i32

source

pub fn set_new_window_position(&self, x: i32, y: i32)

source

pub fn get_new_window_position(&self) -> (i32, i32)

source

pub fn reset_new_display_options(&self)

source

pub fn set_new_display_option( &self, option: DisplayOption, value: i32, importance: DisplayOptionImportance )

source

pub fn get_new_display_option( &self, option: DisplayOption ) -> (i32, DisplayOptionImportance)

source

pub fn get_current_transform(&self) -> Transform

source

pub fn use_transform(&self, trans: &Transform)

source

pub fn use_projection_transform(&self, trans: &Transform)

source

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.

source

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.

source

pub fn flip_display(&self)

source

pub fn update_display_region(&self, x: i32, y: i32, width: i32, height: i32)

source

pub fn wait_for_vsync(&self) -> Result<(), ()>

source

pub fn hold_bitmap_drawing(&self, hold: bool)

source

pub fn is_bitmap_drawing_held(&self) -> bool

source

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.

source

pub fn set_shader_uniform<T: ShaderUniform + ?Sized>( &self, name: &str, val: &T ) -> Result<(), ()>

Sets a shader uniform to a value.

source

pub fn set_shader_transform( &self, name: &str, val: &Transform ) -> Result<(), ()>

Sets a shader uniform to a value.

source

pub fn set_blender( &self, op: BlendOperation, source: BlendMode, dest: BlendMode )

Set blender options.

source

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.

source

pub fn set_depth_test(&self, function: Option<DepthFunction>)

source

pub fn set_app_name(&self, name: &str)

source

pub fn get_app_name(&self) -> &str

source

pub fn set_org_name(&self, name: &str)

source

pub fn get_org_name(&self) -> &str

source

pub fn get_standard_path(&self, path_id: StandardPath) -> Result<PathBuf, ()>

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.