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

Fixed up the examples to use the new render! macro.

parent bc0f7026
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ use bevy::{ ...@@ -6,7 +6,7 @@ use bevy::{
}; };
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle};
use kayak_ui::core::Index; use kayak_ui::core::Index;
use kayak_ui::core::{rsx, widget}; use kayak_ui::core::{render, rsx, widget};
use kayak_widgets::{App, Window}; use kayak_widgets::{App, Window};
#[widget] #[widget]
...@@ -40,11 +40,7 @@ fn startup( ...@@ -40,11 +40,7 @@ fn startup(
}; };
let context = BevyContext::new(window_size.x, window_size.y, |styles, context| { let context = BevyContext::new(window_size.x, window_size.y, |styles, context| {
// Hack to trick the proc macro for right now.. render! {
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
rsx! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<Window position={(50.0, 50.0)} size={(300.0, 300.0)} title={"Window 1".to_string()}> <Window position={(50.0, 50.0)} size={(300.0, 300.0)} title={"Window 1".to_string()}>
{} {}
......
...@@ -7,7 +7,7 @@ use bevy::{ ...@@ -7,7 +7,7 @@ use bevy::{
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, ImageManager, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, ImageManager, UICameraBundle};
use kayak_ui::core::{ use kayak_ui::core::{
layout_cache::Space, layout_cache::Space,
rsx, render,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
Index, Index,
}; };
...@@ -34,10 +34,6 @@ fn startup( ...@@ -34,10 +34,6 @@ fn startup(
let panel_brown_handle = image_manager.get(&handle); let panel_brown_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| {
// Hack to trick the proc macro for right now..
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
let nine_patch_styles = Style { let nine_patch_styles = Style {
width: StyleProp::Value(Units::Pixels(512.0)), width: StyleProp::Value(Units::Pixels(512.0)),
height: StyleProp::Value(Units::Pixels(512.0)), height: StyleProp::Value(Units::Pixels(512.0)),
...@@ -72,7 +68,7 @@ Vivamus pulvinar dui et elit volutpat hendrerit. Praesent luctus dolor ut rutrum ...@@ -72,7 +68,7 @@ Vivamus pulvinar dui et elit volutpat hendrerit. Praesent luctus dolor ut rutrum
Vestibulum rutrum imperdiet nisl, et consequat massa porttitor vel. Ut velit justo, vehicula a nulla eu, auctor eleifend metus. Ut egestas malesuada metus, sit amet pretium nunc commodo ac. Pellentesque gravida, nisl in faucibus volutpat, libero turpis mattis orci, vitae tincidunt ligula ligula ut tortor. Maecenas vehicula lobortis odio in molestie. Curabitur dictum elit sed arcu dictum, ut semper nunc cursus. Donec semper felis non nisl tincidunt elementum. Vestibulum rutrum imperdiet nisl, et consequat massa porttitor vel. Ut velit justo, vehicula a nulla eu, auctor eleifend metus. Ut egestas malesuada metus, sit amet pretium nunc commodo ac. Pellentesque gravida, nisl in faucibus volutpat, libero turpis mattis orci, vitae tincidunt ligula ligula ut tortor. Maecenas vehicula lobortis odio in molestie. Curabitur dictum elit sed arcu dictum, ut semper nunc cursus. Donec semper felis non nisl tincidunt elementum.
"#.to_string(); "#.to_string();
rsx! { render! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<NinePatch <NinePatch
styles={Some(nine_patch_styles)} styles={Some(nine_patch_styles)}
......
...@@ -6,7 +6,7 @@ use bevy::{ ...@@ -6,7 +6,7 @@ use bevy::{
}; };
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle};
use kayak_ui::core::{ use kayak_ui::core::{
rsx, render, rsx,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
widget, Bound, EventType, Index, MutableBound, OnEvent, widget, Bound, EventType, Index, MutableBound, OnEvent,
}; };
...@@ -73,11 +73,7 @@ fn startup( ...@@ -73,11 +73,7 @@ fn startup(
}; };
let context = BevyContext::new(window_size.x, window_size.y, |styles, context| { let context = BevyContext::new(window_size.x, window_size.y, |styles, context| {
// Hack to trick the proc macro for right now.. render! {
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
rsx! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<Counter /> <Counter />
</App> </App>
......
...@@ -7,7 +7,7 @@ use bevy::{ ...@@ -7,7 +7,7 @@ use bevy::{
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, ImageManager, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, ImageManager, UICameraBundle};
use kayak_ui::core::{ use kayak_ui::core::{
layout_cache::Space, layout_cache::Space,
rsx, render, rsx,
styles::{LayoutType, Style, StyleProp, Units}, styles::{LayoutType, Style, StyleProp, Units},
widget, Bound, Children, EventType, Index, MutableBound, OnEvent, widget, Bound, Children, EventType, Index, MutableBound, OnEvent,
}; };
...@@ -101,9 +101,6 @@ fn startup( ...@@ -101,9 +101,6 @@ fn startup(
let panel_brown_handle = image_manager.get(&handle); let panel_brown_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| {
// Hack to trick the proc macro for right now..
let parent_id: Option<Index> = None;
let nine_patch_styles = Style { let nine_patch_styles = Style {
layout_type: StyleProp::Value(LayoutType::Column), layout_type: StyleProp::Value(LayoutType::Column),
width: StyleProp::Value(Units::Pixels(512.0)), width: StyleProp::Value(Units::Pixels(512.0)),
...@@ -147,7 +144,7 @@ fn startup( ...@@ -147,7 +144,7 @@ fn startup(
..Style::default() ..Style::default()
}; };
rsx! { render! {
<App styles={Some(app_styles)}> <App styles={Some(app_styles)}>
<NinePatch <NinePatch
styles={Some(nine_patch_styles)} styles={Some(nine_patch_styles)}
......
...@@ -5,7 +5,7 @@ use bevy::{ ...@@ -5,7 +5,7 @@ use bevy::{
DefaultPlugins, DefaultPlugins,
}; };
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle};
use kayak_ui::core::{bind, rsx, widget, Binding, Bound, Index, MutableBound}; use kayak_ui::core::{bind, render, rsx, widget, Binding, Bound, Index, MutableBound};
use kayak_widgets::{App, Text, Window}; use kayak_widgets::{App, Text, Window};
#[derive(Clone, PartialEq)] #[derive(Clone, PartialEq)]
...@@ -57,10 +57,7 @@ fn startup( ...@@ -57,10 +57,7 @@ fn startup(
commands.insert_resource(bind(GlobalCount(0))); commands.insert_resource(bind(GlobalCount(0)));
let context = BevyContext::new(window_size.x, window_size.y, |styles, context| { let context = BevyContext::new(window_size.x, window_size.y, |styles, context| {
// Hack to trick the proc macro for right now.. render! {
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
rsx! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<Counter /> <Counter />
</App> </App>
......
...@@ -6,7 +6,7 @@ use bevy::{ ...@@ -6,7 +6,7 @@ use bevy::{
}; };
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle};
use kayak_ui::core::{ use kayak_ui::core::{
rsx, render, rsx,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
widget, Bound, EventType, Index, MutableBound, OnEvent, widget, Bound, EventType, Index, MutableBound, OnEvent,
}; };
...@@ -75,12 +75,7 @@ fn startup( ...@@ -75,12 +75,7 @@ fn startup(
}; };
let context = BevyContext::new(window_size.x, window_size.y, |styles, context| { let context = BevyContext::new(window_size.x, window_size.y, |styles, context| {
// Hack to trick the proc macro for right now.. render! {
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
let tree = kayak_ui::core::WidgetTree::new();
rsx! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<Removal /> <Removal />
</App> </App>
......
...@@ -5,7 +5,7 @@ use bevy::{ ...@@ -5,7 +5,7 @@ use bevy::{
DefaultPlugins, DefaultPlugins,
}; };
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundle};
use kayak_ui::core::{rsx, Index}; use kayak_ui::core::{render, Index};
use kayak_widgets::{App, Image}; use kayak_widgets::{App, Image};
fn startup( fn startup(
...@@ -26,10 +26,7 @@ fn startup( ...@@ -26,10 +26,7 @@ fn startup(
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| {
// Hack to trick the proc macro for right now.. render! {
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
rsx! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<Image handle={ui_image_handle} /> <Image handle={ui_image_handle} />
</App> </App>
......
...@@ -7,7 +7,7 @@ use bevy::{ ...@@ -7,7 +7,7 @@ use bevy::{
use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundle}; use kayak_ui::bevy::{BevyContext, BevyKayakUIPlugin, ImageManager, UICameraBundle};
use kayak_ui::core::{ use kayak_ui::core::{
layout_cache::Space, layout_cache::Space,
rsx, render,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
Index, Index,
}; };
...@@ -31,10 +31,6 @@ fn startup( ...@@ -31,10 +31,6 @@ fn startup(
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| {
// Hack to trick the proc macro for right now..
let parent_id: Option<Index> = None;
let children: Option<kayak_ui::core::Children> = None;
// The border prop splits up the image into 9 quadrants like so: // The border prop splits up the image into 9 quadrants like so:
// 1----2----3 // 1----2----3
// | | // | |
...@@ -64,7 +60,7 @@ fn startup( ...@@ -64,7 +60,7 @@ fn startup(
..Style::default() ..Style::default()
}; };
rsx! { render! {
<App styles={Some(styles.clone())}> <App styles={Some(styles.clone())}>
<NinePatch <NinePatch
styles={Some(nine_patch_styles)} styles={Some(nine_patch_styles)}
......
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