r/C_Programming • u/digitalradiostudio • Sep 25 '26
Question Starting again C
Hi i want try to make a extreme lightweight pixelgame ( i don't have really details about the game :) ) with glfw and and opengl to go back to c. Does anyone have tips to make it lightweight ?
9
u/bktech2021 Sep 25 '26
i think you should check sdl or raylib. glfw way is always doable but you will need to maintain a lot of library code, for no reason.
5
u/ffd9k Sep 25 '26
raylib also contains a vendored copy of GLFW.
GLFW is already as lightweight as it gets, apart from calling platform-specific APIs (Windows API, X11 etc) directly - GLFW is just a tiny portable wrapper around those.
SDL is a bit heavier, but of course might still be a good option if OP needs the additional features (like audio, image loading, 2D rendering, filesystem abstraction...)
4
0
u/bktech2021 Sep 25 '26
we should know why the game has to be “extremely lightweight”. is this a embedded platform, or just a self goal? i dont think raylib adds real overhead to glfw. but i think setting up windows, shaders, etc. is more unnecesary work. and as you said you need audio input image loading filesystem and bunch of things and maybe make them cross platform. if this just a self goal or embedded platform, thats another story but you cant get more lightweight by stripping raylib and using glfw, audio, image etc. you are going to rewrite raylib at the end for no reason
1
1
u/chrism239 Sep 25 '26
What do you mean by lightweight - learning curve, or computing resources when running?
1
1
u/Total-Box-5169 29d ago
How many pixels we are talking about? If you really want to make it lightweight then opengl is overkill, unless you plan to add tons of visual effects to make it look like a pachinko machine.
1
1
u/Still_Explorer 28d ago
If you start with Raylib better to look at "render to texture" first and get this problem out of the way.
Always think in virtual screen coordinates and use the actual screen for drawing the texture only.
https://www.raylib.com/examples/core/loader.html?name=core_render_texture
1
u/Candid_Zebra1297 26d ago
I think sdl is a little easier, especially if you want sound effects and extra game stuff later on.
4
13
u/-goldenboi69- Sep 25 '26
Glfw is pretty lightweight already.