Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI
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
Commits
b11a3bf5
Commit
b11a3bf5
authored
3 years ago
by
StarArawn
Browse files
Options
Downloads
Patches
Plain Diff
Fixed image rendering.
parent
9cbc10ec
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
assets/generic-rpg-vendor.png
+0
-0
0 additions, 0 deletions
assets/generic-rpg-vendor.png
bevy_kayak_ui/src/render/unified/shader.wgsl
+1
-1
1 addition, 1 deletion
bevy_kayak_ui/src/render/unified/shader.wgsl
examples/image.rs
+13
-3
13 additions, 3 deletions
examples/image.rs
with
14 additions
and
4 deletions
assets/generic-rpg-vendor.png
0 → 100644
+
0
−
0
View file @
b11a3bf5
2.98 KiB
This diff is collapsed.
Click to expand it.
bevy_kayak_ui/src/render/unified/shader.wgsl
+
1
−
1
View file @
b11a3bf5
...
@@ -99,7 +99,7 @@ fn fragment(in: VertexOutput) -> [[location(0)]] vec4<f32> {
...
@@ -99,7 +99,7 @@ fn fragment(in: VertexOutput) -> [[location(0)]] vec4<f32> {
return vec4<f32>(in.color.rgb, a);
return vec4<f32>(in.color.rgb, a);
}
}
if (quad_type.t == 2) {
if (quad_type.t == 2) {
var color = textureSample(image_texture, image_sampler, vec2<f32>(in.uv.x, in.uv.y));
var color = textureSample(image_texture, image_sampler, vec2<f32>(in.uv.x,
1.0 -
in.uv.y));
return vec4<f32>(color.rgb * in.color.rgb, color.a * in.color.a);
return vec4<f32>(color.rgb * in.color.rgb, color.a * in.color.a);
}
}
return in.color;
return in.color;
...
...
This diff is collapsed.
Click to expand it.
examples/image.rs
+
13
−
3
View file @
b11a3bf5
...
@@ -5,7 +5,11 @@ use bevy::{
...
@@ -5,7 +5,11 @@ use bevy::{
DefaultPlugins
,
DefaultPlugins
,
};
};
use
kayak_ui
::
bevy
::{
BevyContext
,
BevyKayakUIPlugin
,
ImageManager
,
UICameraBundle
};
use
kayak_ui
::
bevy
::{
BevyContext
,
BevyKayakUIPlugin
,
ImageManager
,
UICameraBundle
};
use
kayak_ui
::
core
::{
render
,
Index
};
use
kayak_ui
::
core
::{
render
,
styles
::{
Style
,
StyleProp
,
Units
},
Index
,
};
use
kayak_widgets
::{
App
,
Image
};
use
kayak_widgets
::{
App
,
Image
};
fn
startup
(
fn
startup
(
...
@@ -22,13 +26,19 @@ fn startup(
...
@@ -22,13 +26,19 @@ fn startup(
panic!
(
"Couldn't find primary window!"
);
panic!
(
"Couldn't find primary window!"
);
};
};
let
handle
:
Handle
<
bevy
::
render
::
texture
::
Image
>
=
asset_server
.load
(
"
panel
.png"
);
let
handle
:
Handle
<
bevy
::
render
::
texture
::
Image
>
=
asset_server
.load
(
"
generic-rpg-vendor
.png"
);
let
ui_image_handle
=
image_manager
.get
(
&
handle
);
let
ui_image_handle
=
image_manager
.get
(
&
handle
);
let
context
=
BevyContext
::
new
(
window_size
.x
,
window_size
.y
,
|
styles
,
context
|
{
let
context
=
BevyContext
::
new
(
window_size
.x
,
window_size
.y
,
|
styles
,
context
|
{
let
image_styles
=
Style
{
width
:
StyleProp
::
Value
(
Units
::
Pixels
(
200.0
)),
height
:
StyleProp
::
Value
(
Units
::
Pixels
(
182.0
)),
..
Style
::
default
()
};
render!
{
render!
{
<
App
styles
=
{
Some
(
styles
.clone
())}
>
<
App
styles
=
{
Some
(
styles
.clone
())}
>
<
Image
handle
=
{
ui_image_handle
}
/>
<
Image
styles
=
{
Some
(
image_styles
)}
handle
=
{
ui_image_handle
}
/>
</
App
>
</
App
>
}
}
});
});
...
...
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