Skip to content
Snippets Groups Projects
Commit 165c4b68 authored by StarToaster's avatar StarToaster
Browse files

Fixed a few issues and warnings.

parent 82903e2e
No related branches found
No related tags found
No related merge requests found
use bevy::{ use bevy::{
prelude::{App as BevyApp, AssetServer, Commands, Handle, Res, ResMut}, prelude::{App as BevyApp, AssetServer, Commands, Handle, Res, ResMut},
render::texture::ImageSettings,
window::WindowDescriptor, window::WindowDescriptor,
DefaultPlugins, DefaultPlugins,
}; };
...@@ -8,7 +9,6 @@ use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundl ...@@ -8,7 +9,6 @@ use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundl
use kayak_ui::core::{ use kayak_ui::core::{
render, render,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
Index,
}; };
use kayak_ui::widgets::{App, TextureAtlas}; use kayak_ui::widgets::{App, TextureAtlas};
...@@ -26,7 +26,12 @@ fn startup( ...@@ -26,7 +26,12 @@ fn startup(
let tile_size = 16; let tile_size = 16;
let columns = 272 / tile_size; let columns = 272 / tile_size;
let rows = 128 / 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 //The sign in the top right of the image would be index 16
let sign_index = 16; let sign_index = 16;
...@@ -51,15 +56,15 @@ fn startup( ...@@ -51,15 +56,15 @@ fn startup(
render! { render! {
<App> <App>
<TextureAtlas styles={Some(atlas_styles)} <TextureAtlas styles={Some(atlas_styles)}
handle={ui_image_handle} handle={ui_image_handle}
position={(sign_position.x, sign_position.y)} position={(sign_position.x, sign_position.y)}
tile_size={(sign_size.x, sign_size.y)} tile_size={(sign_size.x, sign_size.y)}
/> />
<TextureAtlas styles={Some(atlas_styles)} <TextureAtlas styles={Some(atlas_styles)}
handle={ui_image_handle} handle={ui_image_handle}
position={(flower_position.x, flower_position.y)} position={(flower_position.x, flower_position.y)}
tile_size={(flower_size.x, flower_size.y)} tile_size={(flower_size.x, flower_size.y)}
/> />
</App> </App>
} }
...@@ -76,9 +81,9 @@ fn main() { ...@@ -76,9 +81,9 @@ fn main() {
title: String::from("UI Example"), title: String::from("UI Example"),
..Default::default() ..Default::default()
}) })
.insert_resource(ImageSettings::default_nearest())
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_plugin(BevyKayakUIPlugin) .add_plugin(BevyKayakUIPlugin)
.add_startup_system(startup) .add_startup_system(startup)
.run(); .run();
} }
use std::{fmt::Debug, fmt::Formatter, sync::Arc}; use std::fmt::Debug;
use crate::{ use crate::{
core::{ core::{
......
...@@ -31,7 +31,7 @@ pub struct TextureAtlasProps { ...@@ -31,7 +31,7 @@ pub struct TextureAtlasProps {
#[widget] #[widget]
/// A widget that renders a texture atlas /// A widget that renders a texture atlas
/// Allows for the use of a partial square of an image such as in a sprite sheet /// Allows for the use of a partial square of an image such as in a sprite sheet
/// ///
/// # Props /// # Props
/// ///
/// __Type:__ [`TextureAtlasProps`] /// __Type:__ [`TextureAtlasProps`]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment