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

Add a tutorials folder with simple tutorials #3622

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
10 changes: 10 additions & 0 deletions crates/eframe/tutorials/layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Layout tutorials

## Make group fill full height of its parent

```rust
ui.group(|ui| {
// Stuff blah blah blah
ui.set_height(ui.available_height());
});
```
1 change: 1 addition & 0 deletions crates/eframe/tutorials/miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Miscellaneous tutorials
20 changes: 20 additions & 0 deletions crates/eframe/tutorials/technical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Technical tutorials

## Press a button when a key is pressed

If you want to have something that happens when either:

- a button is clicked, or
- a key is pressed

This is how you can do that:

```rust
let my_button = ui.button("Press me");

if my_button.clicked() || ui.input(|i| i.key_pressed(egui::Key::Enter)) {
// Do awesome stuff
}
```

Now, whenever `my_button` is clicked _or_ the `Enter` key is pressed, they will do the same thing.
11 changes: 11 additions & 0 deletions crates/eframe/tutorials/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `eframe` Tutorials

This is a list of tutorials to do small things using eframe

- [Layout](./layout.md)
- [Technical](./technical.md)
- [Miscellaneous](./miscellaneous.md)

---

These tutorials are a work in progress. You can contribute to them by submitting a PR on GitHub