UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_timer.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #include "../../shared/cxx.h"
28 struct uiNode_t;
29 struct uiTimer_s;
30 
31 typedef void (*timerCallback_t)(uiNode_t* node, struct uiTimer_s* timer);
32 
36 typedef struct uiTimer_s {
37  struct uiTimer_s* next;
38  struct uiTimer_s* prev;
39  int nextTime;
43  int calledTime;
45  int delay;
46  void* userData;
47  bool isRunning;
48 } uiTimer_t;
49 
50 uiTimer_t* UI_AllocTimer(uiNode_t* node, int firstDelay, timerCallback_t callback) __attribute__ ((warn_unused_result));
54 void UI_ResetTimers(void);
55 void UI_HandleTimers(void);
56 
57 #ifdef COMPILE_UNITTESTS
58 const uiTimer_t* UI_PrivateGetFirstTimer(void);
59 void UI_PrivateInsertTimerInActiveList(uiTimer_t* first, uiTimer_t* newTimer);
60 #endif
timerCallback_t callback
Definition: ui_timer.h:42
struct uiTimer_s * prev
Definition: ui_timer.h:38
void UI_TimerStop(uiTimer_t *timer)
Stop a timer.
Definition: ui_timer.cpp:163
#define __attribute__(x)
Definition: cxx.h:37
Definition: common.cpp:82
int delay
Definition: ui_timer.h:45
struct uiTimer_s uiTimer_t
int nextTime
Definition: ui_timer.h:39
void UI_HandleTimers(void)
Internal function to handle timers.
Definition: ui_timer.cpp:98
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
const GLuint *typedef void(APIENTRY *GenRenderbuffersEXT_t)(GLsizei
Definition: r_gl.h:189
uiNode_t * owner
Definition: ui_timer.h:41
void UI_TimerStart(uiTimer_t *timer)
Restart a timer.
Definition: ui_timer.cpp:150
void(* timerCallback_t)(uiNode_t *node, struct uiTimer_s *timer)
Definition: ui_timer.h:31
bool isRunning
Definition: ui_timer.h:47
void UI_TimerRelease(uiTimer_t *timer)
Release the timer. It no more exists.
Definition: ui_timer.cpp:176
void * userData
Definition: ui_timer.h:46
void UI_ResetTimers(void)
Definition: ui_timer.cpp:185
struct uiTimer_s * next
Definition: ui_timer.h:37
int calledTime
Definition: ui_timer.h:43
static uiTimer_t * timer
Definition: cl_radar.cpp:37
uiTimer_t * UI_AllocTimer(uiNode_t *node, int firstDelay, timerCallback_t callback) __attribute__((warn_unused_result))
Allocate a new time for a node.
Definition: ui_timer.cpp:123