diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/timer/api_timer.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/timer/api_timer.h')
-rw-r--r-- | Src/Wasabi/api/timer/api_timer.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Src/Wasabi/api/timer/api_timer.h b/Src/Wasabi/api/timer/api_timer.h new file mode 100644 index 00000000..4bc8cb81 --- /dev/null +++ b/Src/Wasabi/api/timer/api_timer.h @@ -0,0 +1,47 @@ +#ifndef __TIMER_API_H +#define __TIMER_API_H + +// Under linux, the Timer API requires the Linux API + +#include <bfc/dispatch.h> +#include <bfc/platform/platform.h> + +class TimerClient; + +#ifdef _WIN32 +typedef UINT_PTR TimerToken ; +#elif defined(__APPLE__) +typedef EventLoopTimerRef TimerToken; +#else +#error port me! +#endif + +class timer_api : public Dispatchable +{ + public: + TimerToken timer_add(TimerClient *client, intptr_t id, int ms); + void timer_remove(TimerClient *client, TimerToken token); + + enum { + TIMER_API_ADD = 1, + TIMER_API_REMOVE = 11, + }; +}; + +inline TimerToken timer_api::timer_add(TimerClient *client, intptr_t id, int ms) +{ + return _call(TIMER_API_ADD, (TimerToken)0, client, id, ms); +} + +inline void timer_api::timer_remove(TimerClient *client, TimerToken token) +{ + _voidcall(TIMER_API_REMOVE, client, token); +} + +// {3130D81C-AE1F-4954-9765-698473B627B0} +static const GUID timerApiServiceGuid = +{ 0x3130d81c, 0xae1f, 0x4954, { 0x97, 0x65, 0x69, 0x84, 0x73, 0xb6, 0x27, 0xb0 } }; + +extern timer_api *timerApi; + +#endif
\ No newline at end of file |