annotate src/timer/wince/SDL_systimer.c @ 1402:d910939febfa

Use consistent identifiers for the various platforms we support. Make sure every source file includes SDL_config.h, so the proper system headers are chosen.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 21 Feb 2006 08:46:50 +0000
parents 19418e4422cb
children bb6839704ed6
rev   line source
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 /*
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
6 modify it under the terms of the GNU Lesser General Public
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
13 Lesser General Public License for more details.
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1180
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 Sam Lantinga
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 slouken@libsdl.org
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23
1330
450721ad5436 It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
24 #include "SDL_windows.h"
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 #include <mmsystem.h>
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 #include "SDL_timer.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
28 #include "../SDL_timer_c.h"
1180
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 static Uint64 start_date;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31 static Uint64 start_ticks;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 static Uint64 wce_ticks(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
35 return((Uint64)GetTickCount());
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38 static Uint64 wce_date(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40 union
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42 FILETIME ftime;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
43 Uint64 itime;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
44 } ftime;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
45 SYSTEMTIME stime;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
46
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
47 GetSystemTime(&stime);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
48 SystemTimeToFileTime(&stime,&ftime.ftime);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
49 ftime.itime/=10000; // Convert 100ns intervals to 1ms intervals
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
50 // Remove ms portion, which can't be relied on
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
51 ftime.itime -= (ftime.itime % 1000);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
52 return(ftime.itime);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
53 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
54
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
55 static Sint32 wce_rel_ticks(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
56 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
57 return((Sint32)(wce_ticks()-start_ticks));
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
58 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
59
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
60 static Sint32 wce_rel_date(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
61 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
62 return((Sint32)(wce_date()-start_date));
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
63 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
64
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
65 /* Return time in ms relative to when SDL was started */
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
66 Uint32 SDL_GetTicks()
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
67 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
68 Sint32 offset=wce_rel_date()-wce_rel_ticks();
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
69 if((offset < -1000) || (offset > 1000))
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
70 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
71 // fprintf(stderr,"Time desync(%+d), resyncing\n",offset/1000);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
72 start_ticks-=offset;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
73 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
74
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
75 return((Uint32)wce_rel_ticks());
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
76 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
77
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
78 /* Give up approx. givem milliseconds to the OS. */
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
79 void SDL_Delay(Uint32 ms)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
80 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
81 Sleep(ms);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
82 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
83
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
84 /* Recard start-time of application for reference */
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
85 void SDL_StartTicks(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
86 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
87 start_date=wce_date();
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
88 start_ticks=wce_ticks();
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
89 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
90
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
91 static UINT WIN_timer;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
92
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
93 int SDL_SYS_TimerInit(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
94 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
95 return(0);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
96 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98 void SDL_SYS_TimerQuit(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
99 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
100 return;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
101 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
102
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
103 /* Forward declaration because this is called by the timer callback */
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104 int SDL_SYS_StartTimer(void);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
106 static VOID CALLBACK TimerCallbackProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
107 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
108 Uint32 ms;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
109
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
110 ms = SDL_alarm_callback(SDL_alarm_interval);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
111 if ( ms != SDL_alarm_interval ) {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
112 KillTimer(NULL, idEvent);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
113 if ( ms ) {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
114 SDL_alarm_interval = ROUND_RESOLUTION(ms);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
115 SDL_SYS_StartTimer();
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
116 } else {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
117 SDL_alarm_interval = 0;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
118 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
119 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
120 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
121
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
122 int SDL_SYS_StartTimer(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
123 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
124 int retval;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
125
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
126 WIN_timer = SetTimer(NULL, 0, SDL_alarm_interval, TimerCallbackProc);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
127 if ( WIN_timer ) {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
128 retval = 0;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
129 } else {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
130 retval = -1;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
131 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
132 return retval;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
133 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
134
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
135 void SDL_SYS_StopTimer(void)
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
136 {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
137 if ( WIN_timer ) {
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
138 KillTimer(NULL, WIN_timer);
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
139 WIN_timer = 0;
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
140 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
141 }
bdcb8bb4c831 From: Tyler Montbriand <tsm@accesscomm.ca>
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
142