diff --git a/src/graphics/canvas.rs b/src/graphics/canvas.rs index abc7a16..7b28c69 100644 --- a/src/graphics/canvas.rs +++ b/src/graphics/canvas.rs @@ -74,7 +74,7 @@ impl CanvasBuilder { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn build(&self, ctx: &mut Context) -> Result { let attachments = ctx.device.new_canvas( self.width, @@ -139,7 +139,7 @@ impl Canvas { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn new(ctx: &mut Context, width: i32, height: i32) -> Result { CanvasBuilder::new(width, height).build(ctx) } @@ -213,8 +213,8 @@ impl Canvas { /// # Errors /// /// * [`TetraError::NotEnoughData`](crate::TetraError::NotEnoughData) will be returned - /// if not enough data is provided to fill the target rectangle. This is to prevent - /// the graphics API from trying to read uninitialized memory. + /// if not enough data is provided to fill the target rectangle. This is to prevent + /// the graphics API from trying to read uninitialized memory. /// /// # Panics /// @@ -246,8 +246,8 @@ impl Canvas { /// # Errors /// /// * [`TetraError::NotEnoughData`](crate::TetraError::NotEnoughData) will be returned - /// if not enough data is provided to fill the target rectangle. This is to prevent - /// the graphics API from trying to read uninitialized memory. + /// if not enough data is provided to fill the target rectangle. This is to prevent + /// the graphics API from trying to read uninitialized memory. pub fn replace_data(&self, ctx: &mut Context, data: &[u8]) -> Result { self.texture.replace_data(ctx, data) } diff --git a/src/graphics/color.rs b/src/graphics/color.rs index 20b8f81..ce0129c 100644 --- a/src/graphics/color.rs +++ b/src/graphics/color.rs @@ -22,10 +22,7 @@ use crate::math::Vec4; /// can be enabled via the `serde` feature. #[repr(C)] #[derive(Debug, Default, Copy, Clone, PartialEq)] -#[cfg_attr( - feature = "serde", - derive(serde::Serialize, serde::Deserialize) -)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Color { /// The red component of the color. pub r: f32, @@ -188,7 +185,7 @@ impl Color { } fn clamp_f32(val: f32) -> f32 { - f32::min(f32::max(0.0, val), 1.0) + val.clamp(0.0, 1.0) } impl From for Vec4 { @@ -544,9 +541,9 @@ mod tests { } fn same_color(a: Color, b: Color) -> bool { - (a.r - b.r).abs() < std::f32::EPSILON - && (a.g - b.g).abs() < std::f32::EPSILON - && (a.b - b.b).abs() < std::f32::EPSILON - && (a.a - b.a).abs() < std::f32::EPSILON + (a.r - b.r).abs() < f32::EPSILON + && (a.g - b.g).abs() < f32::EPSILON + && (a.b - b.b).abs() < f32::EPSILON + && (a.a - b.a).abs() < f32::EPSILON } } diff --git a/src/graphics/image_data.rs b/src/graphics/image_data.rs index a658246..2aaa13e 100644 --- a/src/graphics/image_data.rs +++ b/src/graphics/image_data.rs @@ -77,7 +77,7 @@ impl ImageData { /// # Errors /// /// * [`TetraError::NotEnoughData`] will be returned if not enough data is provided to fill - /// the image. + /// the image. pub fn from_data( width: i32, height: i32, diff --git a/src/graphics/mesh.rs b/src/graphics/mesh.rs index 8e9ffb0..8833018 100644 --- a/src/graphics/mesh.rs +++ b/src/graphics/mesh.rs @@ -128,7 +128,7 @@ impl VertexBuffer { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn new(ctx: &mut Context, vertices: &[Vertex]) -> Result { VertexBuffer::with_usage(ctx, vertices, BufferUsage::Dynamic) } @@ -140,7 +140,7 @@ impl VertexBuffer { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn with_usage( ctx: &mut Context, vertices: &[Vertex], @@ -210,7 +210,7 @@ impl IndexBuffer { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn new(ctx: &mut Context, indices: &[u32]) -> Result { IndexBuffer::with_usage(ctx, indices, BufferUsage::Dynamic) } @@ -222,7 +222,7 @@ impl IndexBuffer { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn with_usage( ctx: &mut Context, indices: &[u32], @@ -512,9 +512,9 @@ impl Mesh { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn rectangle(ctx: &mut Context, style: ShapeStyle, rectangle: Rectangle) -> Result { GeometryBuilder::new() .rectangle(style, rectangle)? @@ -529,9 +529,9 @@ impl Mesh { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn rounded_rectangle( ctx: &mut Context, style: ShapeStyle, @@ -551,9 +551,9 @@ impl Mesh { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn circle( ctx: &mut Context, style: ShapeStyle, @@ -573,9 +573,9 @@ impl Mesh { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn ellipse( ctx: &mut Context, style: ShapeStyle, @@ -595,9 +595,9 @@ impl Mesh { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn polygon(ctx: &mut Context, style: ShapeStyle, points: &[Vec2]) -> Result { GeometryBuilder::new() .polygon(style, points)? @@ -612,9 +612,9 @@ impl Mesh { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn polyline(ctx: &mut Context, stroke_width: f32, points: &[Vec2]) -> Result { GeometryBuilder::new() .polyline(stroke_width, points)? @@ -690,7 +690,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. pub fn rectangle( &mut self, style: ShapeStyle, @@ -724,7 +724,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. pub fn rounded_rectangle( &mut self, style: ShapeStyle, @@ -759,7 +759,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. pub fn circle( &mut self, style: ShapeStyle, @@ -806,7 +806,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. pub fn ellipse( &mut self, style: ShapeStyle, @@ -857,7 +857,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. pub fn polygon( &mut self, style: ShapeStyle, @@ -903,7 +903,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::TessellationError`](crate::TetraError::TessellationError) will be returned if the shape - /// could not be turned into vertex data. + /// could not be turned into vertex data. pub fn polyline( &mut self, stroke_width: f32, @@ -971,7 +971,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn build_buffers(&self, ctx: &mut Context) -> Result<(VertexBuffer, IndexBuffer)> { Ok(( VertexBuffer::new(ctx, &self.data.vertices)?, @@ -986,7 +986,7 @@ impl GeometryBuilder { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the underlying - /// graphics API encounters an error. + /// graphics API encounters an error. pub fn build_mesh(&self, ctx: &mut Context) -> Result { let (vertex_buffer, index_buffer) = self.build_buffers(ctx)?; diff --git a/src/graphics/shader.rs b/src/graphics/shader.rs index e097ebf..3b14825 100644 --- a/src/graphics/shader.rs +++ b/src/graphics/shader.rs @@ -107,11 +107,11 @@ impl Shader { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the - /// underlying graphics API encounters an error. + /// underlying graphics API encounters an error. /// * [`TetraError::FailedToLoadAsset`](crate::TetraError::FailedToLoadAsset) will be returned - /// if the files could not be loaded. + /// if the files could not be loaded. /// * [`TetraError::InvalidShader`](crate::TetraError::InvalidShader) will be returned if the - /// shader could not be compiled. + /// shader could not be compiled. pub fn new

(ctx: &mut Context, vertex_path: P, fragment_path: P) -> Result where P: AsRef, @@ -130,11 +130,11 @@ impl Shader { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the - /// underlying graphics API encounters an error. + /// underlying graphics API encounters an error. /// * [`TetraError::FailedToLoadAsset`](crate::TetraError::FailedToLoadAsset) will be returned - /// if the file could not be loaded. + /// if the file could not be loaded. /// * [`TetraError::InvalidShader`](crate::TetraError::InvalidShader) will be returned if the - /// shader could not be compiled. + /// shader could not be compiled. pub fn from_vertex_file

(ctx: &mut Context, path: P) -> Result where P: AsRef, @@ -153,11 +153,11 @@ impl Shader { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the - /// underlying graphics API encounters an error. + /// underlying graphics API encounters an error. /// * [`TetraError::FailedToLoadAsset`](crate::TetraError::FailedToLoadAsset) will be returned - /// if the file could not be loaded. + /// if the file could not be loaded. /// * [`TetraError::InvalidShader`](crate::TetraError::InvalidShader) will be returned if the - /// shader could not be compiled. + /// shader could not be compiled. pub fn from_fragment_file

(ctx: &mut Context, path: P) -> Result where P: AsRef, @@ -174,9 +174,9 @@ impl Shader { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the - /// underlying graphics API encounters an error. + /// underlying graphics API encounters an error. /// * [`TetraError::InvalidShader`](crate::TetraError::InvalidShader) will be returned if the - /// shader could not be compiled. + /// shader could not be compiled. pub fn from_string( ctx: &mut Context, vertex_shader: &str, @@ -192,9 +192,9 @@ impl Shader { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the - /// underlying graphics API encounters an error. + /// underlying graphics API encounters an error. /// * [`TetraError::InvalidShader`](crate::TetraError::InvalidShader) will be returned if the - /// shader could not be compiled. + /// shader could not be compiled. pub fn from_vertex_string(ctx: &mut Context, shader: &str) -> Result { Shader::with_device(&mut ctx.device, shader, DEFAULT_FRAGMENT_SHADER) } @@ -206,9 +206,9 @@ impl Shader { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the - /// underlying graphics API encounters an error. + /// underlying graphics API encounters an error. /// * [`TetraError::InvalidShader`](crate::TetraError::InvalidShader) will be returned if the - /// shader could not be compiled. + /// shader could not be compiled. pub fn from_fragment_string(ctx: &mut Context, shader: &str) -> Result { Shader::with_device(&mut ctx.device, DEFAULT_VERTEX_SHADER, shader) } diff --git a/src/graphics/text.rs b/src/graphics/text.rs index 83a1588..24480d7 100644 --- a/src/graphics/text.rs +++ b/src/graphics/text.rs @@ -72,9 +72,9 @@ impl Font { /// # Errors /// /// * [`TetraError::FailedToLoadAsset`](crate::TetraError::FailedToLoadAsset) will be returned - /// if the file could not be loaded. + /// if the file could not be loaded. /// * [`TetraError::InvalidFont`](crate::TetraError::InvalidFont) will be returned if the font - /// data was invalid. + /// data was invalid. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the GPU cache for the font /// could not be created. #[cfg(feature = "font_ttf")] @@ -98,9 +98,9 @@ impl Font { /// # Errors /// /// * [`TetraError::InvalidFont`](crate::TetraError::InvalidFont) will be returned if the font - /// data was invalid. + /// data was invalid. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the GPU cache for the font - /// could not be created. + /// could not be created. #[cfg(feature = "font_ttf")] pub fn from_vector_file_data( ctx: &mut Context, @@ -137,11 +137,11 @@ impl Font { /// # Errors /// /// * [`TetraError::FailedToLoadAsset`](crate::TetraError::FailedToLoadAsset) will be returned - /// if the font or the associated images could not be loaded. + /// if the font or the associated images could not be loaded. /// * [`TetraError::InvalidFont`](crate::TetraError::InvalidFont) will be returned if the font - /// data was invalid. + /// data was invalid. /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if the GPU cache for the font - /// could not be created. + /// could not be created. pub fn bmfont

(ctx: &mut Context, path: P) -> Result where P: AsRef, diff --git a/src/graphics/texture.rs b/src/graphics/texture.rs index fa7ee69..11a1b74 100644 --- a/src/graphics/texture.rs +++ b/src/graphics/texture.rs @@ -74,11 +74,11 @@ impl Texture { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned - /// if the underlying graphics API encounters an error. + /// if the underlying graphics API encounters an error. /// * [`TetraError::FailedToLoadAsset`](crate::TetraError::FailedToLoadAsset) will be - /// returned if the file could not be loaded. + /// returned if the file could not be loaded. /// * [`TetraError::InvalidTexture`](crate::TetraError::InvalidTexture) will be returned - /// if the texture data was invalid. + /// if the texture data was invalid. pub fn new

(ctx: &mut Context, path: P) -> Result where P: AsRef, @@ -98,10 +98,10 @@ impl Texture { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned - /// if the underlying graphics API encounters an error. + /// if the underlying graphics API encounters an error. /// * [`TetraError::NotEnoughData`](crate::TetraError::NotEnoughData) will be returned - /// if not enough data is provided to fill the texture. This is to prevent the - /// graphics API from trying to read uninitialized memory. + /// if not enough data is provided to fill the texture. This is to prevent the + /// graphics API from trying to read uninitialized memory. pub fn from_data( ctx: &mut Context, width: i32, @@ -133,9 +133,9 @@ impl Texture { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be - /// returned if the underlying graphics API encounters an error. + /// returned if the underlying graphics API encounters an error. /// * [`TetraError::InvalidTexture`](crate::TetraError::InvalidTexture) will be - /// returned if the texture data was invalid. + /// returned if the texture data was invalid. pub fn from_encoded(ctx: &mut Context, data: &[u8]) -> Result { let data = ImageData::from_encoded(data)?; Texture::from_image_data(ctx, &data) @@ -146,7 +146,7 @@ impl Texture { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned - /// if the underlying graphics API encounters an error. + /// if the underlying graphics API encounters an error. pub fn from_image_data(ctx: &mut Context, data: &ImageData) -> Result { Texture::from_data( ctx, @@ -382,8 +382,8 @@ impl Texture { /// # Errors /// /// * [`TetraError::NotEnoughData`](crate::TetraError::NotEnoughData) will be returned if - /// not enough data is provided to fill the target rectangle. This is to prevent the - /// graphics API from trying to read uninitialized memory. + /// not enough data is provided to fill the target rectangle. This is to prevent the + /// graphics API from trying to read uninitialized memory. /// /// # Panics /// @@ -413,8 +413,8 @@ impl Texture { /// # Errors /// /// * [`TetraError::NotEnoughData`](crate::TetraError::NotEnoughData) will be returned if not - /// enough data is provided to fill the texture. This is to prevent the graphics API from - /// trying to read uninitialized memory. + /// enough data is provided to fill the texture. This is to prevent the graphics API from + /// trying to read uninitialized memory. pub fn replace_data(&self, ctx: &mut Context, data: &[u8]) -> Result { let (width, height) = self.size(); self.set_data(ctx, 0, 0, width, height, data) diff --git a/src/input.rs b/src/input.rs index da35ad5..8556229 100644 --- a/src/input.rs +++ b/src/input.rs @@ -102,7 +102,7 @@ pub fn get_text_input(ctx: &Context) -> Option<&str> { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be -/// returned if the text could not be retrieved from the clipboard. +/// returned if the text could not be retrieved from the clipboard. pub fn get_clipboard_text(ctx: &Context) -> Result { ctx.window.get_clipboard_text() } @@ -112,7 +112,7 @@ pub fn get_clipboard_text(ctx: &Context) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be -/// returned if the clipboard could not be modified. +/// returned if the clipboard could not be modified. pub fn set_clipboard_text(ctx: &Context, text: &str) -> Result { ctx.window.set_clipboard_text(text) } diff --git a/src/time.rs b/src/time.rs index 9272f57..47de229 100644 --- a/src/time.rs +++ b/src/time.rs @@ -11,13 +11,10 @@ use crate::Context; /// # Serde /// /// Serialization and deserialization of this type (via [Serde](https://serde.rs/)) -/// can be enabled via the `serde_support` feature. +/// can be enabled via the `serde` feature. #[non_exhaustive] #[derive(Debug, Copy, Clone)] -#[cfg_attr( - feature = "serde_support", - derive(serde::Serialize, serde::Deserialize) -)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Timestep { /// In fixed timestep mode, updates will happen at a consistent rate (the `f64` value in the enum /// variant representing the number of times per second), while rendering will happen as fast as diff --git a/src/window.rs b/src/window.rs index 2227861..15e6312 100644 --- a/src/window.rs +++ b/src/window.rs @@ -66,7 +66,7 @@ pub fn get_width(ctx: &Context) -> i32 { /// # Errors /// /// * [`TetraError::FailedToChangeDisplayMode`](crate::TetraError::FailedToChangeDisplayMode) -/// will be returned if the game was unable to change the window size. +/// will be returned if the game was unable to change the window size. pub fn set_width(ctx: &mut Context, width: i32) -> Result { set_size(ctx, width, ctx.window.get_window_size().1) } @@ -85,7 +85,7 @@ pub fn get_height(ctx: &Context) -> i32 { /// # Errors /// /// * [`TetraError::FailedToChangeDisplayMode`](crate::TetraError::FailedToChangeDisplayMode) -/// will be returned if the game was unable to change the window size. +/// will be returned if the game was unable to change the window size. pub fn set_height(ctx: &mut Context, height: i32) -> Result { set_size(ctx, ctx.window.get_window_size().0, height) } @@ -104,7 +104,7 @@ pub fn get_size(ctx: &Context) -> (i32, i32) { /// # Errors /// /// * [`TetraError::FailedToChangeDisplayMode`](crate::TetraError::FailedToChangeDisplayMode) -/// will be returned if the game was unable to change the window size. +/// will be returned if the game was unable to change the window size. pub fn set_size(ctx: &mut Context, width: i32, height: i32) -> Result { ctx.window.set_window_size(width, height) } @@ -138,7 +138,7 @@ pub fn get_physical_size(ctx: &Context) -> (i32, i32) { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the specified size was invalid. +/// if the specified size was invalid. pub fn set_minimum_size(ctx: &mut Context, width: i32, height: i32) -> Result { ctx.window.set_minimum_size(width, height) } @@ -153,7 +153,7 @@ pub fn get_minimum_size(ctx: &Context) -> (i32, i32) { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the specified size was invalid. +/// if the specified size was invalid. pub fn set_maximum_size(ctx: &mut Context, width: i32, height: i32) -> Result { ctx.window.set_maximum_size(width, height) } @@ -209,7 +209,7 @@ pub fn set_decorated(ctx: &mut Context, bordered: bool) { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the icon could not be set. +/// if the icon could not be set. pub fn set_icon(ctx: &mut Context, data: &mut ImageData) -> Result { ctx.window.set_icon(data) } @@ -232,7 +232,7 @@ pub fn set_visible(ctx: &mut Context, visible: bool) { /// # Errors /// /// * [`TetraError::FailedToChangeDisplayMode`](crate::TetraError::FailedToChangeDisplayMode) -/// will be returned if the game was unable to change vsync mode. +/// will be returned if the game was unable to change vsync mode. pub fn set_vsync(ctx: &mut Context, vsync: bool) -> Result { ctx.window.set_vsync(vsync) } @@ -247,7 +247,7 @@ pub fn is_vsync_enabled(ctx: &Context) -> bool { /// # Errors /// /// * [`TetraError::FailedToChangeDisplayMode`](crate::TetraError::FailedToChangeDisplayMode) -/// will be returned if the game was unable to enter or exit fullscreen. +/// will be returned if the game was unable to enter or exit fullscreen. pub fn set_fullscreen(ctx: &mut Context, fullscreen: bool) -> Result { ctx.window.set_fullscreen(fullscreen) } @@ -262,7 +262,7 @@ pub fn is_fullscreen(ctx: &Context) -> bool { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned if -/// the cursor state was inaccessible. +/// the cursor state was inaccessible. pub fn set_mouse_visible(ctx: &mut Context, visible: bool) -> Result { ctx.window.set_mouse_visible(visible) } @@ -321,7 +321,7 @@ pub fn is_relative_mouse_mode(ctx: &Context) -> bool { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_monitor_count(ctx: &Context) -> Result { ctx.window.get_monitor_count() } @@ -331,7 +331,7 @@ pub fn get_monitor_count(ctx: &Context) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_monitor_name(ctx: &Context, monitor_index: i32) -> Result { ctx.window.get_monitor_name(monitor_index) } @@ -341,7 +341,7 @@ pub fn get_monitor_name(ctx: &Context, monitor_index: i32) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_monitor_width(ctx: &Context, monitor_index: i32) -> Result { get_monitor_size(ctx, monitor_index).map(|(w, _)| w) } @@ -351,7 +351,7 @@ pub fn get_monitor_width(ctx: &Context, monitor_index: i32) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_monitor_height(ctx: &Context, monitor_index: i32) -> Result { get_monitor_size(ctx, monitor_index).map(|(_, h)| h) } @@ -361,7 +361,7 @@ pub fn get_monitor_height(ctx: &Context, monitor_index: i32) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_monitor_size(ctx: &Context, monitor_index: i32) -> Result<(i32, i32)> { ctx.window.get_monitor_size(monitor_index) } @@ -371,7 +371,7 @@ pub fn get_monitor_size(ctx: &Context, monitor_index: i32) -> Result<(i32, i32)> /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_current_monitor(ctx: &Context) -> Result { ctx.window.get_current_monitor() } @@ -381,7 +381,7 @@ pub fn get_current_monitor(ctx: &Context) -> Result { /// # Errors /// /// * [[`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_current_monitor_name(ctx: &Context) -> Result { let monitor_index = ctx.window.get_current_monitor()?; ctx.window.get_monitor_name(monitor_index) @@ -392,7 +392,7 @@ pub fn get_current_monitor_name(ctx: &Context) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_current_monitor_width(ctx: &Context) -> Result { get_current_monitor_size(ctx).map(|(w, _)| w) } @@ -402,7 +402,7 @@ pub fn get_current_monitor_width(ctx: &Context) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_current_monitor_height(ctx: &Context) -> Result { get_current_monitor_size(ctx).map(|(_, h)| h) } @@ -412,7 +412,7 @@ pub fn get_current_monitor_height(ctx: &Context) -> Result { /// # Errors /// /// * [`TetraError::PlatformError`](crate::TetraError::PlatformError) will be returned -/// if the monitor state was inaccessible. +/// if the monitor state was inaccessible. pub fn get_current_monitor_size(ctx: &Context) -> Result<(i32, i32)> { let monitor_index = ctx.window.get_current_monitor()?; ctx.window.get_monitor_size(monitor_index)