This widget exposed some major flaws in my UI framework

  Рет қаралды 1,434

sphaerophoria

sphaerophoria

Күн бұрын

Пікірлер: 7
@sphaerophoria
@sphaerophoria Ай бұрын
Big realization after stream that makes a lot of this a lot easier. Widgets are already type erased when added to the layout system! This means that we are totally free to add compile time interfaces to widgets themselves. Many instantiations of the same DragFloat can have different sizes. This fixes a huge part of the complexity of handling callbacks with context pointers. E.g. retrieving a float for a DragFloat with some custom internal data can be as simple as ``` const AppGetAdjustableFloat = struct { app: *App, idx: usize, fn getVal(self: AppGetAdjustableFloat) f32 { return self.app.adjustable_float[self.idx]; } }; ``` Then our DragFloat just has a signiture DragFloat(comptime ActionType: type, comptime ValRetriever: type)
@mcmaddie
@mcmaddie Ай бұрын
Never written a line of Zig and know it only by name and yet here I am coming back to these streams. I'm long time C/C++ coder myself. Maybe I'll learn something here. :)
@AlexMG54
@AlexMG54 Ай бұрын
Nice, I've been working on a retained-mode UI library of my own in C and OpenGL. The most time consuming widget has been the Edit Text field (which still has a lot of work to do but I'm actually not really using it at the moment so bleh lol). Just wrapped up a scroll view that supports keyboard navigation. I probably will need to make a draggable float field as well. Thanks for the stream, it's interesting seeing how you approach it!
@11WicToR11
@11WicToR11 Ай бұрын
dont you think you should break that file into more files? i mean navigation in vim across buffers is so much better than in a single one imho
@PopescuAlexandruCristian
@PopescuAlexandruCristian Ай бұрын
Dear IMGUI cheats for all this cases by having a ton of global data that it resets in different events based on what you interact with. A context that you pass around is seiner in my perspective.
@CrashLaker
@CrashLaker Ай бұрын
awesome! mouseDownInBoxAndMouseStillInBox awesome too! :D
@sphaerophoria
@sphaerophoria Ай бұрын
You gotta check if the mouse is down in the box and the mouse is still in the box
Adding a scrollbar to my GUI framework
2:41:31
sphaerophoria
Рет қаралды 2 М.
Fixing the horribly broken image selection in my image editor
1:36:06
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
The BEST Backend Language for You | Prime Reacts
32:57
ThePrimeTime
Рет қаралды 380 М.
The Genius Way Computers Multiply Big Numbers
22:04
PurpleMind
Рет қаралды 229 М.
The fastest CPU in the world
25:53
Linus Tech Tips
Рет қаралды 2,2 МЛН
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
How to Avoid Refactoring Legacy Code HELL
35:57
ArjanCodes
Рет қаралды 38 М.
Python laid waste to my C++!
17:18
Sheafification of G
Рет қаралды 184 М.
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.