Make a GUI Calculator in C like a real Chad

Sdílet
Vložit
  • čas přidán 11. 05. 2024
  • I'm gonna show you how to make a small & aesthetic calculator app in C
    like a real chad. No QT, GTK or any other bloat required.
    NOTE: If you're on arch, you can easily build leif (the UI library) from the aur: paru -S libleif.
    Build cglm from source: github.com/recp/cglm?tab=read...
    Build libclipboard from source: github.com/jtanx/libclipboard...
  • Věda a technologie

Komentáře • 126

  • @nno64209
    @nno64209 Před 18 dny +202

    A GUI library? A real chad would directly write to the screen buffer in assembly instead!!!

  • @apoxis
    @apoxis Před měsícem +73

    Now I‘m a real chad

    • @meno437
      @meno437 Před 24 dny

      Oha. Wie viel Geld machst du mit deinen YT shorts. Reichts zum leben?

  • @leahfluffytail5623
    @leahfluffytail5623 Před měsícem +17

    will be watching the entire thing later, love this stuff

  • @acatisfinetoo3018
    @acatisfinetoo3018 Před 27 dny +58

    Love this low level C programming with using native winapi function calls...This is what real programming is all about 😉

    • @alternatingf42
      @alternatingf42 Před 24 dny +4

      His C code + the cross platform libraries made it easy as py 😉

    • @robinpage2730
      @robinpage2730 Před 19 dny +1

      ​@@alternatingf42why have to reinvent the wheel every time you need to go to the store? That's what libraries are for. As long as they're written in C as well it still counts, lol

    • @alternatingf42
      @alternatingf42 Před 19 dny

      @@robinpage2730 for performance

    • @bearfm
      @bearfm Před 15 dny +6

      "winapi functions calls"
      uhhh ok. sureeee, windows.

    • @reinhold1616
      @reinhold1616 Před 11 dny

      ​@@robinpage2730because its fun

  • @harryvpn1462
    @harryvpn1462 Před 13 dny +4

    I was needing this thanks dude

  • @mathisdelbouis558
    @mathisdelbouis558 Před 29 dny +6

    Really great GIGACHAD

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 Před měsícem +2

    Are you going to extend it adding more operations? For example 2^2=4, 2^2^3=256?

  • @mantra578
    @mantra578 Před měsícem +41

    You're a tsoding fan aren't you?

    • @cococry
      @cococry  Před měsícem +49

      red circle live on twitch (hope that answers that)

    • @mantra578
      @mantra578 Před měsícem +11

      @@cococry you are both really inspiring

    • @tiaanbasson9092
      @tiaanbasson9092 Před 28 dny +2

      Wanted to make a Tsoding comment as well. 😂 Love channels like these.

    • @pitche
      @pitche Před 17 dny

      after Tsoding became quite viral, similar content started to appear. this makes me happy :)

  • @jupiterapollo4985
    @jupiterapollo4985 Před 6 dny

    Great video my dude! I wish you created the window and UI without the Library instead. I know its quite tidous but would have been very interesting to watch.

  • @jordonfrancisco9270
    @jordonfrancisco9270 Před 3 dny

    Any chance you can show your nvchad setup? Especially your LSP and completion. I like the way your documentation previews look!

  • @higgsboson6274
    @higgsboson6274 Před 26 dny

    haven't watch code so i will ask here did you use concept of stack postfix/evaluation method to make it ?

  • @sumitpoudel729
    @sumitpoudel729 Před měsícem

    Love this!

  • @lucian9767
    @lucian9767 Před 18 dny +1

    Which gruvbox theme exactly, please?

  • @jaull3147
    @jaull3147 Před 24 dny +5

    Sorry I’m new to C programming, what does this mean?:
    (vec2s){0, 0}
    I don’t even understand the syntax. I didn’t know you could put these symbols together like this. Thanks

    • @cococry
      @cococry  Před 24 dny +26

      This syntax is used to instantiate a struct of the given type, for example vec2 in place.
      Suppose i have the struct foo {
      int a, b;
      };
      foo b = (foo){2, 3};
      Would initialize a foo with a set to 2 and b set to 3.
      The initialization of the members will be in order when you don’t explicitly state it (as in (foo){.a = 2, .b = 3}). For the (vec2s){0,0} example this would create a vec2 with x set to 0 and y set to 0 as vec2s is defined like this:
      struct vec2s {
      float x, y;
      }
      Hope that helped :)

  • @ballinlikebill8334
    @ballinlikebill8334 Před měsícem +1

    sehr stark

  • @0xba0a
    @0xba0a Před 7 dny

    Hi. Out of curiosity what font are you using?

  • @p99chan99
    @p99chan99 Před 11 dny

    Is this Windows compatible? Also nice Neovim setup

  • @BossThe-vz9sx
    @BossThe-vz9sx Před 12 dny

    hey! what is the keyboard doyou use?

  • @janahmouaad
    @janahmouaad Před 27 dny

    keep going mate

  • @mohamedbentaleb6493
    @mohamedbentaleb6493 Před 5 hodinami

    how to make this calc working without terminal
    Opening the app only by clicking on the icon and at the same time does not open the terminal ??

  • @deluxe_1337
    @deluxe_1337 Před 26 dny +3

    I was expecting Raylib 😂

  • @games-wg9nm
    @games-wg9nm Před 27 dny +2

    What is this IDE ? neovim??

  • @eyzake
    @eyzake Před měsícem +5

    yes i was waiting for the video bro ....(yes the same guy who asked about resources)
    looks like i came too early (i cant seem to change the video quality it looks 240p)

    • @daboi1675
      @daboi1675 Před 29 dny

      "looks like i came too early"
      Me too! There is nothing that tickles my pickle more than some C code.

  • @pianochannel100
    @pianochannel100 Před 14 dny

    where are ( ) and unary minus :) ? This is neat, should expand it to include a more robust expression evaluator

  • @harsha.2186
    @harsha.2186 Před 3 dny

    hey bro im having an issue with buffer overflow while running the app

  • @TheWinnieston
    @TheWinnieston Před 10 dny

    A real chad would use the mmap() to map screen memory to a pointer and you'd mix and match bit depths until you get a viewable display!

  • @stephanenathan8034
    @stephanenathan8034 Před 26 dny +4

    hey which IDE do you use and how do you manage to have that intellisense with argument placeholders ? Thank you

    • @nicolasdenis7094
      @nicolasdenis7094 Před 23 dny

      It says RAGNARWM v1.4 in the titlebar

    • @erc0re526
      @erc0re526 Před 19 dny

      It looks like a neovim with Youcompleteme, or a similar plugin, and clangd in the background as an LSP server to give the definitions etc.

    • @ntre.
      @ntre. Před 6 dny

      @@nicolasdenis7094 thats the wm. The editor is nvim. The LSP is probs lsp-zero

    • @ntre.
      @ntre. Před 6 dny +1

      its nvim with something from LSP-Zero. I just reccomend using lsp zero though

  • @ralvarezb78
    @ralvarezb78 Před 10 dny

    good skills

  • @geeth.k.official1605
    @geeth.k.official1605 Před 6 dny

    I'm a beginner in GUI programming and I really want to start with this, So I just wanted to ask if there's anyway I could do this on Windows 11. (I've been getting issues while installing the dependencies) Thank you!! :)

    • @kamiz0
      @kamiz0 Před dnem

      His program is not compatible with Windows, you would need to use Arch Linux inside virtual machine or WSL.

  • @danielhuang1220
    @danielhuang1220 Před 22 dny

    What colorscheme are you using?

  • @034omkar
    @034omkar Před měsícem

    Cool

  • @motaz-linux
    @motaz-linux Před 24 dny

    dose leif works on wayland, I'm using hyprland and i get some issuse like the window of calc excutble file dosn't go to floating mode and the scroll bar dosn't work;

    • @cococry
      @cococry  Před 24 dny

      the scrollbar not working should be fixed with the last commit. Did you clone the last commit already, if not, git pull and reinstall leif. Then it should work. For the floating mode, thats not an issue with leif, but with the windowing you setup. You can put glfwWindowHint(GLFW_FLOATING, GLFW_TRUE); before glfwCreateWindow.

    • @cococry
      @cococry  Před 24 dny

      oh if you mean the actual scrollbar being not clickable, yes that’s not implemented yet in leif. You can just scroll with your mousewheel

    • @motaz-linux
      @motaz-linux Před 24 dny

      glfwWindowHint(GLFW_FLOATING, GLFW_TRUE); dosn't work! why? @@cococry

    • @motaz-linux
      @motaz-linux Před 24 dny

      are you using wayland by the way ?@@cococry

  • @WebSurfingIsMyPastime
    @WebSurfingIsMyPastime Před 18 dny +1

    Have you uploaded the code for this calculator on github? so soydevs like me can read it in it's glory and learn from it?

    • @cococry
      @cococry  Před 18 dny +2

      yeah bro here: github.com/cococry/ticalc

  • @fpn12099
    @fpn12099 Před 26 dny

    Wanna know if this code works on Windows 11 ?? I am just a beginner in GUI programming and I hope to mimic to produce one with imaginary number operations. Thank you !

    • @cococry
      @cococry  Před 26 dny

      the code does not depend on unix only libraries so it should technically run but you would have to manually compile the leif library to a .lib file so that would be a bit of a challenge

    • @Brad_Script
      @Brad_Script Před dnem

      @@cococry it shouldn't be impossible with mingw

  • @its_code
    @its_code Před měsícem

    ❤❤❤❤

  • @thisaintnormall2775
    @thisaintnormall2775 Před 10 dny

    Yoo can you drop the nvim config files?

  • @ru2979
    @ru2979 Před 24 dny

    Hey bro , which os are u using , please tell and also how to make the terminal look like urs

    • @cococry
      @cococry  Před 24 dny +1

      im using arch and to make the terminal look like that, install alacritty, and install neovim with nvchad

    • @unnamed1479
      @unnamed1479 Před 17 dny

      @@cococry what windowing system are you using? is it wayland based?

    • @cococry
      @cococry  Před 17 dny

      @@unnamed1479 ragnar is currently written with xlib (xorg based) but there is a wayland branch under construction.

    • @unnamed1479
      @unnamed1479 Před 17 dny

      @@cococry thanks, haven't heard of it. gonna have to check it out.

    • @unnamed1479
      @unnamed1479 Před 17 dny

      @@cococry woah, you wrote this too!

  • @user-fj3gl8wc7s
    @user-fj3gl8wc7s Před měsícem +1

    noice

  • @adskiyponchik7721
    @adskiyponchik7721 Před dnem

    Can you make a video about your nvim setup?

  • @Rice7th
    @Rice7th Před 29 dny

    May I ask you some contact info? I'd like to ask a couple of questions regarding leif.

    • @cococry
      @cococry  Před 29 dny

      my email: cococry.btw@gmail.com

  • @derwintromp1461
    @derwintromp1461 Před měsícem +3

    What editor are you using?

    • @_KondoIsami_
      @_KondoIsami_ Před měsícem +1

      He is using neovim

    • @ru2979
      @ru2979 Před měsícem +1

      ​@@_KondoIsami_ Thank you 😊

    • @z4pp820
      @z4pp820 Před měsícem +1

      a seemingly nice configuration of neovim. the (pen)ultimate editor if u take the time to learn it (maybe behind emacs idk)

  • @heychaklader
    @heychaklader Před 14 dny

    What’s the IDE called used for coding?

  • @harsha.2186
    @harsha.2186 Před měsícem +2

    Can you share your nvim setup

    • @saibakho
      @saibakho Před 29 dny

      same here. wondering which plugin he uses to make the command line window below permanently showing in vim/nvim. Or is it via a WM/tmux ?

    • @cococry
      @cococry  Před 28 dny +4

      @@saibakho im just using nvchad. its a neovim configuration

    • @saibakho
      @saibakho Před 28 dny

      @@cococry From your advice i have found bufterm.nvim, which is exactly what i need. Thanks a lot !!

  • @haydenfrobenius9818
    @haydenfrobenius9818 Před 13 dny

    write the machine code entirely in a hex editor like a real sigma.

  • @verygoodteaa
    @verygoodteaa Před 3 dny

    is there any way possible leif would work on win?

  • @waynem3098
    @waynem3098 Před 13 dny

    im on 12:41, so the scrollbar is showing and can scroll but the text is not, even without for loop it's still not showing text

    • @waynem3098
      @waynem3098 Před 13 dny

      outside the scope, lf_text just works fine

    • @waynem3098
      @waynem3098 Před 13 dny

      ah, just add text_color to props and it works

  • @realDrLimitless
    @realDrLimitless Před měsícem

    Can you share your DE and WM configuration or make a video to set it up like that?

    • @realDrLimitless
      @realDrLimitless Před měsícem +1

      Oh nvm i found a video you made already, thanks

  • @ages2001
    @ages2001 Před 20 dny

    Which IDE are u using?

  • @christosbinos8467
    @christosbinos8467 Před 17 dny

    Didn't know python had a C skin

  • @user-yc8up2py2r
    @user-yc8up2py2r Před 10 dny

    Make a GUI Calculator in C purely on standard VGA drivers 💀💀💀

  • @loo2003
    @loo2003 Před 17 dny

    writing this in Notepad++ and I can't check whether it will work.

    • @cococry
      @cococry  Před 17 dny

      are you on linux? and do you have a c compiler?

    • @loo2003
      @loo2003 Před 17 dny

      @@cococry the answer to both questions is no. office machine on windows

    • @cococry
      @cococry  Před 17 dny

      @@loo2003 okay, so you could try installing mingw-w64 and compile leif with that compiler. (you would have to write a manual build script and manually build dependencies)
      then you need to get glfw include folder and glfw prebuilt binaries. then link leif and glfw to your calculator c file and compile that.
      that should work, but it requires pretty advanced knowledge.
      on linux, you can just follow the tutorial.

  • @morning-lp3zb
    @morning-lp3zb Před 27 dny

    What font?, so preetty

    • @cococry
      @cococry  Před 27 dny +1

      In the terminal its lilex nerd font and on the bar its victor mono bold italic :)

    • @ziphy_6471
      @ziphy_6471 Před 27 dny

      @@cococry What IDE? Neovim or vim?

  • @realbakednotfried
    @realbakednotfried Před 28 dny

    what happens when 0/0

  • @xinzeng-iq7zv
    @xinzeng-iq7zv Před 29 dny

    i don't think chard going to be making calculator programs

  • @Scriabinfan593
    @Scriabinfan593 Před 28 dny

    I would like to inform you that I am in fact not a Chad. Thank you.

  • @aidennwitz
    @aidennwitz Před 27 dny

    tschmod

  • @zeyadmohamed9935
    @zeyadmohamed9935 Před 23 dny

    that is halaand voice

  • @gabrielkolletalves493
    @gabrielkolletalves493 Před 26 dny

    Kinda off topic but is that Emacs?

    • @cococry
      @cococry  Před 26 dny +1

      No, its nvim with nvchad

  • @chakraprasad8110
    @chakraprasad8110 Před 15 dny

    These people can't do hard coding . Such simple programming with heavy loads of external library . Can even code there own gui😂😂

  • @philliplam2704
    @philliplam2704 Před 26 dny

    Jesus Christ you’re a god