69 lines
3.3 KiB
C
69 lines
3.3 KiB
C
#define PLATFORM_RESERVE(name) void * name(u64 Size)
|
|
#define PLATFORM_RELEASE(name) void name(void *Pointer)
|
|
#define PLATFORM_COMMIT(name) void name(void *Pointer, u64 Size)
|
|
#define PLATFORM_DECOMMIT(name) void name(void *Pointer, u64 Size)
|
|
#define PLATFORM_OPEN_FILE(name) platform_file_handle name(string Path, platform_access_flags FileAccess)
|
|
#define PLATFORM_CLOSE_FILE(name) void name(platform_file_handle Handle)
|
|
#define PLATFORM_READ_FILE(name) void name(platform_file_handle Handle, void *Dest, u64 Offset, u64 Size)
|
|
#define PLATFORM_WRITE_FILE(name) void name(platform_file_handle Handle, void *Source, u64 Offset, u64 Size)
|
|
#define PLATFORM_GET_FILE_SIZE(name) u64 name(platform_file_handle Handle)
|
|
#define PLATFORM_SET_CURSOR(name) void name(platform_cursor Cursor)
|
|
#define PLATFORM_TOGGLE_FULLSCREEN(name) void name(void)
|
|
#define PLATFORM_SHOW_MESSAGE(name) void name(string Message, platform_message_type Type)
|
|
#define PLATFORM_BEGIN_FILE_ITER(name) platform_file_iter * name(memory_arena *Arena, string Path)
|
|
#define PLATFORM_ADVANCE_FILE_ITER(name) b32 name(memory_arena *Arena, platform_file_iter *Iter, platform_file_info *OutInfo)
|
|
#define PLATFORM_END_FILE_ITER(name) void name(platform_file_iter *Iter)
|
|
|
|
typedef PLATFORM_RESERVE(platform_reserve);
|
|
typedef PLATFORM_RELEASE(platform_release);
|
|
typedef PLATFORM_COMMIT(platform_commit);
|
|
typedef PLATFORM_DECOMMIT(platform_decommit);
|
|
typedef PLATFORM_OPEN_FILE(platform_open_file);
|
|
typedef PLATFORM_CLOSE_FILE(platform_close_file);
|
|
typedef PLATFORM_READ_FILE(platform_read_file);
|
|
typedef PLATFORM_WRITE_FILE(platform_write_file);
|
|
typedef PLATFORM_GET_FILE_SIZE(platform_get_file_size);
|
|
typedef PLATFORM_SET_CURSOR(platform_set_cursor);
|
|
typedef PLATFORM_TOGGLE_FULLSCREEN(platform_toggle_fullscreen);
|
|
typedef PLATFORM_SHOW_MESSAGE(platform_show_message);
|
|
typedef PLATFORM_BEGIN_FILE_ITER(platform_begin_file_iter);
|
|
typedef PLATFORM_ADVANCE_FILE_ITER(platform_advance_file_iter);
|
|
typedef PLATFORM_END_FILE_ITER(platform_end_file_iter);
|
|
|
|
struct platform_api
|
|
{
|
|
platform_reserve *Reserve;
|
|
platform_release *Release;
|
|
platform_commit *Commit;
|
|
platform_decommit *Decommit;
|
|
platform_open_file *OpenFile;
|
|
platform_close_file *CloseFile;
|
|
platform_read_file *ReadFile;
|
|
platform_write_file *WriteFile;
|
|
platform_get_file_size *GetFileSize;
|
|
platform_set_cursor *SetCursor;
|
|
platform_toggle_fullscreen *ToggleFullscreen;
|
|
platform_show_message *ShowMessage;
|
|
platform_begin_file_iter *BeginFileIter;
|
|
platform_advance_file_iter *AdvanceFileIter;
|
|
platform_end_file_iter *EndFileIter;
|
|
};
|
|
|
|
#define RegisterPlatformFunctions(PlatformName)\
|
|
Platform.Reserve = PlatformName##_Reserve;\
|
|
Platform.Release = PlatformName##_Release;\
|
|
Platform.Commit = PlatformName##_Commit;\
|
|
Platform.Decommit = PlatformName##_Decommit;\
|
|
Platform.OpenFile = PlatformName##_OpenFile;\
|
|
Platform.CloseFile = PlatformName##_CloseFile;\
|
|
Platform.ReadFile = PlatformName##_ReadFile;\
|
|
Platform.WriteFile = PlatformName##_WriteFile;\
|
|
Platform.GetFileSize = PlatformName##_GetFileSize;\
|
|
Platform.SetCursor = PlatformName##_SetCursor;\
|
|
Platform.ToggleFullscreen = PlatformName##_ToggleFullscreen;\
|
|
Platform.ShowMessage = PlatformName##_ShowMessage;\
|
|
Platform.BeginFileIter = PlatformName##_BeginFileIter;\
|
|
Platform.AdvanceFileIter = PlatformName##_AdvanceFileIter;\
|
|
Platform.EndFileIter = PlatformName##_EndFileIter;\
|
|
|