4 ms·
To a GUI outsider, this blog post is confusing because it is missing necessary introductory information at the beginning and also contradicting itself. If I pu
by PennRobotics 5y ago
To a GUI outsider, this blog post is confusing because it is missing necessary introductory information at the beginning and also contradicting itself.
If I put any of the example code into a file and run g++ test.cpp -o test -std=c++2a, I get the very expected error, undefined reference to 'main'. Adding main isn't going to magically make a struct turn into a UI. There are no #include statements. It's clear a library is needed as well as some familiarization.
Midway through, a link to Nuklear is provided. At the very bottom, the reader learns this can be tested with the avendish library... a bit after the sentence stating, "Glory to the post-library era."
I still don't know whether the code uses Nuklear or avendish or both, and because there will be more than a few steps to install and this solves a problem I don't have, I lost interest in the examples and will continue to ncurses my way through GUI MVPs.
- jcelerier 5y agohmm, I thought that my sentence in the introduction would have made the expectations as clear as possible, how would you improve it ? > By user code, I mean that all the “nice” UI work can be done in, say, foo.hpp: <...> without requiring any custom header. Some yet-unknown .cpp file will include foo.hpp, and, no matter what the content of my_ui is, will execute a nice user interface from it. Anyone will be able to create independent libraries which will render UIs according to whatever platform-specific intricacies there are, but the actual UI code will be entirely independent from anything: peak separation of concerns is achieved. Regarding: > the reader learns this can be tested with the avendish library... a bit after the sentence stating, "Glory to the post-library era." I say that because the UI code itself does not depend on any library: any organization can fairly easily make their own library which will parse these classes however they want. For instance, the code that wraps some of these things to python is in itself ~130 lines: https://github.com/celtera/avendish/blob/main/include/avnd/binding/python/processor.hpp https://github.com/celtera/avendish/blob/main/include/avnd/b... + helpers types for introspection ; the day C++ finally gets reflection most of these helper types can disappear and your actual business code won't have to change at all, unlike if you had written it against $TODAY's gui toolkit and wanted to make it work in $TOMORROW's
- xupybd 5y agoSo you're building an interface that libraries can be written to?
- jcelerier 5y agoNot really an interface in the OOP term, just trying to define the concepts, which are much more open-ended.
- UncleEntity 5y agoSo you have to write a library that can parse struct definitions? Like a DSL but without the “domain specific” part? I mean, umm… dunno?
- krapp 5y agoStep two: code the rest of the fucking owl.
- jcelerier 5y agoyou don't have to: the code compiles and is valid C++ as-is without issues, unlike when you are using a normal library, say Qt, JUCE or similar. Each user can then choose what they want to do with it. For instance, the same code can be put on some embedded chip without any UI processing and will be able to be plugged to hardware pretty easily by writing a few lines of simple glue code.
- UncleEntity 5y agoAh, I think I understand now — basically what you’re describing is a schema for defining UI code as a tree of c++ structs. …which, honestly, horrifies me. I remember for a time I was adding drag and drop to various parts of blender (Ton went on his yearly vacation and this is what he brought back) and every little change required a rebuild to test which wasn’t the quickest on my little netbook. Mind you there was zero documentation and I was pretty deep in the innerds so there was a lot of trial and error involved. I literally spent most of the time waiting on the compiler because, well, I’m not the best coder out there. Working on the UI code was a dream in comparison — edit code, reload python module, see changes, rinse and repeat.