Getting started with Rust 🦀 2021: 7a. Building a GUI app in Rust [Part A]

  Рет қаралды 157,213

creativcoder

creativcoder

Күн бұрын

Пікірлер: 110
@Crux161
@Crux161 2 жыл бұрын
This is so refreshing… Documentation, code snippets and advice online, nothing compares to watching someone build something live. I’ve seriously been searching for this exactly topic. 🤦‍♂️ thank you!!
@creativcoder
@creativcoder 2 жыл бұрын
Hey glad you found this helpful!
@jamesb1559
@jamesb1559 2 жыл бұрын
This is an excellent tutorial on gui design in Rust and a welcome tutorial on egui.
@metasim
@metasim 2 жыл бұрын
Your teaching style and editing skills are fantastic! Thank you for sharing your expertise!
@paulmarkert5907
@paulmarkert5907 2 жыл бұрын
Thanks for posting this multi-part series. I am enjoying working through the lessons. One note, the egui crate has versioned up. Some of the equi-related functions used in your code are now deprecated or replaced.
@creativcoder
@creativcoder 2 жыл бұрын
Yes, planning for a follow up video where we go through the fixes
@peterthecoderd.1210
@peterthecoderd.1210 Жыл бұрын
Sorry. I have really tried to follow this tutorial as I'd really like to learn. You go through things too fast, beginning with having the implementation fill in automatically at 7:00. I could not get this to work. I paused the playback and tried to enter in the function manually, but all I get is errors. I'm not new to programming, just new to Rust. Right now it seems impossible to learn from your examples.
@creativcoder
@creativcoder Жыл бұрын
For errors: Maybe your egui, version might be an upgraded one than the one in the video. For the pace: It you notice the video description it's shot as an "overview video". I'll try to slow down in future videos. Thank you for the feedback.
@cthutu
@cthutu 2 жыл бұрын
ImGUI is pronounced IM-Gooey, not Image UI. It's an acronym for Immediate Mode Graphic User Interface.
@theeagleseye4989
@theeagleseye4989 3 жыл бұрын
Great tutorial.. watched a lot of times.. waiting for the next continuation video ..
@overshifted
@overshifted 2 жыл бұрын
Great video, but I would like to mention that the Imgui library, is actually called "Dear Imgui" and is pronounced "Dear I'm GUI"
@luizneri
@luizneri 2 жыл бұрын
I'm following this tut, and it seems that ScrollArea::auto_sized() is no more. I got same result with ScrollArea::vertical().auto_shrink([false, false]).show(...)
@creativcoder
@creativcoder 2 жыл бұрын
Hey thanks, I have a new video coming up soon, where we will refactor and update the app to use the most recent egui release. Stay tuned :)
@michaelheisler8501
@michaelheisler8501 2 жыл бұрын
@@creativcoder Hey, I had the same issue and on top the "family_and_size" does not exist anymore. Font sizing and styling has to be done completely different now. I tried to implement the approach from the egui font styling example. Now it looks like this: fn configure_fonts(&self, ctx: &Context){ use FontFamily:: Proportional; let mut font_def = FontDefinitions::default(); font_def.font_data .insert("MesloGS".to_owned(), FontData::from_static(include_bytes!("../../MesloLGS_NF_Regular.ttf"))); font_def.families.get_mut(&FontFamily::Proportional).unwrap() .insert(0, "MesloGS".to_owned()); ctx.set_fonts(font_def); let mut style = (*ctx.style()).clone(); style.text_styles = [ (TextStyle::Heading, FontId::new(35., Proportional)), (TextStyle::Body, FontId::new(20.0, Proportional)), ] .into(); ctx.set_style(style); } This works, but "with_layout" renders the first card always to grab the remaining size of the window. Even when interactively changing the size of the window. The others are rendered as expected.
@codesurge6838
@codesurge6838 2 жыл бұрын
This is more than just Rust GUI tutorial. Thanks for sharing.
@devfagundes
@devfagundes Жыл бұрын
Not even one single code that I get from tutorials in Rust works. So impressive
@xXYourShadowDaniXx
@xXYourShadowDaniXx Ай бұрын
Skill Issue
@devfagundes
@devfagundes Ай бұрын
@@xXYourShadowDaniXx totally haha
@brunob.7792
@brunob.7792 Жыл бұрын
Google pitchfork will put an end in all this suffering very soon
@saaddahmani1870
@saaddahmani1870 2 жыл бұрын
So great, ... continue please .....
@creativcoder
@creativcoder 2 жыл бұрын
Hey thank you, part B just dropped!
@princeofexcess
@princeofexcess Жыл бұрын
is there a way to set opacity of 50% on the whole window in iced? transparency setting is not doing anything for me.
@saathwik_dasari1
@saathwik_dasari1 3 жыл бұрын
Thanks!
@samansamani4477
@samansamani4477 2 жыл бұрын
I just wonder is it possible to create a custom titlebar for it? the default windows one is so big...
@creativcoder
@creativcoder 2 жыл бұрын
It is, you need to set window decorations off from NativeOptions and then make a custom top header with buttons that ties to system close, minimize events
@samansamani4477
@samansamani4477 2 жыл бұрын
@@creativcoder thank you for answer, but then how handle windows movement? can we still hook system movement to new created titlebar?
@spinthma
@spinthma 2 жыл бұрын
Very. NIce, by the way which kind of font do you use in vscode? Very clean and readable.
@buhaytza2005
@buhaytza2005 Жыл бұрын
Thanks
@ajinkyax
@ajinkyax 6 ай бұрын
Subscribed. even your website has some great articles. Good one
@creativcoder
@creativcoder 6 ай бұрын
Thank you :) It means a lot.
@aeases-
@aeases- 2 жыл бұрын
just out of curiosity what is the settings/extension/theme your using for the dock in gnome?
@filmo
@filmo 2 жыл бұрын
Question: Why is 'render_top_panel()' placed into 'impl Headlines' but the helper functions 'render_footer' and 'render_header' are not?
@creativcoder
@creativcoder Жыл бұрын
Good catch, there isn't any reason, I might have missed refactoring it while shooting the video. Will make changes
@Zooiest
@Zooiest Жыл бұрын
What cursor pack do you use?
@VAcharya
@VAcharya 2 жыл бұрын
How can I follow this tutorial on windows machine ?
@spinthma
@spinthma 2 жыл бұрын
and also the immediate compile and the output on the terminal, which plugin do you use?
@josbexerra8115
@josbexerra8115 2 жыл бұрын
Excelente....gracias saludos de los andes peruanos
@manoj88153
@manoj88153 2 жыл бұрын
Make video on iced.
@creativcoder
@creativcoder 2 жыл бұрын
Yeah, iced is good too. Will see
@RobertoOrtis
@RobertoOrtis Жыл бұрын
Does it compile on windows?
@delusionfish9606
@delusionfish9606 2 жыл бұрын
I failed to make a gui-rs app in the many other frameworks. but this nicely works !! thank you.
@JXQU3
@JXQU3 Жыл бұрын
Really helpful!
@alessio750
@alessio750 2 жыл бұрын
what is the theam used? btw great tutorial dude
@adsick_ua
@adsick_ua 2 жыл бұрын
I'd suggest you changing your logo as it is not readable. Think of it in the future.
@creativcoder
@creativcoder 2 жыл бұрын
Thanks for the suggestion, will look into it
@learntry9074
@learntry9074 Жыл бұрын
Thank you.. see you in 7b :)
@tristansantiago7151
@tristansantiago7151 2 жыл бұрын
This looks really cool. It reminds me of a windows widget.
@chiragsingla.
@chiragsingla. 2 жыл бұрын
I love your voice
@joegriffith1683
@joegriffith1683 2 жыл бұрын
anyone know the extension/setting which automatically displays the type next to each variable and argument? (the light greyed out text)
@creativcoder
@creativcoder 2 жыл бұрын
That's type inlay hints in rust analyzer vscode extension. Just type Ctrl + Shift + P then toggle inlay hints
@hermannpaschulke1583
@hermannpaschulke1583 2 жыл бұрын
Great tutorial! Are you using Gnome on X11? Because I run on Wayland and the window decorations are very ugly. (It's a known gnome issue) Or do you just run headlines using XWayland?
@creativcoder
@creativcoder 2 жыл бұрын
Yeah had to switch back to X11, because obs (recording software) doesn't like wayland :)
@codeitlikemiley
@codeitlikemiley 2 жыл бұрын
Im looking for a GUI that can be use on macos native apps, with permissions also can be set up on rust. I think rust makes sense in building native desktop app.
@creativcoder
@creativcoder 2 жыл бұрын
It's almost there, the libraries still need a fair bit of polish tbh
@cakemaster12345
@cakemaster12345 2 жыл бұрын
You forgot to mention in this series how you got the original windows title bar removed and made the new title bar draggable. Kind of an important step...
@creativcoder
@creativcoder 2 жыл бұрын
Correct, there'll be a follow up video on same soon.
@kagenao2336
@kagenao2336 2 жыл бұрын
this is what i've been looking for... for so long. I do not overexaggerate when I say that this (imo) is close to perfect. (maybe speak a bit louder) Keep up the amazing work!
@creativcoder
@creativcoder Жыл бұрын
Thank you, means a lot. Sure, will fine tune my rec setup
@kingpenguin1905
@kingpenguin1905 2 жыл бұрын
dude awesome. you earned a sub
@CaioDanielNunesSantos
@CaioDanielNunesSantos 2 жыл бұрын
Thank you
@dog1509
@dog1509 3 жыл бұрын
Really looking forward to the second part.
@creativcoder
@creativcoder 3 жыл бұрын
part B: kzbin.info/www/bejne/iaepgZedfNytirM
@CT-cx8yi
@CT-cx8yi 3 жыл бұрын
This is just what I have been looking for. Thanks!
@jdssl
@jdssl 2 жыл бұрын
The best tutorial!!!
@irfnrdh
@irfnrdh 2 жыл бұрын
this is my first day learn rust and I love it thanks for the tuts
@samansamani4477
@samansamani4477 2 жыл бұрын
thank you, it was awesome, I have a strange question, do you recall what was your program size output in release mode after build, with all dependency?
@creativcoder
@creativcoder 2 жыл бұрын
About 16mb in release. You can reduce it further by following a few applicable ones in: github.com/johnthagen/min-sized-rust
@samansamani4477
@samansamani4477 2 жыл бұрын
@@creativcoder thank you for fast answer, its quiet large... one other question, what backend did you used for gui? and its fully static? (I mean no shared library?) just want to start rust 😅
@creativcoder
@creativcoder 2 жыл бұрын
@@samansamani4477 it uses opengl as its rendering backend with glium crate at present. But you can switch to anything else. static, yes. I believe for opengl deps it maybe uses cdylib underneath.
@samansamani4477
@samansamani4477 2 жыл бұрын
@@creativcoder well I build your project in windows and its worked without problem, except just there was 2 progress bar
@creativcoder
@creativcoder 2 жыл бұрын
@@samansamani4477 better to open an issue on github repository with a screenshot. I'd be able to help better
@adsick_ua
@adsick_ua 2 жыл бұрын
Great job, keep the level and sure people will be donating to you
2 жыл бұрын
so it took me hours to develop the same as this 28 min video :D
@creativcoder
@creativcoder 2 жыл бұрын
Yeah, that's the realistic time. I had to speed things up to not bore people watching 3-4 hour of a video :D
@ChatterboxBS1
@ChatterboxBS1 2 жыл бұрын
Very nice!
@creator0f_in1quity
@creator0f_in1quity 2 жыл бұрын
Hi! What the operation system you use?
@creativcoder
@creativcoder 2 жыл бұрын
I used Ubuntu till ep 8, but now I use arch btw :D
@moose43h
@moose43h 2 жыл бұрын
Wow
@ursochurrasqueira
@ursochurrasqueira 2 жыл бұрын
amazing tutorial
@alihusham1560
@alihusham1560 2 жыл бұрын
isn't YEW better and faster than this?
@henrylang699
@henrylang699 2 жыл бұрын
faster? it calls web technologies from wasm lol
@alihusham1560
@alihusham1560 2 жыл бұрын
@@henrylang699 oh so EGUI does not depend on javascript at all?
@cyanfroste5559
@cyanfroste5559 2 жыл бұрын
what vscode theme are you using?
@creativcoder
@creativcoder 2 жыл бұрын
That's Bearded Theme Arc: marketplace.visualstudio.com/items?itemName=BeardedBear.beardedtheme
@bankoleogundero9446
@bankoleogundero9446 2 жыл бұрын
How big is the final binary?
@creativcoder
@creativcoder 2 жыл бұрын
cargo build --release gives me ~19 Mb on linux. After using the following flags in Cargo.toml i managed to get it down to 7 Mb: [profile.release] strip = true opt-level = "z" lto = true codegen-units = 1
@theeagleseye4989
@theeagleseye4989 3 жыл бұрын
While implementing App trait, how do you auto fill the methods of the trait? Are you using a different rust analyser, mine does not show such options to auto fill
@creativcoder
@creativcoder 3 жыл бұрын
Ah no, that's vscode quick fix shortcut. Hit `Ctrl + .` (dot) to show the quick fix menu. If it's not assigned, go to keyboard shortcuts and look for "problems.action.showQuickFixes" and assign a key.
@theeagleseye4989
@theeagleseye4989 3 жыл бұрын
@@creativcoder thank you very much..
@stomah9832
@stomah9832 2 жыл бұрын
“image ui”
@NehaSharma-ld9rx
@NehaSharma-ld9rx 3 жыл бұрын
This is good! 👍
@aurorapaisley7453
@aurorapaisley7453 2 жыл бұрын
App::setup is missing??
@creativcoder
@creativcoder 2 жыл бұрын
Yep, in the recent video I have explained how to fix that: kzbin.info/www/bejne/e4CsmaaIrc2JbpI
@dagher.a247
@dagher.a247 3 жыл бұрын
Great work 👏
@benz201forever
@benz201forever 2 жыл бұрын
I use SLINT for my gui
@benz201forever
@benz201forever 2 жыл бұрын
it's formerly sixtyfps
@creativcoder
@creativcoder 2 жыл бұрын
Yeah, it looks promising for embedded platforms
@theeagleseye4989
@theeagleseye4989 3 жыл бұрын
Can you make some tutorials on druid?
@creativcoder
@creativcoder 3 жыл бұрын
Will do
2 жыл бұрын
your videos are very good quality and perfect to learn rust, I hope to see more soon. I would prefer the coding part not sped up as we can adjust while viewing, as this where there is a lot to learn too.
@TheGraemi
@TheGraemi 2 жыл бұрын
The voice could be better.
@creativcoder
@creativcoder 2 жыл бұрын
Agree, I generally try to speed up repetitive parts of code. Thanks for the suggestion, will try to keep things realtime for code sections.
@creativcoder
@creativcoder 2 жыл бұрын
Thank you, will look into it
@ino3809
@ino3809 2 жыл бұрын
not wayland?
@creativcoder
@creativcoder 2 жыл бұрын
obs had trouble getting along with wayland, so x11.
@somethingelse5842
@somethingelse5842 3 жыл бұрын
what the system are you using?
@somethingelse5842
@somethingelse5842 3 жыл бұрын
In the left corner, i see "app,places,vscode"
@creativcoder
@creativcoder 3 жыл бұрын
That's Ubuntu 21.04 with Theme: Mc-OS-Transparent-1.3 [GTK2/3] Icons: McMojave-circle-grey-dark [GTK2/3]
Makepad: Designing modern UIs with Rust - Rik Arends - RustNL 2023
55:20
Rust Nederland (RustNL)
Рет қаралды 53 М.
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 70 МЛН
Please Help This Poor Boy 🙏
00:40
Alan Chikin Chow
Рет қаралды 23 МЛН
I spent six months rewriting everything in Rust
15:11
chris biscardi
Рет қаралды 430 М.
Rust at speed - building a fast concurrent database
52:54
Jon Gjengset
Рет қаралды 212 М.
Why You Shouldn’t Build Your Next App in Rust
9:18
warpdotdev
Рет қаралды 95 М.
Nobody Cares About Your Coding Projects
11:02
Tariq10x
Рет қаралды 110 М.
you need to build a RUST desktop app!!
27:21
Travis Media
Рет қаралды 315 М.
rust runs on EVERYTHING (no operating system, just Rust)
18:10
Low Level
Рет қаралды 358 М.
Understanding Rust Closures aka. Anonymous Functions 🦀 💻
30:22
Trevor Sullivan
Рет қаралды 14 М.
Rust's Alien Data Types 👽 Box, Rc, Arc
11:54
Code to the Moon
Рет қаралды 146 М.
Why do developers hate Rust?
8:20
Let's Get Rusty
Рет қаралды 125 М.
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 70 МЛН