You don't need DOM
HTML-код
- Опубликовано: 5 фев 2025
- Previous Episodes: • Music Visualizer
References:
Tsoding - Musializer - github.com/tso...
github.com/oco...
• Immediate-Mode Graphic...
nu11 - RUclips - / @nu11_ft
nu11 - WIP Works 2016-2022 - / nu11-wip-works-2016-2022
pilotredsun - Achievement (full album) - • pilotredsun - Achievem...
Chapters:
0:00:00 - TBD
Tsoding becoming unintentionally the Grinch of web dev. I love it
Unintentionally...?
You’re one of the reasons why I still believe in the internet and society.
Don't do anything crazy the day he stops uploading because at some point he will.
I started a Raylib app to mess around with audio. This is very helpful because my instinct was to start abstracting a UI in the traditional manner. This gives me a much better idea of how to structure the code.
Casey is even more of programming legend than I thought if he created this.
about dear imgui's disambiguation of IDs, you can manually push and pop ids to that stack, you can decide to push a string, a pointer or a integer. So if you are iterating over a list of things you can do a PushID(i); at the start of the for loop body to prep the stack for that id and then PopID() at the end.
You're a really great programmer. I wish I can have the same skill as you.
it takes a lot of time and effort just put the time and you will get better don't put yourself down you can do it !
Making a 2x2 single color image is pretty easy in GIMP btw
Bro discovering gamemaker draw event
Making JS "developers" uncomfortable be like
JavaScript is the Chad's choice. It's OK if you can't handle the speed
@@StarContractSpeed and JS in same sentence? 😌
@@Ujjawal_Guptajs is not slow
@@mipselqq3133no just every application that's ever been developed using it
@yestechguy-fj9tmjs isn’t bloated, npm is (its really chaotic, with the leftpad and everything package. and for some reason an is-odd package, and an is-is-odd package to check if a function is is-odd, AND the ansi-red package, ansi-orange, ansi-yellow…)
You have convinced me exactly why we need DOM and react
Nah
You never needed id's or keeping track of active element for the problem you were trying to solve.
Just add one bool flag per clickable element:
When a mouse-down happens and you have hoverover - set your flag to true.
When a mouse-up happens you check if you initiated the click by simply checking that flag (and react to the click..), and immediately after this you unset your flag NO MATTER where the mouse is - this makes releasing outside unsets your flag, and no other element had their flags set because they did not have hoverover when the click was initiated, so no reaction.
The hoverover check (aka hit-test) is independent to this idea, so any approach can fit. Some ideas for the future: allow for alpha-test (clickthrough fully transparent pixels) or having clickables within clickables (some global flag to indicate click was handled this frame)
Hope you find that useful
after about an hour i realized that i missread dom with Doom. So when comes the gaming part xDD. ??
Alexey I love your streams and content . I started working in IT with any background in CS, literally nothing. Went through support projects and what not and just survived. It was nothing more than a job for me. In 2019 I took a break and studied real hard to learn development, though I never knew what to learn, I just learnt depths of Java and its frameworks. 2020 I was introduced to twitch and learnt so much from all you streams. 9 years and still learning, your way to thinking and breaking down a problem is really really brilliant and following that approach these stupid leetcode problem are not just interview material to me, it’s fun to solve these and think in depth, implement these techniques in real projects. I wanna say thanks a lot. @Tsoding. ❤
Don't want to be rac*st but you sound Indian or Russian for some reason
I'm at 1:33:00. I'm assuming Jai accepts an identifier not to disambiguate collisions, but for the loop example you have. Identifier would be `i` in your code, as its in a loop.
I like the approach. I think it's probably a good idea to have a worker thread run in the background dealing with input, so as to not block and cause hitches.
Sorry to be blunt, but based on what ? I don't see how input handling could be slow at all, the kernel handles interrupts itself in the background and the OS's API just read whatever the kernel has to say, it's not a slow process.
@@Toctavebased on your mom
Input is handled by raylib on every frame, regardless if there is input or not
@@Toctave based on the fact that the GPU doesn't actually handle or detect user input, it needs to be interpreted by the cpu which will then forward instructions. This leaves the potential for a briefly 'frozen' ui if the processing isn't instantaneous. With a separate thread you can free up the infamous 'ui thread'. It's a very basic concept.
@@TerminalHeatSink What exactly do you mean by 'handled' when there is no actual input TO handle?
The web has an implementation problem, the ideas are solid.
It's all Skill issues all the way down
What problem? There is no problem in the web (other than ads), or is it?
54:26 what about using half of id for non-variable components:
full screen button has id (0x100000000)
track panel buttons have id (i | 0x200000000)
you would get collision only if you somehow load more than 0xffffffff musics
I would love to have support for some kind of themes in the future. I'd like to make it look like Cava.
18:21 click is not just mouse button release when hovering over, notice how you hovered over `Unwatch` and released mouse button but nothing happened
edit: he talks about that 19:16
It will be interesting if you continue making your own react like framework, thats great
java script developer be like: where callback
This comment made my day!
Very interesting perspective on "humans are the gradient descent" of this "model/black box" of a program that is trained on the code you are outputing (as the optimizer). Gonna chew on that for a while.
After all, machine learning and AI is just humans trying to get out of their biological bodies and into technological ones.
Mista azusin
I'm curious why you need to maintain component IDs, wouldn't you abstract click down and click up as, unclick -> click and click -> unclick. This way each element only maintains its own state, if a component is unclicked and it was previously clicked then you know it's clicked.
53:43 what if hash collision?
I had the same question. I think it should be fine for small UIs (i.e. Musiializer) but I don't trust this idea for complex UIs.
45:32 exactly this is an example of the “midwit” meme. Only true geniuses understand that the code should impose its will on you, not the other way around.
The web technologies is one of the most advanced technologies out there yet the most popular one is only the DOM. I mean bro they have WebAudio and WebGPU and the best part is its on any modern device in the world and it's pretty much standardized. It's so much waste I think that less people acknowledge this part of the web (The browser)
In this example we see that the requirement is mouse down then mouse up as you mouse up on another button that isn't clicked 18:30
Ope
currently learning c . eveyrthing make sense now
In Java Swing/AWT that's called passive/active rendering.
like adding components vs. overriding the paint method? is that what you mean?
I see what you meant, but immediate mode is different. Swing/AWT still constructs a tree of components.
19:40 can mouse pressed and released same frame?
Immediate UI is basically a FP way of doing UI.
I guess it is the other way around
No, the FP way is Model-View-Update. You still construct the whole UI at every frame, but as an actual tree, not as a sequence of function calls. And then, after you've done all the rendering, you collect all the events that happened, and decide what to do with them. Not with many little callbacks, but with one centralized "Update" function.
There are some similarities, but a FP UI would be different. More like transforming an UI into a form of function that takes the world state as input and outputs the graphical state.
01:37:30 git push?
Streamin When?
Hello, im an intermediate in C and I understand it quite well, I want to start watching your videos to learn more but i dont know where to start, can someone help?
You can open almost any playlist. They usually separate videos on different project and quite often built with C. You can start from this project or Olive.c (it is library for visualization)
Just... start watching? Ideally from a first episode in a series so it's easier to follow along, but not required because he goes over what he did and what the goal is every episode. There's no requirement to watching...
Ngl this just sounds like React, atleast in the way you're describing it in code.
If you get only React (no Redux, libs, webpack, etc), use it without Component class (only functions). Then yeah. Very similar concept. But I would say the React way of passing callbacks doesn't align with the original Immutable mode intent.
passing callbacks where exactly@@ecosta
@@gerooqWhen you instantiate a component and pass attributes like "onclick", "onmouseover", etc
Present, teacher!
How did you learned to do this ? Can you provide some resources that I can learn from ?
It's years of experience. You just need to have enough motivation to learn things. Pick up a project you really want to do (like developing a website or a game), then pick any tool you like and start using it. There's a ton of tutorials online for anything.
Anyway, that's how I learned programming. I just did stuff and googled for information I needed.
If you want to learn C and this programming style, check out handmade hero.
@@yds6268 - exactly. Also, if the tool you selected doesn't fit your needs, try to improve it, learn a new tool or implement one yourself. Rinse and repeat.
But you need a good brain to do that
I recently wrote a console application. As the UI got more complicated, I realised it was what would be considered "immediate-mode." This is ImTui.
Then it kept growing and getting more complicated, and I was having to pass multiple callbacks into ever-growing function signatures... I almost considered introducing some OOP! 😲
Very interesting. I would love to see it in action. But I suspect there is something "non-immediate" if you are using callbacks.
@@ecosta I'll put it on the hub at some point. It's basically just a wrapper for a few common tasks I do in FFmpeg.
where I can find a link to your discord?
What is a DOM properly, is a widget?
Please excuse me if this wasn't your question, but DOM stands for Document Object Model. It is the way web browsers model the "document" (i.e. the web page being displayed). In a nutshell, it is a tree of html components (div, span, etc).
@@ecosta so is a data structure of the html components
@@caio757 In general lines, yes. But what we call DOM is standardised - all browsers support that same data structure
do i?
Some guys just need sub
hallo! So you german or not?
He is Russian
he is russian
He is Russian. They're like Germans but even smarter.
😅 and they dance with bears ?
@@samuraijosh1595I think it's the other way around
Do it in Delphi and be more happier
miss me with embarcadero stuff
emacs SUCKS
when turn to rust?
Ok but you still need a library, my slavic comrade.
EDIT: even "Python" has a "library" called tkinter inside the language and there is no need to look around to find another one. With C or C++ without Raylib or IamGui or others, you can't do it so easily like the webdev does.
It's more about the journey than the end goal. I love his approach of "let me try doing my thing until my thing isn't fun anymore". 😄
Really, if it's a one-person project and if you're a lonewolf, a lot of things won't make sense. Now try to manage a project with many people without a standardized data hierarchy, it will be pandemonium.
Cool, learn bunch of stuf thanks