Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI 0.11
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI 0.11
Commits
165c4b68
Commit
165c4b68
authored
2 years ago
by
StarToaster
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a few issues and warnings.
parent
82903e2e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/texture_atlas.rs
+16
-11
16 additions, 11 deletions
examples/texture_atlas.rs
src/widgets/spin_box.rs
+1
-1
1 addition, 1 deletion
src/widgets/spin_box.rs
src/widgets/texture_atlas.rs
+1
-1
1 addition, 1 deletion
src/widgets/texture_atlas.rs
with
18 additions
and
13 deletions
examples/texture_atlas.rs
+
16
−
11
View file @
165c4b68
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
();
}
}
This diff is collapsed.
Click to expand it.
src/widgets/spin_box.rs
+
1
−
1
View file @
165c4b68
use
std
::
{
fmt
::
Debug
,
fmt
::
Formatter
,
sync
::
Arc
}
;
use
std
::
fmt
::
Debug
;
use
crate
::{
use
crate
::{
core
::{
core
::{
...
...
This diff is collapsed.
Click to expand it.
src/widgets/texture_atlas.rs
+
1
−
1
View file @
165c4b68
...
@@ -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`]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment