Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 169 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type_complexity = "allow"
too_many_arguments = "allow"

[workspace.dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", branch = "main" }
bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", features = ["file_watcher"] }
processing = { path = "." }
processing_pyo3 = { path = "crates/processing_pyo3" }
processing_render = { path = "crates/processing_render" }
Expand Down
25 changes: 25 additions & 0 deletions crates/processing_pyo3/src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ impl Topology {
}
}

#[pyclass]
pub struct Sketch {
pub source: String,
}

#[pymethods]
impl Geometry {
#[new]
Expand Down Expand Up @@ -121,6 +126,11 @@ impl Graphics {

let mut config = Config::new();
config.set(ConfigKey::AssetRootPath, asset_path.to_string());
config.set(
// TODO: this needs to be handed to us by python
ConfigKey::SketchRootPath,
"/home/moon/Code/libprocessing/crates/processing_pyo3/examples".to_string(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

);
init(config).map_err(|e| PyRuntimeError::new_err(format!("{e}")))?;

let surface = glfw_ctx
Expand All @@ -141,6 +151,21 @@ impl Graphics {
})
}

pub fn poll_for_sketch_update(&self) -> PyResult<Sketch> {
match poll_for_sketch_updates().map_err(|_| PyRuntimeError::new_err("SKETCH UPDATE ERR"))? {
Some(sketch) => Ok(Sketch {
source: sketch.source,
}),
None => Ok(Sketch {
source: "".to_string(),
}),
}

// Ok(Sketch {
// source: sketch.unwrap().source,
// })
}

pub fn background(&self, args: Vec<f32>) -> PyResult<()> {
let (r, g, b, a) = parse_color(&args)?;
let color = bevy::color::Color::srgba(r, g, b, a);
Expand Down
Loading
Loading