devDiary 0.2: Tools of the Trade
24 June 2025 at 01:30:07 pm NZSTTo get started with raycasting, I need a few things. I’ll be doing everything from ‘scratch’, but I’m not insane. Really all I need is some way to draw individual pixels on the screen. For this I’ll be using SDL3.0.
Per their website, SDL3.0 is “a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware”. Perfect. In the spirit of doing it myself, I’ll be writing in C.
SDL3.0
Since my last foray into SDL, there has been a new release, 3.0. The new update introduces a new paradigm for projects.
Instead of a main()
function as your entry point, you can use main callbacks instead. You can read more about this here. I’ll be trying this out; because why not?
There’s some boilerplate code to copy, thankfully there are some example programs.
The points program shows how to draw individual pixels to the screen; here’s what I’m aiming for:

The render loop is located within the SDL_AppIterate()
function. Each iteration I’ll clear the screen by setting my draw colour to black, calling the clear function, changing to the colour I want to draw, drawing my points, and finally calling the SDL_RenderPresent()
function to push to the screen!
Here’s what it looks like to draw a single white pixel at (x=50, y=50):
SDL_AppResult SDL_AppIterate(void *appState) {
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE);
SDL_RenderPoint(renderer, 50, 50);
SDL_RenderPresent(renderer);
return SDL_APP_CONTINUE;
}
Next up I’ll get into outlining the renderer and laying down some of the foundational functions.