UFO: Alien Invasion
ui_timer.cpp File Reference
#include "../cl_shared.h"
#include "ui_nodes.h"
#include "ui_timer.h"
Include dependency graph for ui_timer.cpp:

Go to the source code of this file.

Macros

#define UI_TIMER_SLOT_NUMBER   10
 Number max of timer slot. More...
 

Functions

static void UI_RemoveTimerFromActiveList (uiTimer_t *timer)
 Remove a timer from the active linked list. More...
 
static void UI_InsertTimerInActiveList (uiTimer_t *first, uiTimer_t *newTimer)
 Insert a timer in a sorted linked list of timers. List are ordered from smaller to bigger nextTime value. More...
 
void UI_HandleTimers (void)
 Internal function to handle timers. More...
 
uiTimer_tUI_AllocTimer (uiNode_t *node, int firstDelay, timerCallback_t callback)
 Allocate a new time for a node. More...
 
void UI_TimerStart (uiTimer_t *timer)
 Restart a timer. More...
 
void UI_TimerStop (uiTimer_t *timer)
 Stop a timer. More...
 
void UI_TimerRelease (uiTimer_t *timer)
 Release the timer. It no more exists. More...
 
void UI_ResetTimers (void)
 

Variables

static uiTimer_t ui_timerSlots [UI_TIMER_SLOT_NUMBER]
 Timer slot. Only one. More...
 
static uiTimer_tui_firstTimer
 First timer from the timer list. This list is ordered from smaller to bigger nextTime value. More...
 

Macro Definition Documentation

◆ UI_TIMER_SLOT_NUMBER

#define UI_TIMER_SLOT_NUMBER   10

Number max of timer slot.

Definition at line 32 of file ui_timer.cpp.

Function Documentation

◆ UI_AllocTimer()

uiTimer_t * UI_AllocTimer ( uiNode_t node,
int  firstDelay,
timerCallback_t  callback 
)

Allocate a new time for a node.

Parameters
[in]nodenode parent of the timer
[in]firstDelaymillisecond delay to wait the callback
[in]callbackcallback function to call every delay

Definition at line 123 of file ui_timer.cpp.

References Com_Error(), ERR_FATAL, i, timer, UI_TIMER_SLOT_NUMBER, and ui_timerSlots.

Referenced by CL_BattlescapeRadarGenerateAll_f(), uiSpinnerNode::onMouseDown(), uiZoneNode::onMouseDown(), TEST_F(), UI_InitDraw(), UI_MouseDown(), and UI_VScrollbarNodeAction().

◆ UI_HandleTimers()

void UI_HandleTimers ( void  )

Internal function to handle timers.

Definition at line 98 of file ui_timer.cpp.

References CL_Milliseconds(), uiTimer_t::nextTime, ui_firstTimer, UI_InsertTimerInActiveList(), and UI_RemoveTimerFromActiveList().

Referenced by UI_Draw().

◆ UI_InsertTimerInActiveList()

static void UI_InsertTimerInActiveList ( uiTimer_t first,
uiTimer_t newTimer 
)
static

Insert a timer in a sorted linked list of timers. List are ordered from smaller to bigger nextTime value.

Definition at line 66 of file ui_timer.cpp.

References uiTimer_t::next, uiTimer_t::nextTime, uiTimer_t::prev, and ui_firstTimer.

Referenced by UI_HandleTimers(), and UI_TimerStart().

◆ UI_RemoveTimerFromActiveList()

static void UI_RemoveTimerFromActiveList ( uiTimer_t timer)
inlinestatic

Remove a timer from the active linked list.

Note
The function doesn't set to null next and previous attributes of the timer

Definition at line 49 of file ui_timer.cpp.

References ui_firstTimer, UI_TIMER_SLOT_NUMBER, and ui_timerSlots.

Referenced by UI_HandleTimers(), UI_TimerRelease(), and UI_TimerStop().

◆ UI_ResetTimers()

void UI_ResetTimers ( void  )

Definition at line 185 of file ui_timer.cpp.

References OBJZERO, ui_firstTimer, and ui_timerSlots.

Referenced by UI_Shutdown().

◆ UI_TimerRelease()

◆ UI_TimerStart()

◆ UI_TimerStop()

void UI_TimerStop ( uiTimer_t timer)

Variable Documentation

◆ ui_firstTimer

uiTimer_t* ui_firstTimer
static

First timer from the timer list. This list is ordered from smaller to bigger nextTime value.

Definition at line 43 of file ui_timer.cpp.

Referenced by UI_HandleTimers(), UI_InsertTimerInActiveList(), UI_RemoveTimerFromActiveList(), UI_ResetTimers(), and UI_TimerStart().

◆ ui_timerSlots

uiTimer_t ui_timerSlots[UI_TIMER_SLOT_NUMBER]
static

Timer slot. Only one.

Definition at line 37 of file ui_timer.cpp.

Referenced by UI_AllocTimer(), UI_RemoveTimerFromActiveList(), and UI_ResetTimers().