remove examples that are too much...
This commit is contained in:
parent
cef63ca32a
commit
6d7d3fc434
@ -1,13 +0,0 @@
|
|||||||
//! Test direction and movement commands
|
|
||||||
|
|
||||||
use turtle_lib_macroquad::*;
|
|
||||||
|
|
||||||
#[turtle_main("Direction Test")]
|
|
||||||
fn draw(turtle: &mut TurtlePlan) {
|
|
||||||
// Set animation speed
|
|
||||||
turtle.set_speed(50);
|
|
||||||
turtle.right(45.0);
|
|
||||||
turtle.forward(100.0);
|
|
||||||
turtle.right(45.0);
|
|
||||||
turtle.forward(100.0);
|
|
||||||
}
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
//! Fill demonstration with holes
|
|
||||||
|
|
||||||
use turtle_lib_macroquad::*;
|
|
||||||
|
|
||||||
#[turtle_main("Fill Demo")]
|
|
||||||
fn draw(turtle: &mut TurtlePlan) {
|
|
||||||
// Example from requirements: circle with hole (like a donut)
|
|
||||||
turtle.set_pen_color(BLUE);
|
|
||||||
turtle.set_pen_width(3.0);
|
|
||||||
turtle.right(90.0);
|
|
||||||
|
|
||||||
// Set fill color and begin fill
|
|
||||||
turtle.set_fill_color(RED);
|
|
||||||
turtle.begin_fill();
|
|
||||||
|
|
||||||
// Outer circle
|
|
||||||
turtle.circle_right(150.0, 360.0, 72);
|
|
||||||
|
|
||||||
// Move to start of inner circle (hole)
|
|
||||||
// pen_up doesn't matter for fill - vertices still recorded!
|
|
||||||
turtle.pen_up();
|
|
||||||
turtle.forward(50.0);
|
|
||||||
turtle.pen_down();
|
|
||||||
|
|
||||||
// Inner circle (creates a hole)
|
|
||||||
turtle.circle_right(150.0, 360.0, 72);
|
|
||||||
|
|
||||||
turtle.end_fill();
|
|
||||||
|
|
||||||
// Draw a square with no fill
|
|
||||||
turtle.pen_up();
|
|
||||||
turtle.forward(100.0);
|
|
||||||
turtle.pen_down();
|
|
||||||
turtle.set_pen_color(GREEN);
|
|
||||||
|
|
||||||
for _ in 0..4 {
|
|
||||||
turtle.forward(100.0);
|
|
||||||
turtle.right(90.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set animation speed
|
|
||||||
turtle.set_speed(100);
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
//! Example matching the original requirements exactly
|
|
||||||
|
|
||||||
use turtle_lib_macroquad::*;
|
|
||||||
|
|
||||||
#[turtle_main("Fill Example - Original Requirements")]
|
|
||||||
fn draw(turtle: &mut TurtlePlan) {
|
|
||||||
turtle.right(90.0);
|
|
||||||
turtle.set_pen_width(3.0);
|
|
||||||
turtle.set_speed(900);
|
|
||||||
|
|
||||||
turtle.set_pen_color(BLUE);
|
|
||||||
turtle.set_fill_color(RED);
|
|
||||||
turtle.begin_fill();
|
|
||||||
|
|
||||||
turtle.circle_left(100.0, 360.0, 16);
|
|
||||||
|
|
||||||
// Draw a circle (36 small steps)
|
|
||||||
for _ in 0..36 {
|
|
||||||
turtle.forward(5.0);
|
|
||||||
turtle.right(10.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
turtle.end_fill();
|
|
||||||
|
|
||||||
// Draw a square with no fill
|
|
||||||
turtle.set_pen_color(GREEN);
|
|
||||||
turtle.forward(120.0);
|
|
||||||
for _ in 0..3 {
|
|
||||||
turtle.right(90.0);
|
|
||||||
turtle.forward(240.0);
|
|
||||||
}
|
|
||||||
turtle.right(90.0);
|
|
||||||
turtle.forward(120.0);
|
|
||||||
|
|
||||||
// Set speed for animation
|
|
||||||
turtle.set_speed(200);
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
//! Comprehensive macro example showing various turtle features
|
|
||||||
//!
|
|
||||||
//! This example demonstrates:
|
|
||||||
//! - Colors and pen settings
|
|
||||||
//! - Fills
|
|
||||||
//! - Circles
|
|
||||||
//! - Animation speed
|
|
||||||
|
|
||||||
use turtle_lib_macroquad::*;
|
|
||||||
|
|
||||||
#[turtle_main("Turtle Macro - Full Demo")]
|
|
||||||
fn full_demo(turtle: &mut TurtlePlan) {
|
|
||||||
// Draw a colorful flower
|
|
||||||
turtle.set_speed(200);
|
|
||||||
|
|
||||||
// Center the drawing
|
|
||||||
turtle.pen_up();
|
|
||||||
turtle.go_to(vec2(200.0, 300.0));
|
|
||||||
turtle.pen_down();
|
|
||||||
|
|
||||||
// Draw petals
|
|
||||||
for i in 0..8 {
|
|
||||||
let hue = i as f32 / 8.0;
|
|
||||||
let color = Color::from_rgba(
|
|
||||||
((hue * 360.0).to_radians().sin() * 127.0 + 128.0) as u8,
|
|
||||||
((hue * 360.0 + 120.0).to_radians().sin() * 127.0 + 128.0) as u8,
|
|
||||||
((hue * 360.0 + 240.0).to_radians().sin() * 127.0 + 128.0) as u8,
|
|
||||||
255,
|
|
||||||
);
|
|
||||||
|
|
||||||
turtle.set_fill_color(color);
|
|
||||||
turtle.set_pen_color(color);
|
|
||||||
turtle.begin_fill();
|
|
||||||
|
|
||||||
// Draw a petal using circles
|
|
||||||
turtle.circle_left(50.0, 180.0, 20);
|
|
||||||
turtle.left(90.0);
|
|
||||||
turtle.circle_left(50.0, 180.0, 20);
|
|
||||||
turtle.left(90.0);
|
|
||||||
|
|
||||||
turtle.end_fill();
|
|
||||||
|
|
||||||
// Move to next petal position
|
|
||||||
turtle.right(45.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw center circle
|
|
||||||
turtle.pen_up();
|
|
||||||
turtle.go_to(vec2(200.0, 300.0));
|
|
||||||
turtle.pen_down();
|
|
||||||
turtle.set_fill_color(YELLOW);
|
|
||||||
turtle.set_pen_color(ORANGE);
|
|
||||||
turtle.set_pen_width(2.0);
|
|
||||||
turtle.begin_fill();
|
|
||||||
turtle.circle_left(20.0, 360.0, 36);
|
|
||||||
turtle.end_fill();
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
//! Simple square example demonstrating basic turtle graphics
|
|
||||||
|
|
||||||
use turtle_lib_macroquad::*;
|
|
||||||
|
|
||||||
#[turtle_main("Turtle Square")]
|
|
||||||
fn draw(turtle: &mut TurtlePlan) {
|
|
||||||
turtle.shape(ShapeType::Turtle);
|
|
||||||
|
|
||||||
// Draw a square
|
|
||||||
for _ in 0..4 {
|
|
||||||
turtle.forward(100.0).right(90.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set animation speed
|
|
||||||
turtle.set_speed(50);
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user