dchip-8/src/dchip8_platform.h

57 lines
727 B
C
Raw Normal View History

2017-04-04 06:27:49 +00:00
#ifndef DCHIP_8_PLATFORM
#define DCHIP_8_PLATFORM
2017-04-04 14:10:13 +00:00
#include "dqnt.h"
2017-04-04 06:27:49 +00:00
typedef struct PlatformRenderBuffer
{
i32 width;
i32 height;
i32 bytesPerPixel;
void *memory;
} PlatformRenderBuffer;
2017-04-04 08:15:21 +00:00
enum Key
{
key_up,
key_down,
key_left,
key_right,
key_escape,
key_count,
};
typedef struct KeyState
{
bool isDown;
u32 transitionCount;
} KeyState;
typedef struct PlatformInput
{
2017-04-04 12:32:48 +00:00
f32 deltaForFrame;
2017-04-04 08:15:21 +00:00
union {
KeyState key[key_count];
struct
{
KeyState up;
KeyState down;
KeyState left;
KeyState right;
KeyState escape;
};
};
} PlatformInput;
2017-04-04 12:32:48 +00:00
typedef struct PlatformMemory
{
void *permanentMem;
u32 permanentMemSize;
void *transientMem;
u32 transientMemSize;
} PlatformMemory;
2017-04-04 06:27:49 +00:00
#endif