Files
handmadehero/sdl_handmade.h
T
2026-03-25 14:33:23 -07:00

59 lines
1.3 KiB
C

#ifndef SDL_HANDMADE_H
#define SDL_HANDMADE_H
#include <SDL.h>
#include "core.h"
#include "handmade.h"
typedef struct sdl_window_dimension {
S32 Width;
S32 Height;
} sdl_window_dimension;
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;
F32 tSine;
S32 LatencySampleCount;
void *Samples;
} sdl_sound_output;
/* NOTE: We choose 1024 only because MacOS's MAXPATHLEN says such a value.
* For example, linux/limits.h PATH_MAX says 4096. */
#define SDL_STATE_PATH_SIZE 1024
typedef struct sdl_replay_buffer {
char ReplayFilename[SDL_STATE_PATH_SIZE];
void *MemoryBlock;
} sdl_replay_buffer;
typedef struct sdl_state {
U64 TotalSize;
void *GameMmemoryBlock;
sdl_replay_buffer ReplayBuffers[4];
S32 RecordingHandle;
S32 InputRecordingIndex;
/* NOTE: These functions might be NULL. Check before calling them! */
S32 PlaybackHandle;
S32 InputPlayingIndex;
char EXEDirPath[SDL_STATE_PATH_SIZE];
char DLLPath[SDL_STATE_PATH_SIZE];
} sdl_state;
#endif