SDL Maze!

I wrote some more maze code. This time in C++ using SDL for rendering. To be honest, I started this out by writing an extension for SDL in PHP. I may still finish that and write a blog about it. It was fun but the performance was reaaaally bad so I need to do some work on making it more high level. I was just doing a one to one for the SDL API (except in classes) and then writing the PHP code for DFS and rendering. So yea, as you can imagine, it was slow. Here’s a gist of what it was looking like.

Anyway, I was thinking of using emscripten on the SDL stuff I wrote so I could post a working version here. You’ll have to be satisfied with a short video and link to the code.

My favorite part of writing this in C++ was the part I did in C. I wrote a tweet about it. I really did spend time figuring out a circle fill algorithm instead of just drawing a circle in a paint application. It was more fun. You can see the simple (and poorly commented) code here.

The full code is available: github. There is some refactoring I had considered doing before posting but since it’s been a week and I haven’t touched it, it’s unlikely I will.

Unlike the other versions, I don’t render the path finding efforts in this version. Just the results. I also added the ability to simply move the little dot around using the arrow keys. Just playing around. Have a look.