Writing a game engine in pure C: The Graphic Initialization

Writing a game engine in pure C: The Graphic Initialization

As you can tell, the init function is creating the SDL window, also assigns its pointer to the window variable in the given Graphics structure. This code initializes the SDL engine with it’s video stuff (that’s what SDL_INIT_VIDEO means) and assures that it ran properly, breaking the execution if it didn’t and freeing the state manager before exiting the program. After the SDL init, the graphics are initialized, it follows the same logic than the state manager we wrote.

Source: prdeving.wordpress.com