39 lines
2.4 KiB
Markdown
39 lines
2.4 KiB
Markdown
|
@table(Name, NameLower, NameCaps, Type, Arguments) platform_functions:
|
||
|
{
|
||
|
{ Reserve reserve RESERVE `void *` `u64 Size` }
|
||
|
{ Release release RELEASE `void` `void *Pointer` }
|
||
|
{ Commit commit COMMIT `void` `void *Pointer, u64 Size` }
|
||
|
{ Decommit decommit DECOMMIT `void` `void *Pointer, u64 Size` }
|
||
|
{ OpenFile open_file OPEN_FILE `platform_file_handle` `string Path, platform_access_flags FileAccess` }
|
||
|
{ CloseFile close_file CLOSE_FILE `void` `platform_file_handle Handle` }
|
||
|
{ ReadFile read_file READ_FILE `void` `platform_file_handle Handle, void *Dest, u64 Offset, u64 Size` }
|
||
|
{ WriteFile write_file WRITE_FILE `void` `platform_file_handle Handle, void *Source, u64 Offset, u64 Size` }
|
||
|
{ GetFileSize get_file_size GET_FILE_SIZE `u64` `platform_file_handle Handle` }
|
||
|
{ SetCursor set_cursor SET_CURSOR `void` `platform_cursor Cursor` }
|
||
|
{ ToggleFullscreen toggle_fullscreen TOGGLE_FULLSCREEN `void` `void` }
|
||
|
{ ShowMessage show_message SHOW_MESSAGE `void` `string Message, platform_message_type Type` }
|
||
|
}
|
||
|
|
||
|
@table_gen
|
||
|
{
|
||
|
@expand(platform_functions s) `#define PLATFORM_$(s.NameCaps)(name) $(s.Type) name($(s.Arguments))`
|
||
|
}
|
||
|
|
||
|
@table_gen
|
||
|
{
|
||
|
@expand(platform_functions s) `typedef PLATFORM_$(s.NameCaps)(platform_$(s.NameLower));`
|
||
|
}
|
||
|
|
||
|
@table_gen
|
||
|
{
|
||
|
`struct platform_api`
|
||
|
`{`
|
||
|
@expand(platform_functions s) `platform_$(s.NameLower) *$(s.Name); `
|
||
|
`};`
|
||
|
}
|
||
|
|
||
|
@table_gen
|
||
|
{
|
||
|
`#define RegisterPlatformFunctions(PlatformName)\\`
|
||
|
@expand(platform_functions s) `Platform.$(s.Name) = PlatformName##_$(s.Name);\\`
|
||
|
}
|