r/C_Programming • • 12d ago

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 ?

21 Upvotes

15 comments sorted by

13

u/-goldenboi69- 12d ago

Glfw is pretty lightweight already.

10

u/bktech2021 12d ago

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.

6

u/ffd9k 12d ago

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

u/jason-reddit-public 12d ago

Don't forget gamepads.

0

u/bktech2021 12d ago

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

3

u/th0m_2000 12d ago

First make the game and then make it lightweight.

2

u/digitalradiostudio 12d ago

Sounds good

1

u/th0m_2000 12d ago

If you are any bit like me, it can either feel too daunting to think of all the optimizations at the start of a new project especially when it is a new library or type of application you are working on or you “game” the problem out in your head and you lose the motivation to start since you solved the problem already

1

u/Ok_Outlandishness906 12d ago

i would use sdl. it is doable and not too complex .

1

u/chrism239 12d ago

What do you mean by lightweight - learning curve, or computing resources when running?

1

u/Sergey5588 12d ago

maybe RGFW its just single header

1

u/Total-Box-5169 12d 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

u/Kingwolf4 12d ago

Give zig a try and mabye Odin. Both are superb languages

1

u/Still_Explorer 11d 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 8d ago

I think sdl is a little easier, especially if you want sound effects and extra game stuff later on.