Skip to content
Snippets Groups Projects
Commit b11a3bf5 authored by StarArawn's avatar StarArawn
Browse files

Fixed image rendering.

parent 9cbc10ec
No related branches found
No related tags found
No related merge requests found
assets/generic-rpg-vendor.png

2.98 KiB

......@@ -99,7 +99,7 @@ fn fragment(in: VertexOutput) -> [[location(0)]] vec4<f32> {
return vec4<f32>(in.color.rgb, a);
}
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 in.color;
......
......@@ -5,7 +5,11 @@ use bevy::{
DefaultPlugins,
};
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};
fn startup(
......@@ -22,13 +26,19 @@ fn startup(
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 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! {
<App styles={Some(styles.clone())}>
<Image handle={ui_image_handle} />
<Image styles={Some(image_styles)} handle={ui_image_handle} />
</App>
}
});
......
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