Upgrade Blitz to 0.1.0-rc.1 (#4452)
* Update to newer version of blitz_dom::Document trait Signed-off-by: Nico Burns <nico@nicoburns.com> * Native: use DocumentConfig parameter Signed-off-by: Nico Burns <nico@nicoburns.com> * Native: set event converter less often Signed-off-by: Nico Burns <nico@nicoburns.com> * Native: count event handlers and skip events if none Signed-off-by: Nico Burns <nico@nicoburns.com> * Upgrade to Blitz 0.1.0-rc.1 * Fix typo Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix native-headless example Signed-off-by: Nico Burns <nico@nicoburns.com> * Use workspace deps for native-headless-in-bevy example Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix native-headless-in-bevy example (for blitz 0.1.0-rc.1) * Fix native-dom-document doc tests --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
1 parent
18fe6de9a0
commit
6524f55462
12 files changed
+163
-88
No files matched your search
@@ -12,18 +12,18 @@ publish = false
|
||||
tracing = ["dep:tracing-subscriber", "dioxus-native-dom/tracing"]
|
||||
|
||||
[dependencies]
|
||||
anyrender_vello = "0.4.1"
|
||||
async-std = "1.13"
|
||||
bevy = { version = "0.16" }
|
||||
dioxus = { workspace = true }
|
||||
dioxus-native-dom = { workspace = true }
|
||||
blitz-dom = { workspace = true, default-features = true }
|
||||
blitz-paint = { workspace = true, default-features = true }
|
||||
blitz-traits = { workspace = true, default-features = true }
|
||||
anyrender_vello = { workspace = true }
|
||||
wgpu = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, optional = true }
|
||||
bevy = { version = "0.16" }
|
||||
async-std = "1.13"
|
||||
crossbeam-channel = "0.5"
|
||||
dioxus = { workspace = true }
|
||||
dioxus-native-dom = { path = "../../packages/native-dom" }
|
||||
paste = "1.0"
|
||||
rustc-hash = "1"
|
||||
tracing-subscriber = { workspace = true, optional = true }
|
||||
vello = "0.5"
|
||||
wgpu = { workspace = true }
|
||||
|
||||
@@ -17,7 +17,7 @@ use bevy::{
|
||||
};
|
||||
|
||||
use anyrender_vello::{CustomPaintSource, VelloScenePainter};
|
||||
use blitz_dom::Document as _;
|
||||
use blitz_dom::{Document as _, DocumentConfig};
|
||||
use blitz_paint::paint_scene;
|
||||
use blitz_traits::events::{
|
||||
BlitzKeyEvent, BlitzMouseButtonEvent, KeyState, MouseEventButton, MouseEventButtons, UiEvent,
|
||||
@@ -49,7 +49,7 @@ impl<UIProps: std::marker::Send + std::marker::Sync + std::clone::Clone + 'stati
|
||||
// The viewport will be set in setup_ui after we get the window size
|
||||
let vdom = VirtualDom::new_with_props(self.ui, self.props.clone());
|
||||
// FIXME add a NetProvider
|
||||
let mut dioxus_doc = DioxusDocument::new(vdom, None);
|
||||
let mut dioxus_doc = DioxusDocument::new(vdom, DocumentConfig::default());
|
||||
dioxus_doc.initial_build();
|
||||
dioxus_doc.resolve();
|
||||
|
||||
@@ -258,7 +258,7 @@ fn update_ui(
|
||||
if let (Some(texture), Some(mut vello_renderer)) = ((*cached_texture).as_ref(), vello_renderer)
|
||||
{
|
||||
// Poll the vdom
|
||||
dioxus_doc.poll(std::task::Context::from_waker(&waker));
|
||||
dioxus_doc.poll(Some(std::task::Context::from_waker(&waker)));
|
||||
|
||||
// Refresh the document
|
||||
dioxus_doc.resolve();
|
||||
@@ -383,7 +383,7 @@ fn handle_mouse_events(
|
||||
for cursor_event in cursor_moved.read() {
|
||||
mouse_state.x = cursor_event.position.x;
|
||||
mouse_state.y = cursor_event.position.y;
|
||||
dioxus_doc.handle_event(UiEvent::MouseMove(BlitzMouseButtonEvent {
|
||||
dioxus_doc.handle_ui_event(UiEvent::MouseMove(BlitzMouseButtonEvent {
|
||||
x: mouse_state.x,
|
||||
y: mouse_state.y,
|
||||
button: Default::default(),
|
||||
@@ -408,7 +408,7 @@ fn handle_mouse_events(
|
||||
match event.state {
|
||||
ButtonState::Pressed => {
|
||||
mouse_state.buttons |= buttons_blitz;
|
||||
dioxus_doc.handle_event(UiEvent::MouseDown(BlitzMouseButtonEvent {
|
||||
dioxus_doc.handle_ui_event(UiEvent::MouseDown(BlitzMouseButtonEvent {
|
||||
x: mouse_state.x,
|
||||
y: mouse_state.y,
|
||||
button: button_blitz,
|
||||
@@ -418,7 +418,7 @@ fn handle_mouse_events(
|
||||
}
|
||||
ButtonState::Released => {
|
||||
mouse_state.buttons &= !buttons_blitz;
|
||||
dioxus_doc.handle_event(UiEvent::MouseUp(BlitzMouseButtonEvent {
|
||||
dioxus_doc.handle_ui_event(UiEvent::MouseUp(BlitzMouseButtonEvent {
|
||||
x: mouse_state.x,
|
||||
y: mouse_state.y,
|
||||
button: button_blitz,
|
||||
@@ -495,10 +495,10 @@ fn handle_keyboard_events(
|
||||
|
||||
match key_state {
|
||||
KeyState::Pressed => {
|
||||
dioxus_doc.handle_event(UiEvent::KeyDown(blitz_key_event));
|
||||
dioxus_doc.handle_ui_event(UiEvent::KeyDown(blitz_key_event));
|
||||
}
|
||||
KeyState::Released => {
|
||||
dioxus_doc.handle_event(UiEvent::KeyUp(blitz_key_event));
|
||||
dioxus_doc.handle_ui_event(UiEvent::KeyUp(blitz_key_event));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ tracing = ["dep:tracing-subscriber", "dioxus-native-dom/tracing"]
|
||||
|
||||
[dependencies]
|
||||
dioxus = { workspace = true, default-features = false, features = ["html", "hooks", "signals"] }
|
||||
dioxus-native-dom = { path = "../../packages/native-dom" }
|
||||
anyrender_vello = "0.4.1"
|
||||
dioxus-native-dom = { workspace = true }
|
||||
anyrender_vello = { workspace = true }
|
||||
vello = "0.5"
|
||||
rustc-hash = "1"
|
||||
futures-util = { workspace = true }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! (this example is not really intended to be run as-is, and requires you to fill
|
||||
//! in the missing pieces)
|
||||
use anyrender_vello::{wgpu_context::WGPUContext, CustomPaintSource, VelloScenePainter};
|
||||
use blitz_dom::Document as _;
|
||||
use blitz_dom::{Document as _, DocumentConfig};
|
||||
use blitz_paint::paint_scene;
|
||||
use blitz_traits::{
|
||||
events::{BlitzMouseButtonEvent, MouseEventButton, MouseEventButtons, UiEvent},
|
||||
@@ -49,8 +49,13 @@ fn main() {
|
||||
// Create the dioxus virtual dom and the dioxus-native document
|
||||
// It is important to set the width, height, and scale factor on the document as these are used for layout.
|
||||
let vdom = VirtualDom::new(app);
|
||||
let mut dioxus_doc = DioxusDocument::new(vdom, None);
|
||||
dioxus_doc.set_viewport(Viewport::new(WIDTH, HEIGHT, SCALE_FACTOR, COLOR_SCHEME));
|
||||
let mut dioxus_doc = DioxusDocument::new(
|
||||
vdom,
|
||||
DocumentConfig {
|
||||
viewport: Some(Viewport::new(WIDTH, HEIGHT, SCALE_FACTOR, COLOR_SCHEME)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
// Setup a WGPU Device and Queue
|
||||
//
|
||||
@@ -95,7 +100,7 @@ fn main() {
|
||||
// =============
|
||||
|
||||
// Poll the vdom
|
||||
dioxus_doc.poll(Context::from_waker(&waker));
|
||||
dioxus_doc.poll(Some(Context::from_waker(&waker)));
|
||||
|
||||
// Create a `VelloScenePainter` to paint into
|
||||
let mut custom_paint_sources =
|
||||
@@ -151,7 +156,7 @@ fn main() {
|
||||
buttons: MouseEventButtons::Primary, // keep track of all pressed buttons
|
||||
mods: Modifiers::empty(), // ctrl, alt, shift, etc
|
||||
});
|
||||
dioxus_doc.handle_event(event);
|
||||
dioxus_doc.handle_ui_event(event);
|
||||
|
||||
// Trigger a poll via your event loop (or wait for next frame)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user