- Added tessellation module to handle path tessellation using Lyon. - Updated execution logic to record fill vertices and manage fill contours. - Integrated tessellation into command execution for lines, arcs, and filled shapes. - Enhanced TurtleState to track fill state and contours. - Modified TweenController to handle fill commands and update drawing commands accordingly. - Improved debug output for fill operations and tessellation processes.
48 lines
1.0 KiB
Rust
48 lines
1.0 KiB
Rust
//! Simple square example demonstrating basic turtle graphics
|
|
|
|
use macroquad::prelude::*;
|
|
use turtle_lib_macroquad::*;
|
|
|
|
#[macroquad::main("Turtle Square")]
|
|
async fn main() {
|
|
// Create a turtle plan
|
|
let mut t = create_turtle();
|
|
t.set_speed(900);
|
|
|
|
t.circle_left(90.0, 180.0, 36);
|
|
t.begin_fill();
|
|
t.circle_left(90.0, 180.0, 36);
|
|
t.circle_left(45.0, 180.0, 26);
|
|
t.circle_right(45.0, 180.0, 26);
|
|
t.pen_up();
|
|
t.right(90.0);
|
|
t.forward(37.0);
|
|
t.left(90.0);
|
|
t.pen_down();
|
|
t.circle_right(8.0, 360.0, 12);
|
|
t.pen_up();
|
|
t.right(90.0);
|
|
t.forward(90.0);
|
|
t.left(90.0);
|
|
t.pen_down();
|
|
t.circle_right(8.0, 360.0, 12);
|
|
t.end_fill();
|
|
|
|
// Set animation speed
|
|
t.set_speed(1000);
|
|
|
|
// Create turtle app with animation (speed = 100 pixels/sec)
|
|
let mut app = TurtleApp::new().with_commands(t.build());
|
|
|
|
// Main loop
|
|
loop {
|
|
clear_background(WHITE);
|
|
|
|
// Update and render
|
|
app.update();
|
|
app.render();
|
|
|
|
next_frame().await
|
|
}
|
|
}
|