Make a GUI Calculator in C like a real Chad

preview_player
Показать описание
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: https://

FOR DEBIAN:

Debian users and derivatives (Ubuntu, Mint, etc.) you will have to use the standard way of building and installing libraries.

First of all, make sure you have your distro version updated with sudo apt update && upgrade

Also, for glfw you will need the libwayland-dev and libxkbcommon-dev packages to compile for Wayland and the xorg-dev meta-package to compile for X11. These will pull in all other dependencies so make sure to type in the terminal the following command: sudo apt install libwayland-dev libxkbcommon-dev xorg-dev.

Get the github repo links for cglm, libclipboard and glfw. (I'll get to the roboto-mono part later in the comment)

Clone each of them in your /home/your_username path preferably.

Create a build file for each of them. (build_cglm for cglm, build_glfw for glfw, you get the idea)

type cd to enter each build file and type in the terminal the following command: "cmake -S /home/your_username/the_library_you_want_to_build -B ." (without quotes).

-S is to instruct cmake where the source file is and -B is the path where you want it to be built. The dot at the end there is to instruct the terminal that you want to use the file path you're currently in as your destination to build, example: cmake -S /home/benj/libclipboard -B .

Then you will type make, wait for the terminal to tell you it is built, then type sudo apt install to install it in the default paths for you to use it (default paths are usr/local, usr/include and usr/lib)

debian tutorial by benj
Рекомендации по теме
Комментарии
Автор

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

nno
Автор

Man, thank you so much. I had to do some subtractions and additions for days but couldn't without a calculator, you're a lifesaver

feliperamos
Автор

will be watching the entire thing later, love this stuff <3

leahfluffytail
Автор

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

acatisfinetoo
Автор

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.

jupiterapollo
Автор

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

jaull
Автор

Wow, I'm still a beginner learning C using IDEs and text editors, but you managed to create something using Vim? I'm amazed.

yulose
Автор

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)

eyzake
Автор

You're a tsoding fan aren't you?

mantra
Автор

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

jordonfrancisco
Автор

Why don't you document leif and post it on your github? It would be a great help.

glauciovictor
Автор

Amazing, do you have tutorials on how to use your the leif library?

itakagastonkitambala
Автор

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

pianochannel
Автор

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!

TheWinnieston
Автор

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

kamertonaudiophileplayer
Автор

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

higgsboson
Автор

Is this Windows compatible? Also nice Neovim setup <3

pchan
Автор

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

stephanenathan
Автор

I write my own gui libraries using pure vulkan

kotofyt
Автор

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

mohamedbentaleb