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