Atrinik Client  4.0
Functions | Variables
tooltip.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

void tooltip_create (int mx, int my, font_struct *font, const char *text)
 
void tooltip_enable_delay (uint32_t delay)
 
void tooltip_multiline (int max_width)
 
void tooltip_show (void)
 
void tooltip_dismiss (void)
 
int tooltip_need_redraw (void)
 

Variables

static char tooltip_text [HUGE_BUF *4]
 
static font_structtooltip_font
 
static int tooltip_x = -1
 
static int tooltip_y = -1
 
static int tooltip_h = -1
 
static int tooltip_w = -1
 
static uint32_t tooltip_created = 0
 
static uint32_t tooltip_delay = 0
 
static uint8_t tooltip_opacity = 0
 

Detailed Description

Tooltip API.

Author
Alex Tokar

Definition in file tooltip.c.

Function Documentation

void tooltip_create ( int  mx,
int  my,
font_struct font,
const char *  text 
)

Creates a new tooltip. This must be called every frame in order for the tooltip to remain shown.

Parameters
mxMouse X.
myMouse Y.
fontFont to use, one of FONT_xxx.
textThe text to show in the tooltip.

Definition at line 60 of file tooltip.c.

void tooltip_dismiss ( void  )

Dismiss the currently shown tooltip.

Definition at line 175 of file tooltip.c.

void tooltip_enable_delay ( uint32_t  delay)

Adds a delay before the tooltip is shown.

Parameters
delayDelay in milliseconds.

Definition at line 82 of file tooltip.c.

void tooltip_multiline ( int  max_width)

Calculate multi-line tooltip height and width.

Parameters
max_widthMaximum width of the tooltip.

Definition at line 96 of file tooltip.c.

int tooltip_need_redraw ( void  )

Check whether the tooltip needs redrawing.

Returns
1 if the tooltip needs redrawing, 0 otherwise.
Todo:
This needs some actual redrawing check logic. Need various checks like whether the x/y is the same, text/font is the same (in other words, reset old x/y when creating if text/font has changed)

Definition at line 196 of file tooltip.c.

void tooltip_show ( void  )

Actually show the tooltip.

Definition at line 116 of file tooltip.c.

Variable Documentation

font_struct* tooltip_font
static

Font of the tooltip text.

Definition at line 37 of file tooltip.c.

char tooltip_text[HUGE_BUF *4]
static

Tooltip's text.

Definition at line 35 of file tooltip.c.

int tooltip_x = -1
static

Tooltip's X position.

Definition at line 39 of file tooltip.c.

int tooltip_y = -1
static

Tooltip's Y position.

Definition at line 41 of file tooltip.c.