Skip to content

Rewrite internals of turtle crate #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 245 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
245 commits
Select commit Hold shift + click to select a range
afbd8da
Starting to define IPC in terms of async tokio. Spawned the renderer …
sunjay Apr 26, 2020
053aeaf
Deny unused must use to avoid missing Results/Futures
sunjay Apr 26, 2020
3c151b7
Performing the client-side of the handshake with the renderer server
sunjay Apr 27, 2020
991e0ae
Fixed client connection documentation
sunjay Apr 27, 2020
30d9bac
Added server connection, created an async version of IpcReceiver, and…
sunjay Apr 27, 2020
252128a
No need for unsafe because UnboundedReceiver is Unpin
sunjay Apr 27, 2020
3cfa86e
Added a note about what happens if the future from AsyncIpcReceiver i…
sunjay Apr 27, 2020
924b275
Added an explanation for how to fix the API if needed and why we aren…
sunjay Apr 27, 2020
e7e9851
Moved the server process to the client
sunjay Apr 27, 2020
90bf42c
Temporarily renamed renderer to renderer2 while its replacement is be…
sunjay Apr 27, 2020
722169c
Defined start() and moved RENDERER_PROCESS_ENV_VAR to RendererServerP…
sunjay Apr 27, 2020
aaba5cc
Started to define server main loop and Renderer in terms of glutin an…
sunjay Apr 29, 2020
8ae0f53
Added recv and send methods to ServerConnection
sunjay Apr 29, 2020
bbb92b9
More consistent AsyncIpcReceiver + no longer requiring &mut self on r…
sunjay Apr 29, 2020
87e7a94
Defining the complete specification for the IPC protocol messages
sunjay Apr 30, 2020
d4891a4
Broke send into send/recv on ClientConnection since not every request…
sunjay Apr 30, 2020
2d86b98
Added code for RendererServer that reads oneshot from stdin and estab…
sunjay Apr 30, 2020
9355b99
Spawning an async runtime and providing an event loop proxy to the se…
sunjay Apr 30, 2020
0c449fc
Renamed state to state2 so it can be rewritten
sunjay Apr 30, 2020
4fd6c5a
Starting to define state and defaults
sunjay Apr 30, 2020
8000ad5
Added request and response for getting a TurtleId
sunjay Apr 30, 2020
c5c0cd5
Moved renderer and state into renderer_server since neither is used o…
sunjay Apr 30, 2020
b8d36d5
Figuring out more of how to store turtles in the app
sunjay May 1, 2020
fd2e7bc
Solved problem with nested locking by wrapping inner TurtleDrawings i…
sunjay May 1, 2020
9d8eaa4
Using glutin event_loop.run to drive the event loop
sunjay May 1, 2020
e762eac
Forgot to spawn tokio runtime in its own thread so it doesn't block t…
sunjay May 1, 2020
03c8fb2
Passing App to the server thread and making it available for the even…
sunjay May 1, 2020
0e75f08
Setup double buffering
sunjay May 1, 2020
b2a503f
Passing the display list to the renderer
sunjay May 1, 2020
6539086
Starting to implement server process request handling
sunjay May 1, 2020
19e5810
Passing a client ID with each request/response to allow for easy mult…
sunjay May 1, 2020
95778b0
Defined and documented request sequencer
sunjay May 1, 2020
dcdf86f
Separated display list from the rest of the state since it is shared …
sunjay May 2, 2020
aa1b4dd
Did not really need a struct for the RendererServer
sunjay May 2, 2020
3e087b4
Created an AccessControl struct for maintaining lock sequencing guara…
sunjay May 2, 2020
2e5488d
Started to work on using Slab, but it didn't really work out for simi…
sunjay May 2, 2020
0fff47a
Revert "Started to work on using Slab, but it didn't really work out …
sunjay May 2, 2020
fc288a0
Starting to define the types that will control access to the state th…
sunjay May 2, 2020
4b561d7
Started to design data channels that will act as the basis for Access…
sunjay May 3, 2020
b263b01
Finished access control implementation using a pool of data access co…
sunjay May 3, 2020
005a1a4
Implementing export command using new AccessControl API
sunjay May 3, 2020
abe930e
Defining request handlers for getting/setting props on drawing
sunjay May 3, 2020
ef88f79
More consistent naming in DrawingProp/DrawingPropValue + better varia…
sunjay May 3, 2020
cbf2f7c
Request handling for TurtleProp/SetTurtleProp
sunjay May 3, 2020
d54abeb
Separating request handlers into their own files
sunjay May 3, 2020
4952b40
Moving server connection code to ipc protocol
sunjay May 3, 2020
bf8cb34
Added missing MoveTo request
sunjay May 3, 2020
0c48b17
Setup handlers for implementing animation
sunjay May 3, 2020
3ebcbbf
Added current fill polygon to TurtleDrawings + Disabling the ability …
sunjay May 3, 2020
680dd16
Making all handlers pub(crate) so that RequestRedraw can be used from…
sunjay May 3, 2020
abf7ff0
Removed unused variable
sunjay May 4, 2020
058daa5
Better naming for to_movement and to_rotation in Speed
sunjay May 4, 2020
68ab380
Implemented movement animation
sunjay May 4, 2020
9a01d81
Implemented rotation animation
sunjay May 4, 2020
02fd7dc
Removed `is_filling` from turtle state since it can be derived from `…
sunjay May 4, 2020
9fd02da
Handlers for begin fill and end fill
sunjay May 4, 2020
406a986
Tweaking wording in request documentation to not be single-turtle spe…
sunjay May 4, 2020
5935aef
More consistent import lists in handlers
sunjay May 4, 2020
c1dcb9f
Implementing clear request handling
sunjay May 4, 2020
26d5ebf
Noting some possible improvements in the code
sunjay May 4, 2020
cca56af
Added APIs to push into and update fill polygon, used that in animation
sunjay May 4, 2020
c10b187
Updating current fill polygon when fill color is set
sunjay May 4, 2020
6d9801a
Waiting for renderer process to finish in Drop for RendererServerProcess
sunjay May 4, 2020
9f2a577
Designed and implemented API for renderer client
sunjay May 4, 2020
fd171af
Added TODO for actually updating the window in response to changes to…
sunjay May 4, 2020
70292ba
Created a wrapper around RendererClient that provides a type-safe API…
sunjay May 4, 2020
1517ef2
Notifying main thread when turtle visibility changes
sunjay May 4, 2020
32d4656
New AsyncTurtle that provides an async version of the entire API of T…
sunjay May 4, 2020
3bbe142
Added TODO to replace `join_all` when tokio gets its own version
sunjay May 4, 2020
244a272
Added requests and handlers for resetting the drawing or turtle prope…
sunjay May 5, 2020
4ce22e9
Implementing home() and reset() on AsyncTurtle in terms of new reset …
sunjay May 5, 2020
db6af7c
Created a lazily-spawned global runtime
sunjay May 5, 2020
ce4ca8d
Switched to once_cell instead of lazy_static
sunjay May 5, 2020
f546c49
Re-implemented Turtle in terms of AsyncTurtle
sunjay May 5, 2020
03579a8
Starting to setup AsyncDrawing
sunjay May 5, 2020
023d9da
Failed attempt at drawing() and drawing_mut() methods on Turtle (woul…
sunjay May 5, 2020
d8a9856
Revert "Failed attempt at drawing() and drawing_mut() methods on Turt…
sunjay May 5, 2020
19beb16
Publically exporting ExportError since it will be used in save_svg
sunjay May 5, 2020
569e284
Implementing async drawing
sunjay May 5, 2020
6b785a7
Re-implemented Drawing in terms of AsyncDrawing
sunjay May 5, 2020
7b4f680
Publically exposing renderer_server::start() instead of the old serve…
sunjay May 5, 2020
42db2bb
Removed majority of old code and cleaned up public API
sunjay May 5, 2020
8ae8605
Removed piston_window dependency and stubbed out event enums for now
sunjay May 5, 2020
9e28db8
Deleting dead code and explicitly marking dead code that is meant for…
sunjay May 5, 2020
b9ecfc3
Adding import that was needed to get lib tests compiling
sunjay May 5, 2020
978a376
Updated rand to 0.7
sunjay May 5, 2020
8319b33
Updated to latest version of glutin
sunjay May 5, 2020
7179f9f
Updated to latest version of svg crate
sunjay May 5, 2020
e10786e
Implementing display list in terms of a BTreeMap
sunjay May 5, 2020
3225a78
Removed remaining remnants of WASM support (hard to maintain it right…
sunjay May 5, 2020
6c8a73e
Utility function for converting from Color to ColorF
sunjay May 5, 2020
41325f7
Defining conversion between logical/world coordinates (Point) to scre…
sunjay May 5, 2020
d65b19f
Passing drawing state to renderer and using it to specify background …
sunjay May 5, 2020
fbe5503
Setup renderer to respond to changes in the scale factor
sunjay May 5, 2020
21fc320
Implemented main rendering algorithm
sunjay May 5, 2020
59f9cbc
Merging Line and LineProps + making better use of pattern matching
sunjay May 5, 2020
965dc69
Need to call start() at the top of the program or turtle becomes a fo…
sunjay May 5, 2020
b977fa9
Need to call start() before first block_on or else we might accidenta…
sunjay May 5, 2020
a7ea50f
Need to use a basic runtime on main thread since full runtime is spaw…
sunjay May 5, 2020
ba62e5e
Need to set ControlFlow to Wait or it will keep Poll forever
sunjay May 5, 2020
1e1bcab
Future proofing with RendererOptions::default()
sunjay May 5, 2020
48f4c54
Need to draw *something* every time in order to get pathfinder to ren…
sunjay May 5, 2020
432d930
Updated check in start() to use deref instead of allocating
sunjay May 5, 2020
1f8d9b8
Using write_all instead of write and write_u8. This ensure that entir…
sunjay May 5, 2020
b7d45f3
server process only spawns a single runtime now -- shared through a h…
sunjay May 6, 2020
33d7f50
Don't need wrapper thread to use spawn
sunjay May 6, 2020
418e23c
Need rt-threaded feature enabled to use the threaded scheduler
sunjay May 6, 2020
e54e6aa
Always need to create handle in a thread managed by tokio
sunjay May 6, 2020
b0ad089
Accidentally used from_millis instead of from_micros
sunjay May 6, 2020
1fdbace
Need to spawn a new runtime in Drop because the original runtime may …
sunjay May 6, 2020
d704460
Drawing turtles + splitting redraw into its own async function (avoid…
sunjay May 7, 2020
a3bea39
Correctly retrieving the initial dpi scale factor
sunjay May 7, 2020
d955cd5
Implemented SVG export
sunjay May 7, 2020
8e18b2b
Using custom events to update the window based on changes to the Draw…
sunjay May 7, 2020
7d64e03
Refactoring all handlers to return a result instead of using expect
sunjay May 7, 2020
476e10e
Locking turtles in export even though they aren't used (guarantees th…
sunjay May 7, 2020
db0d7e0
Revert "Locking turtles in export even though they aren't used (guara…
sunjay May 7, 2020
819f8e6
Simplified access control to only use a single channel for data ready
sunjay May 7, 2020
7d84a1e
Compiling dependencies with optimizations has minimal impact on per-c…
sunjay May 7, 2020
30a7e8d
Re-writing child process finalization logic
sunjay May 9, 2020
e4a2d13
Need to send request redraw after animation loop in case the loop nev…
sunjay May 10, 2020
3f3f221
Spawning the IPC thread after the window opens to make the turtle wai…
sunjay May 10, 2020
bdeb84b
Two bugs in create turtle handler: 1) need to send redraw request and…
sunjay May 10, 2020
ad2c06e
Better explanation of what causes ::new() methods to now wait until t…
sunjay May 10, 2020
615fb6f
Rate limiting rendering to avoid rendering too often and creating loc…
sunjay May 10, 2020
2888b78
Always optimizing builds of the turtle crate (debug performance isn't…
sunjay May 10, 2020
791e326
Forwarding IpcError::Disconnected instead of just breaking the loop
sunjay May 10, 2020
d7cba04
Do not panic if unable to send response back to a particular client
sunjay May 10, 2020
8c4ba97
Realized there was no need to propagate ipc_channel::Error if all we …
sunjay May 10, 2020
5eddeee
Having the renderer client cooperate in shutting down tasks after the…
sunjay May 10, 2020
b3b0355
Using a remote handle to ensure that the window is closed when the st…
sunjay May 10, 2020
5cd9700
Updated window closed panic message to indicate that it is not an error
sunjay May 10, 2020
3319ba4
Abstracted Mutex<EventLoopProxy<MainThreadAction>> into a struct to a…
sunjay May 11, 2020
9aa7dfa
Added a mock main() and EventLoopNotifier for test purposes
sunjay May 11, 2020
4b00883
Moved renderer_server_process out of renderer_client module and prepa…
sunjay May 11, 2020
7b758a4
Defining a test version of RendererServerProcess that uses a task ins…
sunjay May 11, 2020
2dfba85
Ignoring failed send in DataGuard since it may fail after a panic whe…
sunjay May 11, 2020
0eb0fcf
Being unable to create a window is not a bug but not spawning the sub…
sunjay May 11, 2020
e87000e
Better error if user accidentally opens window outside main thread by…
sunjay May 12, 2020
fe9b98c
Handling handling errors after dispatched handler has finished running
sunjay May 12, 2020
58d2abf
Making event enums non-exhaustive
sunjay May 12, 2020
c2c3eb5
Somewhat misguided API for being able to handle when IPC is disconnec…
sunjay May 13, 2020
c53daf2
Revert "Somewhat misguided API for being able to handle when IPC is d…
sunjay May 13, 2020
6dc19c5
Handling poll event requests
sunjay May 13, 2020
63b6423
Defining conversion from WindowEvent to turtle::Event
sunjay May 13, 2020
e8699dd
DeviceEvent is not needed for the turtle event API
sunjay May 13, 2020
a6b5cf8
Removed useless casts from u32 to u32
sunjay May 13, 2020
5b18c7f
Do not want to commit to Event being Copy just yet
sunjay May 13, 2020
1402659
Updating Drawing state in response to WindowEvent
sunjay May 13, 2020
858f058
Updated arrowkeys example to use events API
sunjay May 13, 2020
4168781
Using granular cfg_attr attributes to allow dead_code on items that w…
sunjay May 13, 2020
b6b805b
Figuring out how to get nice annotations for the available features w…
sunjay May 14, 2020
1dbb6bb
Stabilizing maximize and unmaximize because it is unclear why they ar…
sunjay May 14, 2020
f762c11
Fixed typo in Cargo.toml
sunjay May 14, 2020
11010ad
Avoid encouraging people to build docs with --all-features as --featu…
sunjay May 14, 2020
f49e52f
Rewriting documentation about how to use unstable features
sunjay May 14, 2020
cc788f6
Marking all parts of the events API as unstable
sunjay May 14, 2020
5148083
Conditional documentation for pointing out that docs need to be built…
sunjay May 14, 2020
57f2696
Implemented wait_for_click
sunjay May 14, 2020
535aace
Enabling unstable feature in azure pipelines CI
sunjay May 14, 2020
56b0ce8
Fixing build warnings when building without --features "unstable"
sunjay May 14, 2020
6847604
Removed drawing() and drawing_mut() methods + updated all examples
sunjay May 14, 2020
b4f0215
Documenting the new way you're meant to access the Drawing
sunjay May 14, 2020
33b0dab
Documenting that you probably don't want Drawing::new() and Turtle::n…
sunjay May 14, 2020
8d1263b
Always treating speed as instant in animations during tests
sunjay May 14, 2020
1e0d1d7
Updating all calls to drawing/drawing_mut to use new API
sunjay May 14, 2020
78f591c
Moving most of the runtest example into actual unit tests
sunjay May 14, 2020
e510a1e
Doing most of the validation at the level of the protocol client + ad…
sunjay May 14, 2020
067553f
Marking save_svg test as no_run because we don't actually want it to …
sunjay May 14, 2020
984f433
move_to is allowed to move to any finite position, even (0, 0)
sunjay May 14, 2020
2b1c3cb
Noting in documentation and in error messages that tests should be co…
sunjay May 14, 2020
0f0ab9d
Resetting a turtle does not reset the drawing
sunjay May 14, 2020
7237f7d
IPC thread may exit before main thread finishes if main process finis…
sunjay May 14, 2020
9eb5525
Noting that runtest doesn't currently work since it can't close the w…
sunjay May 14, 2020
f1502e0
Thread-safe wrapper around IpcOneShotServer::new() which did not end …
sunjay May 14, 2020
de904eb
Revert "Thread-safe wrapper around IpcOneShotServer::new() which did …
sunjay May 14, 2020
fd48493
Using a oneshot channel to synchronize ordering and ensure that each …
sunjay May 14, 2020
047003f
Producing a helpful compiler error when examples using unstable featu…
sunjay May 14, 2020
44bbf1f
Noting in the guide that you should compile turtle with optimizations
sunjay May 14, 2020
da83ec1
Noting in the crate documentation that you should compile with optimi…
sunjay May 14, 2020
9b01792
No need for forward + backward trick in colored_spiral example
sunjay May 14, 2020
35881b4
Extracting coordinate system transformation into its own module
sunjay May 14, 2020
afbc101
Conversion from screen coordinates to logical coordinates
sunjay May 15, 2020
55faf79
Partial work on moving WindowEvent->Event conversion to poll_event ha…
sunjay May 15, 2020
09df443
Revert "Partial work on moving WindowEvent->Event conversion to poll_…
sunjay May 15, 2020
f7966c4
Correctly converting between screen coordinates and logical coordinat…
sunjay May 15, 2020
3b0db12
Updating heart example to use the right pen size and no longer requir…
sunjay May 15, 2020
50ece46
Accidentally used DeviceEvent to detect Esc and made it so any Esc pr…
sunjay May 15, 2020
7197393
Doubling pen size in examples to account for pen thickness bug that w…
sunjay May 15, 2020
f425599
No longer using forwards then backwards trick for drawing smooth curves
sunjay May 15, 2020
154b5dd
Fixing gradient example so it doesn't go so far out of bounds
sunjay May 15, 2020
c62f54c
Made rotation/speed tests a little more robust and printed actual tim…
sunjay May 15, 2020
3867cb4
Making sure in CI that all examples build without test feature (but s…
sunjay May 15, 2020
309fd00
No longer always waiting an entire frame length when the animation is…
sunjay May 15, 2020
3822aa1
Need to take abs of angle for total duration because time is positive…
sunjay May 15, 2020
dac4a66
Removed broken say thanks badge and added tokei line count badge
sunjay May 15, 2020
57686ed
Defining speeds to get a linear decrease in time as speed increases
sunjay May 16, 2020
c3f642e
Script for generating graphs of data from rotationtest, rotationtest2…
sunjay May 16, 2020
e0511e2
Allowing multiple turtles if the unstable feature is on
sunjay May 16, 2020
6237952
Created an example that load tests the IPC connection
sunjay May 16, 2020
a09c22b
Making RendererServerProcess interface more general in prep for in-pr…
sunjay May 16, 2020
c6ed07c
Renamed desktop backend to multiprocessed and added a multithreaded b…
sunjay May 16, 2020
ae8a21f
Large refactor to expose different platform-specific backends: multip…
sunjay May 19, 2020
25f7f70
Fixed typo in EventLoopExtWindows import
sunjay May 19, 2020
bc05c64
Must exit after run_main() since it returns now
sunjay May 19, 2020
b259ff9
Need to keep RendererServer owned by ClientDispatcher and not referen…
sunjay May 21, 2020
b229870
Merged RendererServer and RendererServerProcess structs since there w…
sunjay May 21, 2020
baf86dd
Removed unnecessary child_stdin field from RendererServer
sunjay May 21, 2020
73fa321
Backends no longer manage the connection
sunjay May 22, 2020
7166bf8
Implemented multithreaded (multitasked?) backend
sunjay May 22, 2020
2bcaa58
Removed unused event_loop_quit future
sunjay May 22, 2020
c279d9d
Having the server task cooperate with the main thread/task in shuttin…
sunjay May 22, 2020
f40ccf0
Ensuring that main thread check only executes once in start()
sunjay May 22, 2020
bb3889d
Using unwrap_or(()) to ignore errors instead of a full match
sunjay May 22, 2020
349122f
Using `while let` instead of `loop` in AccessControl
sunjay May 22, 2020
780d504
Added a note about how polling for events from multiple places does n…
sunjay May 22, 2020
5725366
Accidentally committed some commented out code with typo fix
sunjay May 22, 2020
3d0275a
Minimal set of tokio features
sunjay May 22, 2020
e331fa2
Fixed typo in IPC protocol docs
sunjay May 23, 2020
af83156
Changing if+panic into assertion
sunjay May 23, 2020
23b7740
AsyncIpcReceiver does not implement Stream
sunjay May 23, 2020
1fd915e
Better explanation of sequential consistency of requests and the reso…
sunjay May 23, 2020
308adff
Clarifying CreateTurtle request description
sunjay May 23, 2020
363b6fd
Split Clear request into ClearAll and ClearTurtle
sunjay May 23, 2020
73c42a9
Using cfg_if! in more places now that we have it as a dependency anyway
sunjay May 23, 2020
39f65f2
Realized that "dispatch" was a more appropriate word than "multiplex"
sunjay May 23, 2020
408fb51
Improving documentation in ClientDispatcher fields
sunjay May 23, 2020
d3aa61a
Clarifying documentation in renderer_server
sunjay May 23, 2020
6040301
Rewriting module comment in access_control
sunjay May 23, 2020
eeab642
Using join!() and join_all() in more places to await concurrently
sunjay May 23, 2020
6fd3829
Rewriting the documentation and comments for DataRequest and DataChannel
sunjay May 23, 2020
948e61b
Fixed unsoundness in AccessControl when processing RequiredTurtles::All
sunjay May 23, 2020
83d159b
Adding and clarifying comments in app.rs
sunjay May 23, 2020
81a244d
Clarifying negative and positive directions in coords
sunjay May 23, 2020
5fd7e33
Allowing EventLoopNotifier to be cloned. Now it is lock-free and we a…
sunjay May 23, 2020
927d169
Split ClientConnection into a (ClientSender, ClientReceiver) pair and…
sunjay May 24, 2020
60dcf63
Updated DisplayList expect() messages so they actually make sense
sunjay May 24, 2020
8cbeced
Moved connect_server_stdin to multiprocessed backend since it isn't u…
sunjay May 24, 2020
22bb333
Clarifying comments in main.rs
sunjay May 25, 2020
9f11c0f
Removed unnecessary request_redraw() calls in event loop
sunjay May 25, 2020
5f0a0d1
Tweaking comments in main.rs
sunjay May 25, 2020
ca07ca1
Only converting fb_center into ScreenPoint once
sunjay May 25, 2020
ead3a9b
Need to request redraw after changing background or center
sunjay May 25, 2020
13ab209
Added detailed CHANGELOG that lists changes from all previous releases
sunjay May 25, 2020
d890bdf
Updated release checklist to include updating the CHANGELOG
sunjay May 25, 2020
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
perf.data*
flame.svg
*.wat
*.svg

# For rotation/speed tests
*test*.data
*test*.png

# Created by https://www.gitignore.io/api/rust

Expand Down
328 changes: 328 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

* New `new` and `add_turtle` methods on `Drawing` allow you to create a drawing
and a turtle at the center of it
* This API will eventually enable us to have support for multiple turtles
drawing at the same time
* First few pages of the new guide have been published on https://turtle.rs/guide

### Changed

* The recommended way to add the turtle crate to your `Cargo.toml` file has
changed to include `opt-level = 3` for dependencies only. This is necessary
because debug performance of turtle and other crates is not very good. This
change increases the initial build time for any application using the turtle
crate as a dependency, but should not affect incremental builds after that.
See the [docs] or the [guide] for more detailed instructions.
```toml
[profile.dev.package."*"]
opt-level = 3
```
* Closing the window no longer calls `process::exit`. That means that you can
create multiple windows which can be closed independently. If you continue to
use a turtle after the window has closed, the thread will panic since there is
no where to continue drawing the picture. This panic stops the current thread,
but is not necessarily an "error". Make sure to use `turtle::start()` if you
plan to call `Turtle::new()` or `Drawing::new()` in a separate thread.
* The `Event` enum has changed considerably now that we've moved to glutin, but
most of the same events are still available with minor changes to existing code
* `Event` and some of its related enums are now marked [`#[non_exhaustive]`](https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute).
That means that we will be able to add further variants in the future if
needed without it being a breaking change.
* `Event` and its related enums are now entirely part of the turtle crate. We no
longer re-export parts of the `piston_window` crate (and in fact do not rely
on `piston_window` at all anymore).
* The `event` module, `Event`, and all related enums are now unstable and you
need to use the `unstable` feature in your `Cargo.toml` to enable them. These
may change as we figure out what event handling should look like in the turtle
crate.
* The pen used by the turtle is now circular and has circular ends at higher pen
thicknesses. This matches the behaviour of the Python turtle module and is
useful for being able to smoothly draw curves and circles using the turtle crate.
* The `save_svg` method on `Drawing` returns a `Result` type now
* The `set_pen_size` method no doubles the given thickness value
* This means that you may have to adjust your program to set the pen thickness
to double the value you were setting previously
* The `Speed` levels change the amount of time it takes to draw something linearly
* This may change again in the future as we decide how to best use the different
speed levels
* The `set_fill_color` method updates the currently filling shape, even after
`begin_fill` has been called
* Previously, you could only set the fill color *before* `begin_fill` was called
* The bits example in `examples/bits.rs` has been updated to bitvec 0.17

### Removed

* `drawing` and `drawing_mut` methods have been removed due to soundness issues
that these methods would introduce when multiple turtle support is added.
Use `Drawing::new()` and `drawing.add_turtle()` instead to get access to the
drawing.

### Fixed

* [#30](https://github.com/sunjay/turtle/issues/30) - **potentially breaking:**
fill polygons now start at the current position when `begin_fill()` is called.
We previously had a bug where we would start at the end of the next line after
`begin_fill()` was called.

## [1.0.0-rc.3] - 2019-12-11

### Added

* New `is_filling` method on `Turtle` struct
* New simplified `rand` module which provides a simple, stable interface for
generating random numbers
* New `save_svg` method on `Drawing` for exporting the current drawing to SVG
* New geometric art example in `examples/geometric_art.rs`
* New star example in `examples/star2.rs` for drawing a star with any number of
points
* New bits example in `examples/bits.rs` to visualize binary numbers using
turtle and the bitvec crate

### Changed

* Crate now uses the 2018 edition of Rust
* `turtle::rand::random_range` now has an inclusive upper bound

### Removed

* The `rand` crate is no longer re-exported from the `rand` module
* Methods from `rand` are no longer re-exported from the crate root
* Import from the `rand` module instead

### Fixed

* [#92](https://github.com/sunjay/turtle/issues/92) - `wait_for_click` no longer
results in very high CPU usage (fixed busy waiting)

## [1.0.0-rc.2] - 2018-08-15

### Added

* New website: https://turtle.rs
* New methods on `Color`
* `rgb`
* `rgba`
* `hsl`
* `hsla`
* `hue`
* `saturation`
* `lightness`
* `mix`
* `rotate_hue`
* `lighten`
* `darken`
* `saturate`
* `desaturate`
* `grayscale`
* `complement`
* `invert`
* LOGO interpreter example in `examples/logo_interpreter.rs` now supports the
following additional commands:
* `home`
* `setx`
* `sety`
* `setheading` / `seth`
* `showturtle` / `st`
* `hideturtle` / `ht`
* `clean`
* `clearscreen` / `cs`
* `pendown` / `pd`
* `penup` / `pu`
* `setpensize` / `setwidth` / `setpw`
* New colored spiral example in `examples/colored_spiral.rs`

### Changed

* squares example in `examples/squares.rs` now draws a colorful red/white flower
with square petals

## [1.0.0-rc.1] - 2018-03-10

### Added

* New `Point` type that replaces the previous `Point = [f64; 2]` type alias
* New fractal tree example in `examples/tree.rs`
* New example in `examples/draw_turtle.rs` of drawing a child's drawing of a
turtle

### Changed

* `0` can no longer be passed to `set_speed`, use `"instant"` or
`Speed::instant()` instead

### Fixed

* [#63](https://github.com/sunjay/turtle/issues/63) - Disabling srgb to avoid
pixel format errors

## [1.0.0-alpha.8] - 2017-12-22

### Added

* New `Drawing` struct to manage properties of the drawing/window
* New `drawing` and `drawing_mut` methods on the `Turtle` struct to allow you
to access the new `Drawing` struct
* New methods on `Drawing` struct
* `center`
* `set_center`
* `reset_center`
* `title`
* `set_title`
* `size`
* `set_size`
* `reset_size`
* `maximize` (unstable)
* `unmaximize` (unstable)
* `is_maximized` (unstable)
* `enter_fullscreen`
* `exit_fullscreen`
* `is_fullscreen`
* New `Size` struct for use with `size` and `set_size` methods on `Drawing`
* `with_alpha` method to `Color` for creating a new color with a desired alpha
value
* Added LOGO interpreter example in `examples/logo_interpreter.rs` with support
for a few basic commands like `fd`/`forward`, `bk`/`back`, `lt`/`left`, and
`rt`/`right`

### Changed

* The `background_color` and `set_background_color` methods on `Turtle` have
moved to the new `Drawing` struct
* Use `turtle.drawing().background_color()` instead of `turtle.background_color()`
* Use `turtle.drawing_mut().set_background_color(...)` instead of `turtle.set_background_color(...)`
* The `poll_event` method on `Turtle` has moved to the new `Drawing` struct
* Use `turtle.drawing_mut().poll_event()` instead of `turtle.poll_event()`
* Renamed fields of `WindowResized` event to `width` and `height` instead of
`x` and `y`
* Code is now licensed under MPL 2.0 instead of MIT license

### Fixed

* [#8](https://github.com/sunjay/turtle/issues/8) - the `turn_towards` method
now works correctly and as expected

## [1.0.0-alpha.7] - 2017-12-4

### Added

* New star example in `examples/empty_star.rs` that draws the outline of a star
without needing any lines within it
* New dragon curve example in `examples/dragon.rs`

### Changed

* The maze example has moved from `examples/maze.rs` to `examples/maze.rs/main.rs`
now that multi-file examples are supported in Rust 1.22

### Fixed

* [#27](https://github.com/sunjay/turtle/issues/27) - the turtle crate now has
a two-process architecture which allows it to run on MacOS

## [1.0.0-alpha.6] - 2017-11-14

### Added

* New methods on the `Turtle` struct:
* `go_to`
* `set_x`
* `set_y`
* `set_heading`
* `home`
* `reset`
* `wait`
* New `turtle::rand::random_range` function for easily generating a random value
within a certain range
* New maze solving example in `examples/maze.rs`
* New snowflake example in `examples/snowflake.rs` using fractals
* New squares example in `examples/squares.rs` that creates a flower with square petals

### Changed

* Instead of re-exporting the `rand` crate from the root of the turtle crate,
it is now exposed from its own separate `rand` module
* Write `use turtle::rand::{Rand, Rng}` to use the new module

### Fixed

* Negative angles passed to `right()` and `left()` no longer result in very
long animation times (caused by integer overflow)

## [1.0.0-alpha.5] - 2017-10-29

### Added

* Added more documentation and tests for methods on the `Turtle` struct

### Removed

* `to_absolute` and `to_rotation` methods on `Speed` are private now as they
represent unstable implementation details that should not be relied on

## [1.0.0-alpha.4] - 2017-10-28

### Added

* Hexadecimal colors are now supported for use with the `Color` struct
* Floating point numbers (specifically `f64` values) can now be used in `set_speed`
* Added more documentation and tests for methods on the `Turtle` struct

## [1.0.0-alpha.3] - 2017-10-27

### Added

* Added `examples/nestedcubes.rs`
* Documentation and examples in crate root, `Turtle` struct, and `Color` struct

### Fixed

* [#5](https://github.com/sunjay/turtle/issues/5) - Using the line currently
being drawn in the fill polygon

## [1.0.0-alpha.2] - 2017-10-21

### Added

* Added `clear()` method to `Turtle` struct

### Changed

* Renamed `visible()` method on the `Color` struct to `opaque`
* Renamed `invisible()` method on the `Color` struct to `transparent`

## [1.0.0-alpha.1] - 2017-10-20

### Fixed

* Using absolute URLs so that images in README.md work on crates.io

## [1.0.0-alpha.0] - 2017-10-20

Initial release of first version of turtle crate.

[Unreleased]: https://github.com/sunjay/turtle/compare/v1.0.0-rc.3...HEAD
[1.0.0-rc.3]: https://github.com/sunjay/turtle/compare/v1.0.0-rc.2...v1.0.0-rc.3
[1.0.0-rc.2]: https://github.com/sunjay/turtle/compare/v1.0.0-rc.1...v1.0.0-rc.2
[1.0.0-rc.1]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.8...v1.0.0-rc.1
[1.0.0-alpha.8]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.7...v1.0.0-alpha.8
[1.0.0-alpha.7]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.6...v1.0.0-alpha.7
[1.0.0-alpha.6]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.5...v1.0.0-alpha.6
[1.0.0-alpha.5]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.4...v1.0.0-alpha.5
[1.0.0-alpha.4]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
[1.0.0-alpha.3]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.2...v1.0.0-alpha.3
[1.0.0-alpha.2]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.1...v1.0.0-alpha.2
[1.0.0-alpha.1]: https://github.com/sunjay/turtle/compare/v1.0.0-alpha.0...v1.0.0-alpha.1
[1.0.0-alpha.0]: https://github.com/sunjay/turtle/compare/2e9a4e93ea376404b313d7139a4d4cc23f46d4d3...v1.0.0-alpha.0

[docs]: https://docs.rs/turtle
[guide]: https://turtle.rs/guide/quickstart/
22 changes: 15 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ requires an extra flag which is documented below.
* To run an example, run `cargo run --example filename`
* Example: run `cargo run --example rust` to run `examples/rust.rs`
* This will automatically build the project for you
* To test the project, run `cargo test --features test`
* If you do not include the `--features test` part, the tests will open
several windows during testing and the tests will not end until those
windows are closed (see `Cargo.toml` for more explanation)
* We currently prevent you from running tests without this feature enabled.
Trying to do so should give you a helpful error message that tells you
the right thing to do.
* To test the project, run `cargo test --features "test unstable"`
* Without the `--features "test"` part, the tests would open several windows
during testing and the tests will not end until those windows are closed
(see `Cargo.toml` for more explanation)
* Without the `--features "unstable"` part, the tests would not all compile
because many tests depend on unstable features
* We currently prevent you from running tests without the `test` feature
enabled. Trying to do so should give you a helpful error message that tells
you the right thing to do.
* Animations are **disabled** during tests, so setting the speed will have no
impact on anything. You should not write unit tests or doctests that depend
on animations.
Expand All @@ -167,6 +169,12 @@ requires an extra flag which is documented below.
then run `cargo watch -x doc`
* To only build the documentation for turtle and skip building all of its
dependencies, run `cargo doc --no-deps` or `cargo watch -x 'doc --no-deps'`
* When building documentation normally, the markers that list the features
required for various parts of turtle are missing. To build the documentation
with those markers, use this command:
```bash
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features "unstable" --open
```

## Adding Examples
[adding-examples]: #adding-examples
Expand Down
Loading