forked from processing/libprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
40 lines (33 loc) · 1.01 KB
/
lib.rs
File metadata and controls
40 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
mod glfw;
use pyo3::prelude::*;
#[pymodule]
mod pycessing {
use crate::glfw::GlfwContext;
use processing::prelude::*;
use pyo3::prelude::*;
/// create surface
#[pyfunction]
fn size(width: u32, height: u32) -> PyResult<String> {
let mut glfw_ctx = GlfwContext::new(400, 400).unwrap();
init().unwrap();
let window_handle = glfw_ctx.get_window();
let display_handle = glfw_ctx.get_display();
let surface = surface_create(window_handle, display_handle, width, height, 1.0).unwrap();
while glfw_ctx.poll_events() {
begin_draw(surface).unwrap();
record_command(
surface,
DrawCommand::Rect {
x: 10.0,
y: 10.0,
w: 100.0,
h: 100.0,
radii: [0.0, 0.0, 0.0, 0.0],
},
)
.unwrap();
end_draw(surface).unwrap();
}
Ok("OK".to_string())
}
}