Mercurial > wgsdk
comparison src/timer.c @ 7:be4835547dd0
clean up code, convert git files to hg, etc.
author | Paper |
---|---|
date | Fri, 16 Dec 2022 20:35:06 -0500 |
parents | 7abb5d8b20ea |
children | 07f0e2f43204 |
comparison
equal
deleted
inserted
replaced
6:8ce85aee15c0 | 7:be4835547dd0 |
---|---|
3 # define WIN32_LEAN_AND_MEAN | 3 # define WIN32_LEAN_AND_MEAN |
4 #endif | 4 #endif |
5 #include <windows.h> | 5 #include <windows.h> |
6 #include "timer.h" | 6 #include "timer.h" |
7 | 7 |
8 void timer_init(struct timer_t* timer, HWND winampClientWindow, TIMERPROC timer_proc) { | 8 void timer_init(struct timer* timer, HWND winampClientWindow, TIMERPROC timer_proc) { |
9 timer->winampClientWindow = winampClientWindow; | 9 timer->winampClientWindow = winampClientWindow; |
10 timer->timer_proc = timer_proc; | 10 timer->timer_proc = timer_proc; |
11 timer->initialized = 1; | 11 timer->initialized = 1; |
12 } | 12 } |
13 | 13 |
14 void timer_set(struct timer_t* timer, HWND winampClientWindow) { | 14 void timer_set(struct timer* timer, HWND winampClientWindow) { |
15 assert(timer->initialized); | 15 assert(timer->initialized); |
16 | 16 |
17 if (timer->is_timer_alive) | 17 if (timer->is_timer_alive) |
18 return; | 18 return; |
19 | 19 |
20 timer->is_timer_alive = 1; | 20 timer->is_timer_alive = 1; |
21 SetTimer(winampClientWindow, 1, timer->interval, timer->timer_proc); | 21 SetTimer(winampClientWindow, 1, timer->interval, timer->timer_proc); |
22 } | 22 } |
23 | 23 |
24 void timer_stop(struct timer_t* timer, HWND winampClientWindow) { | 24 void timer_stop(struct timer* timer, HWND winampClientWindow) { |
25 assert(timer->initialized); | 25 assert(timer->initialized); |
26 | 26 |
27 if (!timer->is_timer_alive) | 27 if (!timer->is_timer_alive) |
28 return; | 28 return; |
29 | 29 |