Input Cleanup and Fixes
This episode starts with some cleanup and fixes to the input handling code from yesterday.
- Windows API often uses a
0return value to indicate success. Our stubs probably shouldn't return
- Windows 8 ships with
xinput1_4.dllonly. So we need to try each version in turn
- When you handle WM_SYSKEY* messages, you lose built in Alt-F4 functionality, and have to reimplement it.
Sound Programming for Games
Casey starts with a high level overview of sound programing for games. The key ideas here are that we are allocating a circular buffer for sound, and the system will play it continually on a loop. If you haven't worked with circular buffers (or ring buffers) before, much of this code will be confusing. It's worth taking some time to familiarize yourself with them.
- Ring Buffers on "Learn C The Hard Way"
Working with DirectSound
The basic process for initializing DirectSound is as follows:
- Load the Library -
- Create a DirectSound object -
- Set the Cooperative Level -
- "Create" a primary buffer -
- Create a secondary buffer
- Tell DirectSound to start playing the secondary buffer -
In the next episode we will look closely at how to fill this buffer and implement it in the game loop.