diff --git a/vendor/sdl3/sdl3_filesystem.odin b/vendor/sdl3/sdl3_filesystem.odin index 0556843f8..4abcbee3e 100644 --- a/vendor/sdl3/sdl3_filesystem.odin +++ b/vendor/sdl3/sdl3_filesystem.odin @@ -49,10 +49,8 @@ EnumerationResult :: enum c.int { EnumerateDirectoryCallback :: #type proc "c" (userdata: rawptr, dirname, fname: cstring) -> EnumerationResult - @(default_calling_convention="c", link_prefix="SDL_") foreign lib { - GetBasePath :: proc() -> cstring --- GetPrefPath :: proc(org, app: cstring) -> [^]c.char --- GetUserFolder :: proc(folder: Folder) -> cstring --- diff --git a/vendor/sdl3/sdl3_time.odin b/vendor/sdl3/sdl3_time.odin new file mode 100644 index 000000000..7c34b83e5 --- /dev/null +++ b/vendor/sdl3/sdl3_time.odin @@ -0,0 +1,40 @@ +package sdl3 + +import "core:c" + +DateTime :: struct { + year: c.int, /**< Year */ + month: c.int, /**< Month [01-12] */ + day: c.int, /**< Day of the month [01-31] */ + hour: c.int, /**< Hour [0-23] */ + minute: c.int, /**< Minute [0-59] */ + second: c.int, /**< Seconds [0-60] */ + nanosecond: c.int, /**< Nanoseconds [0-999999999] */ + day_of_week: c.int, /**< Day of the week [0-6] (0 being Sunday) */ + utc_offset: c.int, /**< Seconds east of UTC */ +} + +DateFormat :: enum c.int { + YYYYMMDD = 0, /**< Year/Month/Day */ + DDMMYYYY = 1, /**< Day/Month/Year */ + MMDDYYYY = 2, /**< Month/Day/Year */ +} + +TimeFormat :: enum c.int { + HR24 = 0, /**< 24 hour time */ + HR12 = 1, /**< 12 hour time */ +} + + +@(default_calling_convention="c", link_prefix="SDL_", require_results) +foreign lib { + GetDateTimeLocalePreferences :: proc(dateFormat: ^DateFormat, timeFormat: ^TimeFormat) -> bool --- + GetCurrentTime :: proc(ticks: ^Time) -> bool --- + TimeToDateTime :: proc(ticks: Time, dt: ^DateTime, localTime: bool) -> bool --- + DateTimeToTime :: proc(#by_ptr dt: DateTime, ticks: ^Time) -> bool --- + TimeToWindows :: proc(ticks: Time, dwLowDateTime, dwHighDateTime: ^Uint32) --- + TimeFromWindows :: proc(dwLowDateTime, dwHighDateTime: Uint32) -> Time --- + GetDaysInMonth :: proc(year, month: c.int) -> c.int --- + GetDayOfYear :: proc(year, month, day: c.int) -> c.int --- + GetDayOfWeek :: proc(year, month, day: c.int) -> c.int --- +} \ No newline at end of file diff --git a/vendor/sdl3/sdl3_timer.odin b/vendor/sdl3/sdl3_timer.odin new file mode 100644 index 000000000..5c62040df --- /dev/null +++ b/vendor/sdl3/sdl3_timer.odin @@ -0,0 +1,33 @@ +package sdl3 + +MS_PER_SECOND :: 1000 +US_PER_SECOND :: 1000000 +NS_PER_SECOND :: 1000000000 +NS_PER_MS :: 1000000 +NS_PER_US :: 1000 + +@(require_results) SECONDS_TO_NS :: #force_inline proc "c" (S: Uint64) -> Uint64 { return S * NS_PER_SECOND } +@(require_results) NS_TO_SECONDS :: #force_inline proc "c" (NS: Uint64) -> Uint64 { return NS / NS_PER_SECOND } +@(require_results) MS_TO_NS :: #force_inline proc "c" (MS: Uint64) -> Uint64 { return MS * NS_PER_MS } +@(require_results) NS_TO_MS :: #force_inline proc "c" (NS: Uint64) -> Uint64 { return NS / NS_PER_MS } +@(require_results) US_TO_NS :: #force_inline proc "c" (US: Uint64) -> Uint64 { return US * NS_PER_US } +@(require_results) NS_TO_US :: #force_inline proc "c" (NS: Uint64) -> Uint64 { return NS / NS_PER_US } + +TimerID :: distinct Uint32 + +TimerCallback :: #type proc "c" (userdata: rawptr, timerID: TimerID, interval: Uint32) -> Uint32 +NSTimerCallback :: #type proc "c" (userdata: rawptr, timerID: TimerID, interval: Uint64) -> Uint64 + +@(default_calling_convention="c", link_prefix="SDL_", require_results) +foreign lib { + GetTicks :: proc() -> Uint64 --- + GetTicksNS :: proc() -> Uint64 --- + GetPerformanceCounter :: proc() -> Uint64 --- + GetPerformanceFrequency :: proc() -> Uint64 --- + Delay :: proc(ms: Uint32) --- + DelayNS :: proc(ns: Uint64) --- + DelayPrecise :: proc(ns: Uint64) --- + AddTimer :: proc(interval: Uint32, callback: TimerCallback, userdata: rawptr) -> TimerID --- + AddTimerNS :: proc(interval: Uint64, callback: NSTimerCallback, userdata: rawptr) -> TimerID --- + RemoveTimer :: proc(id: TimerID) -> bool --- +} \ No newline at end of file