Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
108 lines (89 loc) · 3.11 KB

SDL_timer.h

File metadata and controls

108 lines (89 loc) · 3.11 KB
 
Apr 26, 2001
Apr 26, 2001
1
/*
Apr 8, 2011
Apr 8, 2011
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Apr 26, 2001
Apr 26, 2001
20
21
22
23
24
*/
#ifndef _SDL_timer_h
#define _SDL_timer_h
Jul 10, 2006
Jul 10, 2006
25
/**
Oct 19, 2009
Oct 19, 2009
26
27
28
* \file SDL_timer.h
*
* Header for the SDL time management routines.
Jul 10, 2006
Jul 10, 2006
29
*/
Apr 26, 2001
Apr 26, 2001
30
Feb 10, 2006
Feb 10, 2006
31
#include "SDL_stdinc.h"
Feb 10, 2006
Feb 10, 2006
32
#include "SDL_error.h"
Apr 26, 2001
Apr 26, 2001
33
34
35
36
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
37
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
38
extern "C" {
Jul 10, 2006
Jul 10, 2006
39
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
40
41
#endif
Oct 19, 2009
Oct 19, 2009
42
/**
Jan 27, 2011
Jan 27, 2011
43
* \brief Get the number of milliseconds since the SDL library initialization.
Oct 19, 2009
Oct 19, 2009
44
*
Jan 27, 2011
Jan 27, 2011
45
* \note This value wraps if the program runs for more than ~49 days.
Jul 10, 2006
Jul 10, 2006
46
*/
Apr 11, 2002
Apr 11, 2002
47
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
Apr 26, 2001
Apr 26, 2001
48
Mar 25, 2011
Mar 25, 2011
49
50
51
52
53
54
55
56
57
58
/**
* \brief Get the current value of the high resolution counter
*/
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
/**
* \brief Get the count per second of the high resolution counter
*/
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
Oct 19, 2009
Oct 19, 2009
59
/**
Jan 27, 2011
Jan 27, 2011
60
* \brief Wait a specified number of milliseconds before returning.
Oct 19, 2009
Oct 19, 2009
61
*/
Apr 11, 2002
Apr 11, 2002
62
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
Apr 26, 2001
Apr 26, 2001
63
Oct 19, 2009
Oct 19, 2009
64
65
66
67
68
69
70
/**
* Function prototype for the timer callback function.
*
* The callback function is passed the current timer interval and returns
* the next timer interval. If the returned value is the same as the one
* passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
Apr 26, 2001
Apr 26, 2001
71
*/
Jan 27, 2011
Jan 27, 2011
72
typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
Apr 26, 2001
Apr 26, 2001
73
Oct 19, 2009
Oct 19, 2009
74
/**
Jan 27, 2011
Jan 27, 2011
75
* Definition of the timer ID type.
Oct 19, 2009
Oct 19, 2009
76
*/
Jan 27, 2011
Jan 27, 2011
77
typedef int SDL_TimerID;
Apr 26, 2001
Apr 26, 2001
78
Oct 19, 2009
Oct 19, 2009
79
/**
Jan 27, 2011
Jan 27, 2011
80
81
82
* \brief Add a new timer to the pool of timers already running.
*
* \return A timer ID, or NULL when an error occurs.
Apr 26, 2001
Apr 26, 2001
83
*/
Jul 10, 2006
Jul 10, 2006
84
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
Jan 27, 2011
Jan 27, 2011
85
86
SDL_TimerCallback callback,
void *param);
Apr 26, 2001
Apr 26, 2001
87
Oct 19, 2009
Oct 19, 2009
88
/**
Jan 27, 2011
Jan 27, 2011
89
90
91
92
93
* \brief Remove a timer knowing its ID.
*
* \return A boolean value indicating success or failure.
*
* \warning It is not safe to remove a timer multiple times.
Apr 26, 2001
Apr 26, 2001
94
*/
Apr 11, 2002
Apr 11, 2002
95
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
Apr 26, 2001
Apr 26, 2001
96
Oct 19, 2009
Oct 19, 2009
97
Apr 26, 2001
Apr 26, 2001
98
99
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
100
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
101
}
Jul 10, 2006
Jul 10, 2006
102
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
103
104
105
106
#endif
#include "close_code.h"
#endif /* _SDL_timer_h */
Jul 10, 2006
Jul 10, 2006
107
108
/* vi: set ts=4 sw=4 expandtab: */