Re:Writing a game engine in pure C: The Graphic Initialization
by briansteffens on Wednesday June 05, 2019 @03:24PM
(#20108181)
Speaking from my own very limited experience, I think C++ can be pretty nice if you basically write straight C but borrow from the C++ STL. Smart pointers (std::unique_ptr, std::shared_ptr, etc), collections (std::vector, std::unordered_map, std::set, std::stack, std::priority_queue), and stuff like std::tuple and std::optional really make C feel less clunky without getting too gross.
Re:Writing a game engine in pure C: The Graphic Initialization
by borgel on Wednesday June 05, 2019 @11:45PM
(#20111392)
Ha, I was just thinking about where to find some STL-style collections earlier today and was lamenting not knowing having a great lib in mind.
Thanks for the suggestion! Seems like a good place to start.
Re:Writing a game engine in pure C: The Graphic Initialization
by flukus on Thursday June 06, 2019 @12:48AM
(#20111666)
Glib (https://developer.gnome.org/glib/2.60/glib-Miscellaneous-Mac...) is a great STL like library for C. It's got the basic data structures, a good API and plenty of utilities. My favorite is g_autoptr (https://developer.gnome.org/glib/stable/glib-Miscellaneous-M...) for deterministic cleanup. There's enough to make C a reasonably pleasant scripting language.
Re:Writing a game engine in pure C: The Graphic Initialization
by nroah on Wednesday June 05, 2019 @03:18PM
(#20108128)
If you want to know what a reasonable subset of C++ looks like don't hesitate to check out the source code for Doom 3.
Re:Writing a game engine in pure C: The Graphic Initialization
by galangalalgol on Wednesday June 05, 2019 @08:17PM
(#20110374)
Which contains:
#define private public
#define protected public
Can you point to any resources I can use to learn?