- Initialize the backbuffer - Info = structure about Bitmap properties - Memory = will hold the virtual memory allocated - Width/Height is size of Bitmap/Buffer - Pitch = Stride of Bitmap/Buffer - BytesPerPixel = 8 bits for each color in RGB + 8 Bits for padding = 32 bits = 4 - Register the WNDCLASS created and store the HWND(handle) returned. - Get the HDC(device context) from the returned HWND(handle). - While GlobalRunning is true run the loop - Store the MSG captured by PeekMessage() and process it in Win32MainCallbac k - RenderWeirdGradient plays with the Backbuffer a bit. - Win32DisplayBufferInWindow Displays the buffer on screen by copying it. Chandler Carruth Stubbing #define FUNCTION(name) type name(params...) typedef FUNCTION(function_to_hold_stub_function) FUNCTION(stub_function) { // definition of the stub function return (0); } global_variable function_to_hold_stub_function *InterfaceFunction_ = stub_functi on; #define InterfaceFunction InterFaceFunction_ Loading XInputFunctions -Before Loading *XInputGetState_ = XInputGetStateStub -> just pointing to stub #define XInputGetState XInputGetState_ -> macro indirection -Loading if LoadLibrary successfuly loaded xinput dll GetProcAddress will get the address of specified functio name and then cast it to (x_input_get_state*) because it will just return void* and since we know the functions signature. store the pointer to XInputGetState which is just a macro for XInputGetState_ this will override the Stub. When no library is loaded the stub will remain. Loading Direct Sound DirectSoundCreate definition is being defined in DIRECT_SOUND_CREATE macro typedef DIRECT_SOUND_CREATE(direct_sound_create); will create a "HRESULT WINAPI direct_sound_create (LPCGUID, LPDIRECTSOUND, LPUNKNOWN);" Win32InitDSound(HWND Window, int32 SamplesPerSecond, int32 BufferSize) - Load the library "dsound.dll" and store it in HMODULE DsoundLibrary
- if the dll is successfuly loaded
Get the address of function "DirectSoundCreate" and store it in typedefed direct_sound_create. - Create a pointer to the DirectSound "LPDIRECTSOUND"