i just wanted to say you are just an amazing communicator. funny, smart, humble. like the opposite of those “get a job at google in 2 weeks with my training program” tech bros. i’ve been watching your vids for a while now and i think we kind of work a similar way, lol. anyways, thanks for all the entertainment
@macchiato_18819 ай бұрын
I can't stand those kind of douches. I call them the "silicon valley bros". They're like what gym bros is to fitness. Joma tech is a prime example of such a douche.
@cozerian Жыл бұрын
i love watching tsoding slowly descending into insanity
@NoobaLV Жыл бұрын
I KNOW RIGHT
@breakprismatshell6270 Жыл бұрын
templeOS when?
@Salantor Жыл бұрын
@@breakprismatshell6270 He already did that, year ago.
@breakprismatshell6270 Жыл бұрын
@@Salantor It's not about programming on templeOS, but programming something like templeOS
@Salantor Жыл бұрын
@@breakprismatshell6270 So just an operating system. TempleOS is one and only.
@maxheim3802 Жыл бұрын
Damn im Hyped, its like there is such an overwhelming amount of possibilities when it comes to graphics and gui, when there is a c library that is featured by tsoding, you gonna know its worth learning. Thanks Tsoding!
@10e999 Жыл бұрын
Always a pleasure to follow your C project.
@DFPercush Жыл бұрын
One way to improve the performance of drawing circles is, for each horizontal line, compute the X offset of the start and end of the circle on that horizontal slice. x_ofs = sqrt(r^2 - y_ofs^2) ; Then fill pixels between (center - x_ofs) and (center + x_ofs) those two points. Or call memset(). One sqrt per line, rather than per pixel.
@michaeljones1686 Жыл бұрын
🤓
@bart2019 Жыл бұрын
A common trick in FORTH to create a repeated string is to initialize the first substring and then copy forward... thereby copying the bytes you just copied.
@Mushele Жыл бұрын
I am not a programmer, was just writing some little projects in c++ from time to time, this video kinda makes me want to try C this time, looks fun
@ZephyrCubic7 ай бұрын
I think that makes you a programmer! Just not a professional ;-)
@hanqnero Жыл бұрын
Hope this won't be abandoned, actually poggers.
@DaviSimDoP Жыл бұрын
I'm so happy YT suggested your channel to me! Your content is super instructive and enjoyable. Keep up with the good work!
@peezieforestem5078 Жыл бұрын
Lol, I speak Ukrainian and I wouldn't've guessed the secret meaning until you explained it. I guess my brain just switches to a different mode when things are in a different language.
@iDoComputers Жыл бұрын
i thought it was russian
@peezieforestem5078 Жыл бұрын
@@iDoComputers what was Russian?
@iDoComputers Жыл бұрын
@@peezieforestem5078оливець
@iDoComputers Жыл бұрын
but it was ukrainian
@lolix7002 Жыл бұрын
This is very high level programing skill, it's funking impressive. As a c++ programmer who is don't feel to learn fast enought, this video it very interesting !! thx
@7KeHek Жыл бұрын
There is Bresenham's line algorithm to draw lines without using float numbers
@evlogiy Жыл бұрын
I love that you programming red rectangle for 40 minutes and then you say: "It's cool. It's pretty cool." and I'm like: "Not bad. Not bad actually." How is simple red rectangle written in C can be so... mesmerizing for us, programmers, is the question for me. It's a miracle beyond common sense.
@jeezusjr Жыл бұрын
Thank you for sharing. This is one of the things on my programming bucket list. Definitely going to try doing it in Ada. Please provide donation link in description so I can show my appreciation as I can't join live stream.
@luandkg Жыл бұрын
Amazing Tsoding 👏🏻👏🏻👏🏻👏🏻 one Idea for futures vídeos - implement your own image file format !
@thecodingfoundation Жыл бұрын
minifb together with olive.c is like a match made in heaven.
@خالد_الشيباني Жыл бұрын
I knew this was coming giving all the recent graphics related Tsoding sessions
@darkodj Жыл бұрын
As someone who knows all the ex-yu languages, pencil is Olovka, there is no c character, that google translate is completly wrong. Olivec does not have a meaning in any of them, but clever name, none the less. Fun fact, Olive the fruit is called Maslina.
@TsodingDaily Жыл бұрын
Oh yeah, I double checked and realized that Google Translate was wrong on that already after the stream! :D Thank you for bringing that up!
@peezieforestem5078 Жыл бұрын
This might not be the case in ex-yu, indeed, but I speak Ukrainian and he's absolutely right, "олівець", which would be transliterated to "olivec", is a word that means pencil.
@darkodj Жыл бұрын
@@peezieforestem5078 i was commenting because he mentioned bosnian, never doubted ukraninan translation, only the serbia-croatia-bosnia-monetenegro part :)
@VojtaJavora Жыл бұрын
Hmm. Does that have any relation to the word for lead (metal)? The same way as in English with pencil lead (graphite)?
@darkodj Жыл бұрын
@@VojtaJavora So, lead is Olovo, but it does not have any direkt relation with word for pen or pencil which is Olovka :) they are just have very similar order of letters :)
@olivec9108 Жыл бұрын
Uhh… NO ONE LOOK AT MY NAME
@ru29794 ай бұрын
😮is it u who discovered it ??😮😮
@olivec91084 ай бұрын
@@ru2979lol discovered what?
@imyosha Жыл бұрын
Really good video, but I cannot agree with statement that custom structures which encapsulate data specific to canvas and shapes makes the library less generic. In fact when you expose functions to user of the library you already enforce the user to lead the contract defined by functions declarations. You already predefine the types and variables which the user should prepare before using your functions and if the user have own structures as it was mentioned in your example, the user should translate them to be compatible with the interface of your library (which is absolutely normal). This is the reason why adding of custom structures do not have any influence on the level of "genericity" of your library. But such custom structs have some valuable advantage - it makes client code more explicit and readable. With such structures you firstly prepare them in explicit and obvious for anyone way and after that you pass this prepared data to the functions, which is cleaner than passing 7 arguments to the function and simultaneously making some additional math on part of them. The second advantage is that you can reuse canvas or shapes in convenient way. In my opinion from this point of view the design which you chose is unfinished, you define the interface, but do not encapsulate it parts to entities, where each entity is responsible for some abstraction necessary to use your library.
@lavatasche280610 ай бұрын
Totally agree
@addowhite6331 Жыл бұрын
A few years ago I implemented defer with a macro and it's been a game changer, I've used it ever since. It defines a nested function with a user-defined body and automatically calls it using __attribute__((cleanup)). It uses __COUNTER__ so that each defer nested function has a unique name. Only works in GCC and CLang, not MSVC. So the following would be valid: __auto_type buf = malloc(1024); if (!buf) return false; defer { free(buf); } __auto_type fd = open("test.txt", O_RDONLY); if (fd == -1) return false; defer { close(fd); } return true;
@anon_y_mousse Жыл бұрын
There's a simpler way of doing that which would work in every compiler and even be compliant with older standards.
@addowhite6331 Жыл бұрын
@@anon_y_mousse I don't think so, but would love you to prove me wrong. Whenever I've needed to use MSVC I've simply used C++, because it's not possible to implement defer in portable C.
@anon_y_mousse Жыл бұрын
@@addowhite6331 It is if you use macros to define the function. I can't post a direct link, but do you know of pastebin?
@Anon.G Жыл бұрын
@@anon_y_mousse I do
@kplays_6000 Жыл бұрын
@@anon_y_mousse 2 months on, still waiting for the pastebin
Жыл бұрын
Look up Bresenham's line rasterising algorithm. Very elegant, very simple, better than this y=kx+c stuff.
@accountprincipale2293 Жыл бұрын
man this is arab for me, and i feel kinda descuraged to learn more coding, because i tried to learn how to code in c++ and i stopped (even tho i want to restart but idk i feel to stupid for now) months ago and i didn't succeed very well, not because of the difficolty of the language di per se but because of a lack of motivation, and watching you do this made something move inside of me, i'd very much want to know the way i should follow, but the more i search the more i am confused.
@4115steve Жыл бұрын
the old days before google were miserable. It sure is great having the ability to look up anything at anytime
@johangamb Жыл бұрын
are all these CELL_WIDTH/2 etc calculations inside the nested row/column loop optimised out by the compiler ?
@TsodingDaily Жыл бұрын
Yeah, probably via something like constant folding en.wikipedia.org/wiki/Constant_folding
@sireddenied6225 Жыл бұрын
The simplest video format I can think of would be something like subtitles. At this keyframe of audio make sure we are displaying this keyframe image, then just interpolate between keyframes for what image to display. but in practice, that's probably impractical or else someone would have already done it.
@galihsurya5606 Жыл бұрын
He writes everything using C. This guy is such a chad.
@anon_y_mousse Жыл бұрын
Personally, I default to using .bmp files because I've just about memorized the simple format for them and they work on every platform. Generally I'll have my own programs generate them then use ImageMagick to convert them to .png's after the fact. I really should learn libpng, but I keep putting it off. As for handling cleanup, I usually just do it manually by incorporating layers of jump points, and instead of setting the return value then jumping I regularly decrement the return value at each failure point so the quick exit can just goto its associated return. If I know I'm going to be doing a bunch of memory allocations I just add the labels right when I start writing and number them in reverse. And at the end, above the first label, I'll set the return value to 0.
@firexgodx980 Жыл бұрын
Why do you need to know the format of a bmp at all? Just use a library to open the images lol
@anon_y_mousse Жыл бұрын
@@firexgodx980 Because I write most of my code from scratch. Often implementing such libraries for others.
@tissuepaper9962 Жыл бұрын
@@firexgodx980 because it's a lot easier to just write the simple code than to learn a new library that somebody else wrote. Yes in the long run we would save time but we don't care, we're going to keep writing programs that output PPM and BMP images until the day we die.
@firexgodx980 Жыл бұрын
@@tissuepaper9962 weird flex but ok
@youtubehandlesux Жыл бұрын
@@tissuepaper9962 Dude, using stb_image_write.h is not gonna give you instant cancer, tf are you on about
@ChrisBNisbet Жыл бұрын
I've been using that return_defer technique for some time now, but I have been subjected to backlash for _not_ having loads of cleanup/return strewn throughout my functions. People take one look at the 'goto' and tell me I'm doing it wrong.
@Bobbias Жыл бұрын
I mean, goto considered harmful has been around a long time. Personally I think this might be one of the few legitimately good uses of it, but I can certainly see people preferring nasty code rather than using goto.
@ChrisBNisbet Жыл бұрын
@@Bobbias - I absolutely understand why using goto to leap around code isn't a good idea, but as you say, this usage is a bit different - the single cleanup/exit point seems less bug prone and puts less load on my wee brain.
@adeptmeh566 Жыл бұрын
there are times when using goto is not a bad thing, see the linux sources
@python_n_c Жыл бұрын
Agreed, cleanup code in C is one of the few valid usage of goto
@artlenski8115 Жыл бұрын
Putting goto into a MACRO is dangerous eg what if you forgot to define the label or put it in a wrong place, this dependence could cause many bugs IMHO
@zoeythebee1779 Жыл бұрын
Okay im actually so excited about this
@alexw50936 ай бұрын
I noticed that you keep a list of references at the beginning of your videos. Are those references what you found during the research of your project? I am curious because I think that is pretty neat and organized. I'm thinking I should do something like that as well, because I tend to lose the information that I found during the research phase of my project once I finish it...
@bhavyakukkar6 ай бұрын
its the references he talks about to chat, and he writes them down into the file for yt viewers so he can put it in the description when he uploads the vod corresponding to that stream to yt
@bhavyakukkar6 ай бұрын
i think this went on to becoming his most popular project
@leonardopisano9575 Жыл бұрын
Thank you. This exception management with the terrible "goto" is amazing.
@magictrickdev Жыл бұрын
That return defer, I never saw a use for GOTO until today, and I don't hate it. Gonna pocket that.
@hemicar92 Жыл бұрын
This is out of topic, but I had to step in. Pencil is not "olivec" in Bosnian. Google translate had a fluke I guess. In Serbian, Bosnia, Croatian and other Balkan Slavic languages pencil is translated as "olovka"
@hahamartin6595 Жыл бұрын
wonderful olive.c interesting
@deinemama6303 Жыл бұрын
31:42 I typically make structs for everything and then provide two functions for each thing. One for just the parameters (width, height, x, y, etc.) and one where it takes just a pointer to a rectangle struct. So then the user can chose what they like best. Maybe even make an ifdef or something to enable/disable the structs
@caiodavi9829 Жыл бұрын
😮
@leosmi1 Жыл бұрын
My last name is "Oliveira" means olive tree, Descend from Portugal.
@koktszfung Жыл бұрын
Is the defer_return thing a standard way of handling files?
@TsodingDaily Жыл бұрын
no
@LogicEu Жыл бұрын
Sounds like a great project
@kevincarvalhodejesus4473 Жыл бұрын
Like so much your videos tsoding! Keep it up
@lllbenderlll Жыл бұрын
Really Nice video - Man!!! Hello from Kyiv by the way ... Really nice to see a smart man from Russia. How about to rust-ify this project?
@tatterdemalion898 Жыл бұрын
If i wouldn't work in automotive i would do videos on implementing and debugging stuff. I'm sure many people would feel better about their day afterwards :D Thanks for the great video, and for sharing your knowledge!
@pr0katchik Жыл бұрын
прикольна назва для бібліотеки :)
@crumpus69 Жыл бұрын
you can use "atexit" to close files like modern languages. I don't have much experience with C, at least that's how I know it.
@valshaped Жыл бұрын
atexit takes a function pointer and no args, so you'd have to save your file handle somewhere. It also executes only at program exit, so you wouldn't release the file when the function returns. Calling the function again would open the file a second time, which might not succeed.
@atlantic_love Жыл бұрын
What Linux distro and desktop environment do you use, if you don't mind my asking?
@awedsss7462 Жыл бұрын
Debian and i think he is using dwm, check the FAQ in his twitch channel
@nacnud_ Жыл бұрын
Mind blowing that this is seen as good stuff. Why would anyone want to memorize a video encoding algorithm? 2023. Also, C style needs to be evaluated. Like, take this as input, for sure, but not gospel :)
@ichigo_nyanko Жыл бұрын
Does anyone know what is with the do while loop at 20:40 in return_defer? why have the loop instead of just the code since it's never going to loop anyway.
@imyosha Жыл бұрын
It forces the user of macro written in such way to append semicolon after macro call, which makes it similar to call of normal C function. It creates nested scope in place where it is called and if you will write the macro without do/while(0) parts (just braces) you can omit semicolon in the end of line. But with do/while(0) the compiler return error if you try to build the program without semicolon after the call of such macro. The same can be applied to the situation where you do not create internal scope by calling macro (something like that #define MY_MACRO foo(); bar(); ), in such case you can omit semicolon which looks strange in C and can lead to non-obvious side effects in some situations.
@ElPikacupacabra Жыл бұрын
The explanation above is good. The only thing I would add is that in C, the only way we used to be able to have a block of statements joined together, but not followed by semicolon (so we can add our own after the macro) was with the do-while construct, which demands a semicolon at the end. If you tried another way, you couldn't add the extra semicolon and it would look weird, so this technique became popular. But I think they fixed it. In the latest standards/compilers, extra semicolons don't matter.
@magnum21th.c9 ай бұрын
enjoyed every second of it 🇯🇵😁isnt that freaking cool man getting what they taught in schools and make japan flag out of it😂
@bart2019 Жыл бұрын
One way to get rid of the staircase: you now have a case for vertical lines and a case for everything else. If you change that to the case |k| < 1 (or maybe
@unmeinks5907 Жыл бұрын
olive.c is such a clever name, also whats that status bar haha
@jawad9757 Жыл бұрын
I think that's the default emacs thing
@georgekoduje Жыл бұрын
It's fun association but pencil in some slavic languages refers to lead which first pencils were made of.
@VojtaJavora Жыл бұрын
Same in English actually
@DuskyDaily Жыл бұрын
Finally uploaded it to KZbin, ;)
@Lukas-qy2on Жыл бұрын
love the stream so far. but MY GOD that keyboard clanks. maybe get a directional mic xd
@yadukrishnan.d6888Ай бұрын
damm the name is genius. the coincidence😮
@jonathanmoore5619 Жыл бұрын
This is brilliant. Thanks
@godnyx117 Жыл бұрын
How does it compare with Cairo when it comes to its feature set, stability and performance? Do we have any benchmarks?
@aceJacek Жыл бұрын
Very close to Polish "ołówek", where the word root is "ołów" = lead. guess why :)
@CarterColeisInfamous Жыл бұрын
1:24:49 why not just change the direction it iterates instead of swapping the ints?
@mbarrio Жыл бұрын
Maybe "godot-4 GDScript" next? I enjoy when something "feels" wrong
@user-pu5vq4vs9u Жыл бұрын
I like this sheet!
@OfficialYunas Жыл бұрын
In fact, a division is not more error-prone than adding or multiplying. Only subtraction can be really painful.
@4otko999 Жыл бұрын
Good stuff, love it
@ethansmusic9898 Жыл бұрын
Is it normal to mix the curly brace styles. Having functions be a different style than loops and if statements is wierd
@anon_y_mousse Жыл бұрын
It's actually pretty common, using K&R style for internal constructs while using Allman style just for function enclosures.
@tissuepaper9962 Жыл бұрын
Obligatory "Allman style bad. K&R good."
@itellyouforfree7238 Жыл бұрын
Actually, this is the K&R style: en.wikipedia.org/wiki/Indentation_style#K&R_style
@anon_y_mousse Жыл бұрын
@@tissuepaper9962 Allman style is the best.
@orhn11 ай бұрын
"Isn't that cool?"
@masoudesmaeilian5083 Жыл бұрын
Do we have a simple format for writing a PDF and font? something like LATEX?
@oeerturk Жыл бұрын
hdhdhsh amazing naming very interested in this
@deerel Жыл бұрын
I have just watched 15 minutes so far. But my initial thought: why don't you make a struct olivec_image with uint32_t * pixels, size_t width, size_t height, and make all the functions needing the array to take a struct olivec_image pointer?
@deerel Жыл бұрын
You mention it at 32:00. So, now I know why you chose not to do it. However, I disagree with your design choice. You should force the user to use your struct. :)
@markmckenzie5343 Жыл бұрын
Did this man really just say he sees no reason for V and W to be separate letters? LMAO.
@user-ne4bd3ry1n Жыл бұрын
есть ли библиотека для работы с видеокартами в текстовом моде? curses?
@chrissimpson6088 Жыл бұрын
Olives are stonefruits
@gogdarag Жыл бұрын
Very nice lib name. 👍
@13thk Жыл бұрын
Can I make bindings for it?
@TsodingDaily Жыл бұрын
Sure, it's under MIT. But keep in mind that it's unstable and things may change.
@13thk Жыл бұрын
@@TsodingDaily Thanks
@13thk Жыл бұрын
With this I can begin writing a more idiomatic wrapper around it
@devit6122 Жыл бұрын
wait is he the one writing the library?
@TanjoGalbi Жыл бұрын
@16:44 you said you doubled the amount of circles. Actually you quadrupled the amount because you multiplied both COLS and ROWS by 2. It would have doubled if you had only multiplied one direction only, like COLS*2 by ROWS. So, you messed up on your school maths there after saying you are making school maths fun earlier! 😉
@ItIsYouAreNotYour Жыл бұрын
Hmm...does it come with unlimited bread sticks? I'll consider...
@zennmyst5347 Жыл бұрын
Does tsoding still have a discord? I can't find if so. I am new to everything C, git, Linux.... Would be nice if I could ask question/advice if such is allowed? I watch his videos even though most of it is over my head... He gives me ideas of programs to use to code... Or ideas for coding....
@erbenton0711 ай бұрын
Hwy, what editor are you using?
@tusharagarwal53067 ай бұрын
What font are you using?
@DannyLousberg Жыл бұрын
.tga is about as simple as ppm and should be quite widely supported?
@c4llv07e Жыл бұрын
The pencil is too unstable and is currently under development.
@AlguienMas555 Жыл бұрын
Awesome
@vnshngpnt Жыл бұрын
It's funny how you pronounce "olive.c" which sounds exactly as plular "олівець" in Ukrainian haha. And singular form has emphasis on E. So it's "olivEc".
@GlobalYoung7 Жыл бұрын
thank you ❤👍
@coffee-is-power Жыл бұрын
Make a 3d graphics API in olive
@MrKevinontube Жыл бұрын
“Too smol Pepehands”?
@galihsurya5606 Жыл бұрын
lol 😂 I see that too
@varomix Жыл бұрын
what about Rayib?, is very similar concept, single file, graphics library
@youtubehandlesux Жыл бұрын
Although it can be used with only #include "raylib.h" , it's not a single file library. See raylib/src folder.
@Diamonddrake Жыл бұрын
Nice!
@samosimoncic5020 Жыл бұрын
Do we realy need do-while loop in macro retrun_defer?
@jawad9757 Жыл бұрын
Yes, it's necessary for some edge cases which can mess up parsing
@wrnchx Жыл бұрын
олівець?
@cyanmargh Жыл бұрын
Да, в этом и суть
@thisguyisnotable Жыл бұрын
if you look at the bottom, why does he have a porn folder open? 😳
@Zorgatone11 ай бұрын
What about antialiasing?
@AymenAbdessamad Жыл бұрын
can you please do something about blazor Webassembly like building an application from scratch tuto or something like that ; thank you anyways for your efforts
@Bobbias Жыл бұрын
I doubt tsoding will touch blazor. He generally avoids dealing with large libraries/frameworks which are often used in corporate programming. He left his programming job because he hated that overcomplicated stuff.