blob: ba39332ad73f153f160ff22d157871da17f04821 (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
|