From 165c4b68984acb9fad0f675abf40bd2797c9bec9 Mon Sep 17 00:00:00 2001 From: StarToaster <startoaster23@gmail.com> Date: Thu, 18 Aug 2022 13:42:09 -0400 Subject: [PATCH] Fixed a few issues and warnings. --- examples/texture_atlas.rs | 27 ++++++++++++++++----------- src/widgets/spin_box.rs | 2 +- src/widgets/texture_atlas.rs | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/examples/texture_atlas.rs b/examples/texture_atlas.rs index a5f4de0..4d09377 100644 --- a/examples/texture_atlas.rs +++ b/examples/texture_atlas.rs @@ -1,5 +1,6 @@ use bevy::{ prelude::{App as BevyApp, AssetServer, Commands, Handle, Res, ResMut}, + render::texture::ImageSettings, window::WindowDescriptor, DefaultPlugins, }; @@ -8,7 +9,6 @@ use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundl use kayak_ui::core::{ render, styles::{Style, StyleProp, Units}, - Index, }; use kayak_ui::widgets::{App, TextureAtlas}; @@ -26,7 +26,12 @@ fn startup( let tile_size = 16; let columns = 272 / tile_size; let rows = 128 / tile_size; - let atlas = bevy::sprite::TextureAtlas::from_grid(image_handle, bevy::prelude::Vec2::splat(tile_size as f32), columns, rows); + let atlas = bevy::sprite::TextureAtlas::from_grid( + image_handle, + bevy::prelude::Vec2::splat(tile_size as f32), + columns, + rows, + ); //The sign in the top right of the image would be index 16 let sign_index = 16; @@ -51,15 +56,15 @@ fn startup( render! { <App> - <TextureAtlas styles={Some(atlas_styles)} - handle={ui_image_handle} - position={(sign_position.x, sign_position.y)} - tile_size={(sign_size.x, sign_size.y)} + <TextureAtlas styles={Some(atlas_styles)} + handle={ui_image_handle} + position={(sign_position.x, sign_position.y)} + tile_size={(sign_size.x, sign_size.y)} /> - <TextureAtlas styles={Some(atlas_styles)} - handle={ui_image_handle} - position={(flower_position.x, flower_position.y)} - tile_size={(flower_size.x, flower_size.y)} + <TextureAtlas styles={Some(atlas_styles)} + handle={ui_image_handle} + position={(flower_position.x, flower_position.y)} + tile_size={(flower_size.x, flower_size.y)} /> </App> } @@ -76,9 +81,9 @@ fn main() { title: String::from("UI Example"), ..Default::default() }) + .insert_resource(ImageSettings::default_nearest()) .add_plugins(DefaultPlugins) .add_plugin(BevyKayakUIPlugin) .add_startup_system(startup) .run(); } - diff --git a/src/widgets/spin_box.rs b/src/widgets/spin_box.rs index 1e8317b..c60dba5 100644 --- a/src/widgets/spin_box.rs +++ b/src/widgets/spin_box.rs @@ -1,4 +1,4 @@ -use std::{fmt::Debug, fmt::Formatter, sync::Arc}; +use std::fmt::Debug; use crate::{ core::{ diff --git a/src/widgets/texture_atlas.rs b/src/widgets/texture_atlas.rs index 07ef35c..1eade06 100644 --- a/src/widgets/texture_atlas.rs +++ b/src/widgets/texture_atlas.rs @@ -31,7 +31,7 @@ pub struct TextureAtlasProps { #[widget] /// A widget that renders a texture atlas /// Allows for the use of a partial square of an image such as in a sprite sheet -/// +/// /// # Props /// /// __Type:__ [`TextureAtlasProps`] -- GitLab