These two weeks have been quite rough, which is why I didn’t write a full weekly recap last week. Nonetheless, there was some progress!
SUGAR has sound! And it also got a lot of tiny changes, adding small features and making what’s already there a little better!
In the end I went with SDL_Mixer for the sound. SDL_Mixer is a library that completes SDL’s very raw audio API. I hoped I would be able to use the SDL audio API directly, but it would be too much trouble for little reason. SDL_Mixer does its job quite well and feels coherent with SDL’s API syntax/flow, so building SUGAR’s audio system went with only very few difficulties.
The way to use the SUGAR audio system is as follow:
- Init the audio system (or call the function that inits all the SUGAR sub-systems)
- You load a WAV file as a sound effect with a number as identifier and a volume mofifier. (defaults to full volume)
- Call the sfx(int id) function to trigger the sound…
- Or call the sfx(int id, float distance, float stereo_angle) overload to have it use stereo!
- Unload the sound effect, or shutdown the audio system, which will do it on its own!
You can also load musics and play them, but only one at a time. And of course you can change the volume of the sound effects and/or the volume of the music at any time!
Same as for the rest of the framework, I kept it sparse and functional!
Aside from implementing the audio system, I also implemented a bunch of smaller features that were stacking up on the to-do list! Most of them were things I thought of while working on Melee. They are not essential but they will be useful.
Most notably, created surfaces (to use as spritesheet or map, or whatever else you want) are registered, and any that hasn’t been deleted will automatically be deleted on shutdown with a warning in the log.
The same goes for custom fonts, which, also, I fixed. (they have been broken ever since I implemented them but I did not have the courage to go back into it)
And you can now get the current fps, as well as the smoothed fps (average of several frames) and the actual frame time aside from the frame limitation you might have set. (you can choose to limit your creation to 60fps, or 30fps, or even 5fps, or not at all)
The math API now has some templated functions. (let’s you use those functions with any type of parameters) At first I didn’t really want to use any C++ templates because I think they can make things pretty messy and confusing, but on the other hand they can be super useful. So I decided to just use them very sparingly.
And finally I added some functions to manipulate pixel buffers! There’s memset, memcpy, peek and poke!
Those are the main changes! Individually, they’re small, but I think they’ll make a considerable change in how comfortable it is to use the framework.
And now it’s time to put everything to the test! I’m setting Melee aside for a very short time to jam out a very simple game! That’s what you’re seeing in the gif above!
It’s a very simple game idea and my plan is to make it particularly flashy and satisfying. If everything goes well, it’ll be out by the end of this week!
And that’s it for these two weeks! I was feeling particularly exhausted and I had to take it slow, but still, progress was made!
I want to thank my super kind Patreon supporters! I’ll never say it enough but pretty much everything I’m doing would not be happening without them! Here are the names of all the 3$+ supporters!
Ryan Malm, Joseph White, Austin East, Marcin Majewski, Zachary Cook, Jefff, Meru, HERVAN, Andreas Bretteville, Bitzawolf, Alan Oliver, Paul Nguyen, Dan Lewis, Christian Östman, Dan Rees-Jones, Reza Esmaili, Thomas Wright, Chris McCluskey, Joel Jorgensen, Marty Kovach, Cole Smith, Giles Graham, Tim and Alexandra Swast, Sasha Bilton, berkfrei, Jearl, Dave Hoffman, Collin Caldwell, Andrew Reitano, Qristy Overton, rotatetranslate, Finn Ellis, Jakub Wasilewski, amy, Brent Werness, Anne Le Clech, Max Cahill, hushcoil, Jeremy Bouin, Jesse Bergerstock, Jacel the Thing, Pierre B., Sean S. LeBlanc, Andrew Reist, vaporstack
This new week, I’m working on this little jam game! I’m hoping to finish and release it before the week is out, so look out for it!
Have a great week!
Leave a Reply