Skip to content
Snippets Groups Projects
Commit 22d6e812 authored by John Mitchell's avatar John Mitchell
Browse files

Showcase using kttf textures in some examples.

parent 466ebf96
No related branches found
No related tags found
No related merge requests found
assets/lato-light - Copy.png

66.5 KiB

{
"file": "lato-light.ttf",
"char_range_start": "0x20",
"char_range_end": "0x7f"
}
\ No newline at end of file
assets/lato-light.kttf-cached.png

144 KiB

File added
{
"file": "roboto.ttf",
"char_range_start": "0x20",
"char_range_end": "0x7f"
}
\ No newline at end of file
File added
......@@ -6,7 +6,7 @@ fn startup(
mut font_mapping: ResMut<FontMapping>,
asset_server: Res<AssetServer>,
) {
font_mapping.set_default(asset_server.load("lato-light.kayak_font"));
font_mapping.set_default(asset_server.load("lato-light.kttf"));
let image = asset_server.load("panel.png");
......
......@@ -109,7 +109,7 @@ fn startup(
mut font_mapping: ResMut<FontMapping>,
asset_server: Res<AssetServer>,
) {
font_mapping.set_default(asset_server.load("lato-light.kayak_font"));
font_mapping.set_default(asset_server.load("lato-light.kttf"));
// Camera 2D forces a clear pass in bevy.
// We do this because our scene is not rendering anything else.
......
......@@ -96,8 +96,9 @@ fn menu_button_render(
content: button_text,
size: 28.0,
user_styles: KStyle {
top: Units::Stretch(1.0).into(),
bottom: Units::Stretch(1.0).into(),
// top: Units::Stretch(1.0).into(),
top: Units::Pixels(-16.0).into(),
height: Units::Pixels(40.0).into(),
..Default::default()
},
..Default::default()
......@@ -120,7 +121,7 @@ fn startup(
asset_server: Res<AssetServer>,
mut preload_resource: ResMut<PreloadResource>,
) {
font_mapping.set_default(asset_server.load("lato-light.kayak_font"));
font_mapping.set_default(asset_server.load("lato-light.kttf"));
let mut widget_context = KayakRootContext::new();
widget_context.add_plugin(KayakWidgetsContextPlugin);
......
......@@ -83,7 +83,7 @@ fn startup(
mut font_mapping: ResMut<FontMapping>,
asset_server: Res<AssetServer>,
) {
font_mapping.set_default(asset_server.load("lato-light.kayak_font"));
font_mapping.set_default(asset_server.load("lato-light.kttf"));
// Camera 2D forces a clear pass in bevy.
// We do this because our scene is not rendering anything else.
......
......@@ -142,7 +142,7 @@ impl AssetLoader for TTFLoader {
// let top = (translation.y - char_bounds.y_min as f64 * pixel_scale).max(0.0).floor() as u32;
let bottom = (translation.y + char_bounds.y_max as f64 * pixel_scale).floor() as u32;
for x in 0..right + 2 {
for x in 0..(right + 2).min(64) {
for y in 0..bottom + 48 {
// for x in 0..size_x as u32 {
// for y in 0..size_y as u32 {
......@@ -278,7 +278,7 @@ fn calculate_plane(
left: 0.0, // l as f32,
bottom: 0.0, // b as f32,
right: 0.0, // r as f32,
top: 4.0 * geometry_scale, // t as f32,
top: 24.0 * geometry_scale, // t as f32,
},
)
}
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