Hey everyone, another beginner looking for advices :p! This time about keyboard input for games using SDL. Context: wrinting a (very simple) game in C. Yes, I know, C.
I want to use a simple and to-the-point style, and basically use and refer to SDL only in my main.c file, similar to writing a simple Win32 platform layer. In this main.c should be all platform specific code, that is : creation of window, call to an game_init function, an outer main loop that keeps track of time using SDL_GetTicks() and calls game_update function at regular time intervals using SDL_Delay(FIXED_DT- elasped_time) style, and a call to a game_cleanup function before returning to OS.
Basically, all game related stuff would be in other C modules (game.h + game.c, keyboard.c + keyboard.h…) and I’d like to have little to no references to SDL structs or functions outside of main.c.
How do you guys feel about this approach ? Does it even makes sense ? Is it stupid ? What are the things that come to your mind when reading this ? I’ve started doing this and experienced both questions/difficulties but I’d like to first hear all you have to say without being influenced by my noobish way of seeing/doing stuff first.
If i’m just being too plain stupid/intolerably noob for you to make sense, please just ignore my post. In any case, thank you for taking the time for reading this!