C language > Graphics programming
Nuklear immediate mode GUI - C and small
Scripter:
--- Quote from: frankie on July 30, 2016, 07:27:15 PM ---Said that, the code is clearly wrote using C++ habits in many other aspects.
--- End quote ---
Translated from C++, I'm guessing.
frankie:
Maybe, but some comments make me think that is not a translation, but just a trial to write Ansi-C from a C++ background...
See the following piece of code:
--- Code: ---struct nk_context
{
/* public: can be accessed freely */
struct nk_input input;
struct nk_style style;
struct nk_buffer memory;
struct nk_clipboard clip;
nk_flags last_widget_state;
enum nk_button_behavior button_behavior;
float delta_time_seconds;
/* private:
should only be accessed if you
know what you are doing */
#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT
struct nk_draw_list draw_list;
#endif
#ifdef NK_INCLUDE_COMMAND_USERDATA
nk_handle userdata;
#endif
/* text editor objects are quite big because of an internal
* undo/redo stack. Therefore does not make sense to have one for
* each window for temporary use cases, so I only provide *one* instance
* for all windows. This works because the content is cleared anyway */
struct nk_text_edit text_edit;
/* draw buffer used for overlay drawing operation like cursor */
struct nk_command_buffer overlay;
/* windows */
int build;
int use_pool;
struct nk_pool pool;
struct nk_window *begin;
struct nk_window *end;
struct nk_window *active;
struct nk_window *current;
struct nk_page_element *freelist;
unsigned int count;
unsigned int seq;
};
--- End code ---
Eggy:
Scripter, frankie,
Thanks so much.
Scripter: I agree with you on the 'quick and dirty' and 'high-level' remarks. It is one of the reasons I was so happy to find Pelles. I deinstalled MSVS 2015 out of frustration with all of the tools and interfaces it provides. I come from learning programming in 1978 on a Commodore PET computer with a tape cassette drive and small monitor all-in-one unit.
I did Windows programming years ago, and then left to do mainly linux dev. The alternatives to Win 32 are not that good, but I want to continue to develop my crappy, but fun, cross-platform games, and Win 32 works on Windows only.
I am hoping to use something other than FLTK, or a pure OpenGL solution, but for immediate-mode GUIs I have only found imGui (formerly Dear imGui) and Nuklear.
frankie: Thank you so much for taking the time to work up a sample. It will help me to evaluate it, and to take in your criticisms of it.
I'll let you know where I get with this. I'm in East Java, Indonesia this year, so at +7 GMT, it's time to go to bed! Thanks again!
Rob
Scripter:
--- Quote from: Eggy on July 30, 2016, 09:51:05 PM ---Scripter: I agree with you on the 'quick and dirty' and 'high-level' remarks. It is one of the reasons I was so happy to find Pelles. I deinstalled MSVS 2015 out of frustration with all of the tools and interfaces it provides. I come from learning programming in 1978 on a Commodore PET computer with a tape cassette drive and small monitor all-in-one unit.
--- End quote ---
Me too ... wrote my first program on an old pdp11 using a ksr33 and punch tape. Got away from it for a while, rejoined the game just when the 8088 machines were coming out, been working in either Pascal or C ever since.
--- Quote ---I did Windows programming years ago, and then left to do mainly linux dev. The alternatives to Win 32 are not that good, but I want to continue to develop my crappy, but fun, cross-platform games, and Win 32 works on Windows only.
I am hoping to use something other than FLTK, or a pure OpenGL solution, but for immediate-mode GUIs I have only found imGui (formerly Dear imGui) and Nuklear.
--- End quote ---
If you are doing cross-platform stuff:
1) My condolences ;)
2) You can safely ignore my comments. I've always been a "down to the gold" type who likes to talk intimately with my machines. Of course that's not going to work with cross-platform code...
Good luck on your endevours.
Eggy:
Scripter,
Good to hear we come from the same dynasty!
Your comments and opinions are valued to me, since I am operating in a vacuum here right now. I too would stay with just one platform or the other, but I run Linux and Windows for work and pleasure, so I am in that world ;)
Also, for game jams, you up your exposure by providing it on many platforms, which is why HTML5 games are so popular there, and Love2D, a Lua-based game framework that runs on everything. There are 3D engines like Godot too, but like you, I want to program close to the machine with the caveat of using a GUI library, since there is no penalty in rendering. I do think the higher-level libs are too much abstraction, and I agree they make it harder than just dropping down and coding it natively. But for sound, graphics, i/o, it is hard to beat SDL2. It is not too far from the ground or gold as you say.
You have inspired me to do a little test. I will create a minimal game with a window, sound and logic:
1. Windows target w/ Pelles C, and the Win32 API for GUI (Wn32 native sound API?? for game dev? Or, do I need something like S?)
2. Linux target w/ GCC, and I should try to use X11 to make it a fair comparison, although I may use Gnome.
If I still have questions and time, I will try and do the same tests above using SDL2 or CSFML for both tests and compare again.
Thanks!
Rob
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version