Files
handmadehero/sdl_handmade.h
T

56 lines
1.1 KiB
C

#ifndef SDL_HANDMADE_H
#define SDL_HANDMADE_H
#include <SDL.h>
#include "core.h"
#include "handmade.h"
typedef struct sdl_border_size {
S32 Top;
S32 Bottom;
S32 Left;
S32 Right;
} sdl_border_size;
typedef struct sdl_window_size {
S32 Width;
S32 Height;
} sdl_window_size;
typedef struct sdl_window_position {
S32 X;
S32 Y;
} sdl_window_position;
typedef struct offscreen_buffer {
/* Pixels are always 32-bit and have the bytes in BGRX (little-endian). */
SDL_Texture *Texture;
void *Memory;
S32 Width;
S32 Height;
S32 Pitch;
} offscreen_buffer;
typedef struct sdl_sound_output {
S32 SamplesPerSecond;
S32 BytesPerSample;
S32 SecondaryBufferSize;
S32 LatencySampleCount;
void *Samples;
} sdl_sound_output;
/* TODO: We choose 1024 only because MacOS's MAXPATHLEN says such a value.
* For example, linux/limits.h PATH_MAX says 4096. Windows has MAX_PATH. */
#define SDL_STATE_PATH_SIZE 1024
typedef struct sdl_state {
U64 TotalSize;
void *GameMmemoryBlock;
char EXEDirPath[SDL_STATE_PATH_SIZE];
char DLLPath[SDL_STATE_PATH_SIZE];
} sdl_state;
#endif