diff options
Diffstat (limited to 'code/win32_handmade.h')
-rwxr-xr-x | code/win32_handmade.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/code/win32_handmade.h b/code/win32_handmade.h new file mode 100755 index 0000000..ba39332 --- /dev/null +++ b/code/win32_handmade.h @@ -0,0 +1,89 @@ +#if !defined(WIN32_HANDMADE_H) +/* ======================================================================== + $File: $ + $Date: $ + $Revision: $ + $Creator: Casey Muratori $ + $Notice: (C) Copyright 2014 by Molly Rocket, Inc. All Rights Reserved. $ + ======================================================================== */ + +struct win32_offscreen_buffer +{ + // NOTE(casey): Pixels are alwasy 32-bits wide, Memory Order BB GG RR XX + BITMAPINFO Info; + void *Memory; + int Width; + int Height; + int Pitch; + int BytesPerPixel; +}; + +struct win32_window_dimension +{ + int Width; + int Height; +}; + +struct win32_sound_output +{ + int SamplesPerSecond; + u32 RunningSampleIndex; + int BytesPerSample; + DWORD SecondaryBufferSize; + DWORD SafetyBytes; + r32 tSine; + // TODO(casey): Should running sample index be in bytes as well + // TODO(casey): Math gets simpler if we add a "bytes per second" field? +}; + +struct win32_debug_time_marker +{ + DWORD OutputPlayCursor; + DWORD OutputWriteCursor; + DWORD OutputLocation; + DWORD OutputByteCount; + DWORD ExpectedFlipPlayCursor; + + DWORD FlipPlayCursor; + DWORD FlipWriteCursor; +}; + +struct win32_game_code +{ + HMODULE GameCodeDLL; + FILETIME DLLLastWriteTime; + + // IMPORTANT(casey): Either of the callbacks can be 0! You must + // check before calling. + game_update_and_render *UpdateAndRender; + game_get_sound_samples *GetSoundSamples; + + b32 IsValid; +}; + +#define WIN32_STATE_FILE_NAME_COUNT MAX_PATH +struct win32_replay_buffer +{ + HANDLE FileHandle; + HANDLE MemoryMap; + char FileName[WIN32_STATE_FILE_NAME_COUNT]; + void *MemoryBlock; +}; +struct win32_state +{ + u64 TotalSize; + void *GameMemoryBlock; + win32_replay_buffer ReplayBuffers[4]; + + HANDLE RecordingHandle; + int InputRecordingIndex; + + HANDLE PlaybackHandle; + int InputPlayingIndex; + + char EXEFileName[WIN32_STATE_FILE_NAME_COUNT]; + char *OnePastLastEXEFileNameSlash; +}; + +#define WIN32_HANDMADE_H +#endif |