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

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 112

  • @Crux161
    @Crux161 3 роки тому +62

    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  3 роки тому +6

      Hey glad you found this helpful!

  • @jamesb1559
    @jamesb1559 3 роки тому +38

    This is an excellent tutorial on gui design in Rust and a welcome tutorial on egui.

  • @metasim
    @metasim 2 роки тому +12

    Your teaching style and editing skills are fantastic! Thank you for sharing your expertise!

  • @devfagundes
    @devfagundes Рік тому +6

    Not even one single code that I get from tutorials in Rust works. So impressive

    • @xXYourShadowDaniXx
      @xXYourShadowDaniXx 3 місяці тому +3

      Skill Issue

    • @devfagundes
      @devfagundes 3 місяці тому

      @@xXYourShadowDaniXx totally haha

    • @skoovee
      @skoovee Місяць тому

      you are watching a old video, its still good for the basics of how egui works but you should be looking at the docs yourself

  • @theeagleseye4989
    @theeagleseye4989 3 роки тому +5

    Great tutorial.. watched a lot of times.. waiting for the next continuation video ..

  • @kagenao2336
    @kagenao2336 2 роки тому +1

    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  2 роки тому

      Thank you, means a lot. Sure, will fine tune my rec setup

  • @codesurge6838
    @codesurge6838 2 роки тому +2

    This is more than just Rust GUI tutorial. Thanks for sharing.

  • @paulmarkert5907
    @paulmarkert5907 2 роки тому +11

    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 роки тому +3

      Yes, planning for a follow up video where we go through the fixes

  • @saaddahmani1870
    @saaddahmani1870 3 роки тому +2

    So great, ... continue please .....

    • @creativcoder
      @creativcoder  3 роки тому

      Hey thank you, part B just dropped!

  • @dog1509
    @dog1509 3 роки тому +1

    Really looking forward to the second part.

    • @creativcoder
      @creativcoder  3 роки тому

      part B: ua-cam.com/video/SvFPdgGwzTQ/v-deo.html

  • @ajinkyax
    @ajinkyax 8 місяців тому

    Subscribed. even your website has some great articles. Good one

    • @creativcoder
      @creativcoder  8 місяців тому +1

      Thank you :) It means a lot.

  • @irfnrdh
    @irfnrdh 2 роки тому

    this is my first day learn rust and I love it
    thanks for the tuts

  • @CT-cx8yi
    @CT-cx8yi 3 роки тому

    This is just what I have been looking for. Thanks!

  • @adsick_ua
    @adsick_ua 3 роки тому

    Great job, keep the level and sure people will be donating to you

  • @NyscanRohid
    @NyscanRohid 11 днів тому

    A note on using the egui CentralPanel: There's a particular line in the documentation:
    "⚠ *CentralPanel* must be added after all other panels!"
    Because of the *TopBottomPanel* in *render_footer,* the *update* should look like this:
    self.render_top_panel(ctx, frame);
    render_footer(ctx);
    CentralPanel::default()
    .show(ctx, |ui| {
    render_header(ui);
    ScrollArea::auto_sized()
    .show(ui, |ui| {
    self.render_news_cards(ui);
    });
    });
    If you don't order the calls in this way, the footer will end up covering up part of the ScrollArea.

  • @luizneri
    @luizneri 2 роки тому +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 роки тому +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.

  • @delusionfish9606
    @delusionfish9606 2 роки тому

    I failed to make a gui-rs app in the many other frameworks.
    but this nicely works !!
    thank you.

  • @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.

  • @samansamani4477
    @samansamani4477 2 роки тому +1

    I just wonder is it possible to create a custom titlebar for it? the default windows one is so big...

    • @creativcoder
      @creativcoder  2 роки тому +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?

  • @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  2 роки тому

      Good catch, there isn't any reason, I might have missed refactoring it while shooting the video. Will make changes

  • @aeases-
    @aeases- 2 роки тому

    just out of curiosity what is the settings/extension/theme your using for the dock in gnome?

  • @learntry9074
    @learntry9074 Рік тому

    Thank you.. see you in 7b :)

  • @tristansantiago7151
    @tristansantiago7151 2 роки тому

    This looks really cool. It reminds me of a windows widget.

  • @jdssl
    @jdssl 2 роки тому

    The best tutorial!!!

  • @kingpenguin1905
    @kingpenguin1905 2 роки тому

    dude awesome. you earned a sub

  • @spinthma
    @spinthma 2 роки тому

    and also the immediate compile and the output on the terminal, which plugin do you use?

  • @alessio750
    @alessio750 2 роки тому

    what is the theam used? btw great tutorial dude

  • @JXQU3
    @JXQU3 Рік тому

    Really helpful!

  •  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 роки тому +1

      Thank you, will look into it

  • @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 роки тому +2

      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..

  • @ChatterboxBS1
    @ChatterboxBS1 2 роки тому

    Very nice!

  • @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 роки тому +1

      That's type inlay hints in rust analyzer vscode extension. Just type Ctrl + Shift + P then toggle inlay hints

  • @spinthma
    @spinthma 2 роки тому

    Very. NIce, by the way which kind of font do you use in vscode? Very clean and readable.

  • @dagher.a247
    @dagher.a247 3 роки тому

    Great work 👏

  • @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.

  • @samansamani4477
    @samansamani4477 3 роки тому +1

    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  3 роки тому +5

      About 16mb in release. You can reduce it further by following a few applicable ones in: github.com/johnthagen/min-sized-rust

    • @samansamani4477
      @samansamani4477 3 роки тому

      @@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  3 роки тому +1

      @@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 3 роки тому

      @@creativcoder well I build your project in windows and its worked without problem, except just there was 2 progress bar

    • @creativcoder
      @creativcoder  3 роки тому

      @@samansamani4477 better to open an issue on github repository with a screenshot. I'd be able to help better

  • @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 :)

  • @NehaSharma-ld9rx
    @NehaSharma-ld9rx 3 роки тому

    This is good! 👍

  • @Zooiest
    @Zooiest Рік тому

    What cursor pack do you use?

  • @creator0f_in1quity
    @creator0f_in1quity 2 роки тому

    Hi! What the operation system you use?

    • @creativcoder
      @creativcoder  2 роки тому +2

      I used Ubuntu till ep 8, but now I use arch btw :D

  • @cthutu
    @cthutu 2 роки тому +12

    ImGUI is pronounced IM-Gooey, not Image UI. It's an acronym for Immediate Mode Graphic User Interface.

  • @ursochurrasqueira
    @ursochurrasqueira 3 роки тому

    amazing tutorial

  • @peterthecoderd.1210
    @peterthecoderd.1210 2 роки тому +1

    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  2 роки тому

      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.

  • @josbexerra8115
    @josbexerra8115 2 роки тому

    Excelente....gracias saludos de los andes peruanos

  • @theeagleseye4989
    @theeagleseye4989 3 роки тому

    Can you make some tutorials on druid?

  • @cyanfroste5559
    @cyanfroste5559 2 роки тому

    what vscode theme are you using?

    • @creativcoder
      @creativcoder  2 роки тому +1

      That's Bearded Theme Arc: marketplace.visualstudio.com/items?itemName=BeardedBear.beardedtheme

  • @VAcharya
    @VAcharya 3 роки тому

    How can I follow this tutorial on windows machine ?

  • @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

  • @saathwik_dasari1
    @saathwik_dasari1 3 роки тому +1

    Thanks!

  • @manoj88153
    @manoj88153 2 роки тому +1

    Make video on iced.

  •  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

  • @overshifted
    @overshifted 2 роки тому +1

    Great video, but I would like to mention that the Imgui library, is actually called "Dear Imgui" and is pronounced "Dear I'm GUI"

  • @bankoleogundero9446
    @bankoleogundero9446 2 роки тому

    How big is the final binary?

    • @creativcoder
      @creativcoder  2 роки тому +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

  • @RobertoOrtis
    @RobertoOrtis Рік тому

    Does it compile on windows?

  • @chiragsingla.
    @chiragsingla. 2 роки тому

    I love your voice

  • @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]

  • @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

  • @CaioDanielNunesSantos
    @CaioDanielNunesSantos 2 роки тому

    Thank you

  • @buhaytza2005
    @buhaytza2005 Рік тому

    Thanks

  • @brunob.7792
    @brunob.7792 2 роки тому

    Google pitchfork will put an end in all this suffering very soon

  • @aurorapaisley7453
    @aurorapaisley7453 2 роки тому

    App::setup is missing??

    • @creativcoder
      @creativcoder  2 роки тому

      Yep, in the recent video I have explained how to fix that: ua-cam.com/video/EOIhsRxhV80/v-deo.html

  • @ino3809
    @ino3809 3 роки тому

    not wayland?

    • @creativcoder
      @creativcoder  3 роки тому

      obs had trouble getting along with wayland, so x11.

  • @moose43h
    @moose43h 3 роки тому

    Wow

  • @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?

  • @benz201forever
    @benz201forever 2 роки тому

    I use SLINT for my gui

  • @stomah9832
    @stomah9832 3 роки тому

    “image ui”