Skip to content
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

Fixes to readme.md #1992

Merged
merged 4 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
69 changes: 48 additions & 21 deletions druid/examples/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
There are several different kind of examples, some demonstrate one particular
Druid concept, some are tools used for testing and debugging, and
others are more complete examples of how to tie everything together.
The latter are listed separately under [showcases](##Showcases).
The latter are listed separately under [showcases](#Showcases).

## Anim
```
Expand All @@ -15,21 +15,21 @@ This example shows how to make a simple animation using `Event::AnimFrame`.
```
cargo run --example async_event
```
Demonstrates receiving data from some outside source, and updating the UI in response. This is similar to [blocking function](##Blocking Function) but here the data source is fully independent, and runs for the lifetime of the program.
Demonstrates receiving data from some outside source, and updating the UI in response. This is similar to [blocking function](#Blocking Function) but here the data source is fully independent, and runs for the lifetime of the program.

## Blocking Functions
## Blocking Function
```
cargo run --example blocking_functions
cargo run --example blocking_function
```
Sometimes you need to fetch some data from disk or from the internet,
but you should never block the UI thread with long running operations!
Instead you should run this task in a separate thread, and have it send
you the data as it arrives. This is very similar to [async event](##Async Event)
you the data as it arrives. This is very similar to [async event](#Async Event)
except the event is initiated by the main thread.

## Cursor
```
cargo run --example cursor
cargo run --example cursor --features="image png"
```
This example demonstrates how to set the cursor icon, and how to use a custom cursor.

Expand All @@ -55,12 +55,25 @@ cargo run --example hello
This shows some of the basics of druid. If you need a start of how to build an application with a text-box and some labels this is where to start.

## Hello_web
For more info and prerequistes see [druid/examples/hello_web/README.md](druid/examples/hello_web/README.md).
```
cd druid/examples/hello_web
wasm-pack build --out-dir pkg --out-name hello_web
```
[View at http://localhost:8000](http://localhost:8000].

This is an example of how to get almost any druid application can be used on the web. This is just the hello_world example but should work for all of them.

## Web
For more info and prerequistes see [druid/examples/web/README.md](druid/examples/web/README.md).
```
cd druid/examples/web
wasm-pack build --out-dir pkg --out-name web
```
[View at http://localhost:8000](http://localhost:8000].

Simple web app.

## Identity
```
cargo run --example identity
Expand Down Expand Up @@ -91,6 +104,12 @@ cargo run --example list --features="im"
```
This shows you how you could, for example, add items to lists and delete them.

## Markdown Preview
```
cargo run --example markdown_preview
```
An example of markdown preview on the left side and editable text on the right side.

## Multiple Windows
```
cargo run --example multiwin
Expand All @@ -107,7 +126,7 @@ Opening and saving files is crucial for a lot of applications. This shows you ho
```
cargo run --example panels
```
Very similar to [layout](##Layout) but it splits the screen into 2 segments
Very similar to [layout](#Layout) but it splits the screen into 2 segments

## Value Formatting

Expand Down Expand Up @@ -138,18 +157,13 @@ cargo run --example split_demo
An example of how to split a widget in 2 in various ways. This also includes having the user drag the border!!

## Sub Window
Not working, no sub-window seen?
winksaville marked this conversation as resolved.
Show resolved Hide resolved
```
cargo run --example sub_window
```

This shows you how to make a completely new window with shared state.

## Styled_text
```
cargo run --example styled_text
```
Not all text should look the same. You are able to change a lot of things, color, size, and monospace. This example shows how to change these propperties.

## Svg
```
cargo run --example svg --features="svg"
Expand All @@ -164,13 +178,25 @@ Switches are useful in many ways, this example shows how to use the druid built-

## Tabs
```
cargo run --example tabs
cargo run --example tabs --features="im"
```
Tabs allow you to seperate different portions of the UI. This example shows you how to use them in druid. similar to [view switcher](#View Switcher) but with with a different purpose.

## Text
```
cargo run --example text
```
Text shows the effects of TextAlignment and LineBreaker types.

## TextBox
```
cargo run --example textbox
```
Tabs allow you to seperate different portions of the UI. This example shows you how to use them in druid. similar to [view switcher](##View Switcher) but with with a different purpose.
Textbox demostrates some of the possible configuraitons of the TextBox widget.

## Timers
## Timer
```
cargo run --example timers
cargo run --example timer
```
Timers allow you to send events to your widgets at a certain points inthe future. This example shows how to use them.

Expand All @@ -184,7 +210,7 @@ This shows you how to make the window transparent, so the rest of the desktop sh
```
cargo run --example view_switcher
```
Very similar to [tabs](##Tabs) but this allows you to have more control over it. This allows you to switch out widgets on the fly.
Very similar to [tabs](#Tabs) but this allows you to have more control over it. This allows you to switch out widgets on the fly.

# Showcases

Expand Down Expand Up @@ -223,7 +249,7 @@ A simple implementation of Conway's game of life. You can change the evolution s

## Image
```
cargo run --example image
cargo run --example image --features "image png"
```

Image shows off all the knobs you can turn on images. You can play with them with real time results, which you to figure out what settings are best for you.
Expand All @@ -242,11 +268,12 @@ This is a showcase is scrolling through an image gradient square. The square is
cargo run --example styled_text
```

In druid you can change all kinds of styling aspects of text. This shows off some of them.
In druid you can change all kinds of styling aspects of text as not all text should look
the same. This showcases some of those things such as, color, size, and monospace.

## Widget Gallery
```
cargo run --example widget_gallery
cargo run --example widget_gallery --features="svg im image png"
```

This is a showcase of some simple widgets with their default styling. These are interactive, but you cannot change any of their styling.
1 change: 0 additions & 1 deletion druid/examples/sub_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ fn build_root_widget() -> impl Widget<HelloState> {
WindowConfig::default()
.show_titlebar(false)
.window_size(Size::new(100., 100.))
.set_position(Point::new(1000.0, 500.0))
.set_level(WindowLevel::AppWindow),
col,
data.clone(),
Expand Down