57 lines
2.5 KiB
C
57 lines
2.5 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)
|
||
|
|
||
|
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);
|
||
|
|
||
|
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;
|
||
|
};
|
||
|
|
||
|
#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;\
|
||
|
|