
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | win32_record_time_stamp(&frame_end_info, "Framerate Wait Completed", win32_get_seconds_elapse(last_counter, win32_get_wall_clock()));
{
auto device_context = GetDC(window);
win32_draw_buffer_to_window(&win32_backbuffer, device_context, win32_get_window_dimention(window));
ReleaseDC(window, device_context);
}
flip_wall_clock = win32_get_wall_clock();
auto temp = old_game_input;
old_game_input = game_input;
game_input = temp;
end_counter = win32_get_wall_clock();
win32_record_time_stamp(&frame_end_info, "End Of Frame", win32_get_seconds_elapse(last_counter, win32_get_wall_clock()));
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | internal void
win32_draw_buffer_to_window(Win32_Offscreen_Buffer *buffer, HDC device_context, Win32_Window_Dimention window_dimention) {
if (window_dimention.width >= buffer->width*2 &&
window_dimention.height >= buffer->height*2) {
StretchDIBits(device_context,
0, 0, 2*buffer->width, 2*buffer->height,
0, 0, buffer->width, buffer->height,
buffer->memory, &buffer->info, DIB_RGB_COLORS, SRCCOPY);
} else {
#if 0
int offset_x = 10;
int offset_y = 10;
PatBlt(device_context, 0, 0, window_dimention.width, offset_y, BLACKNESS);
PatBlt(device_context, 0, 0, offset_x, window_dimention.height, BLACKNESS);
PatBlt(device_context, offset_x + buffer->width, 0, window_dimention.width, window_dimention.height, BLACKNESS);
PatBlt(device_context, 0, offset_y + buffer->height, window_dimention.width, window_dimention.height, BLACKNESS);
#else
int offset_x = 0;
int offset_y = 0;
#endif
StretchDIBits(device_context,
offset_x, offset_y, buffer->width, buffer->height,
0, 0, buffer->width, buffer->height,
buffer->memory, &buffer->info, DIB_RGB_COLORS, SRCCOPY);
}
}
|
1 2 3 4 5 6 7 8 9 10 | --- frame boundary - flip frame n-1 - gather input - game code - rendering - wait to hit 33ms. --- frame boundary - flip frame n ... |

