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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
//! Use the API Documentation below to learn about the various things you can do with this crate. //! //! **If this is your first time using Rust or using this crate, read the Guide on //! [turtle.rs](http://turtle.rs) to learn how to start.** //! //! * The [`Turtle` struct](struct.Turtle.html) - lists of all the various drawing commands that the //! turtle supports //! * The [`Drawing` struct](struct.Drawing.html) - allows you to manipulate the title, size, //! background and more of the drawing that you are creating //! * The [`color` module](color/index.html) - describes the different ways to create colors and //! includes a list of the hundreds of predefined color names that you can use to easily set the //! pen, fill, and background color of your drawings //! //! Note: Call [`turtle::start()`](fn.start.html) if you do not create a turtle with //! [`Turtle::new()`](struct.Turtle.html#method.new) right at the beginning of your program. Most //! programs will never need to call this function as it is called for you in //! [`Turtle::new()`](struct.Turtle.html#method.new). //! //! # Random Values //! //! See the [`rand` module](rand/index.html) for information about generating random colors, speeds, //! angles, and more which can be used in your programs to produce some interesting results! //! //! # Event Handling //! //! The [`Event` enum](event/enum.Event.html) documentation provides information about how you can //! create an event loop. This allows you to draw things in response to certain events like the //! mouse moving, keys being pressed, and more. //! //! The `Turtle` struct contains a few convenience methods so you can do some common event-related //! things without creating the entire event loop. For example, use //! [`wait_for_click()`](struct.Turtle.html#method.wait_for_click) to wait for the user to click //! anywhere on the screen before proceeding. //! # Unstable features //! Some parts of this library are unstable, such as maximizing and unmaximizing the window. //! You can explicitly opt-in to using those features with the `unstable` feature like so: //! //! ```bash //! $ cargo build --features "unstable" //! ``` //! //! If you want to use this from inside your own crate, you will need to add this to your Cargo.toml //! ```toml //! [dependencies] //! turtle = { version = "...", features = ["unstable"] } //! ``` #![doc(html_logo_url = "https://raw.githubusercontent.com/sunjay/turtle/master/docs/assets/images/turtle-logo-512.png")] #![cfg_attr(target_arch = "wasm32", crate_type = "cdylib")] #[cfg(all(test, not(feature = "test")))] compile_error!("Make sure you run tests with `cargo test --features test`"); mod turtle_window; mod animation; #[cfg(not(target_arch = "wasm32"))] mod app; mod drawing; mod extensions; #[cfg(not(target_arch = "wasm32"))] mod messenger; mod point; mod query; mod radians; #[cfg(not(target_arch = "wasm32"))] mod renderer; mod renderer_process; #[cfg(not(target_arch = "wasm32"))] mod server; mod speed; mod state; mod timer; mod turtle; pub mod color; #[cfg(not(target_arch = "wasm32"))] pub mod event; #[cfg(target_arch = "wasm32")] mod event { use serde::{Serialize, Deserialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum Event {} } pub mod rand; pub use crate::color::Color; pub use crate::drawing::{Drawing, Size}; pub use crate::event::Event; pub use crate::point::Point; #[cfg(target_arch = "wasm32")] pub use renderer_process::{alloc, dealloc, dealloc_str}; pub use crate::speed::Speed; pub use crate::turtle::{Angle, Distance, Turtle}; #[cfg(not(target_arch = "wasm32"))] pub use crate::server::start; #[cfg(target_arch = "wasm32")] pub fn start() {}