Atrinik Client 2.5
Functions | Variables
toolkit/text_input.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

int text_input_center_offset ()
void text_input_draw_background (SDL_Surface *surface, int x, int y, int bitmap)
void text_input_draw_text (SDL_Surface *surface, int x, int y, int font, const char *text, const char *color_notation, uint64 flags, int bitmap, SDL_Rect *box)
void text_input_show (SDL_Surface *surface, int x, int y, int font, const char *text, const char *color_notation, uint64 flags, int bitmap, SDL_Rect *box)
void text_input_clear ()
void text_input_open (int maxchar)
static void text_input_history_add (const char *text)
void text_input_history_clear ()
void text_input_add_string (const char *text)
static void text_input_skip_word (int *i, int left)
int text_input_handle (SDL_KeyboardEvent *key)

Variables

char text_input_string [MAX_INPUT_STRING]
int text_input_count
static int text_input_cursor_pos = 0
static int text_input_max
static char text_input_history [MAX_HISTORY_LINES][MAX_INPUT_STRING]
static size_t text_input_history_pos = 0
int text_input_string_flag
int text_input_string_end_flag
int text_input_string_esc_flag
uint32 text_input_opened

Detailed Description

Text input API.

Definition in file text_input.c.


Function Documentation

void text_input_add_string ( const char *  text)

Put string to the text input.

Parameters:
textThe string.

Definition at line 263 of file text_input.c.

int text_input_center_offset ( )

Calculate X offset for centering a text input bitmap.

Returns:
The offset.

Definition at line 60 of file text_input.c.

void text_input_clear ( )

Clear text input.

Definition at line 173 of file text_input.c.

void text_input_draw_background ( SDL_Surface *  surface,
int  x,
int  y,
int  bitmap 
)

Draw text input's background (the bitmap).

Parameters:
surfaceSurface to draw on.
xX position.
yY position.
bitmapBitmap to use.

Definition at line 71 of file text_input.c.

void text_input_draw_text ( SDL_Surface *  surface,
int  x,
int  y,
int  font,
const char *  text,
const char *  color_notation,
uint64  flags,
int  bitmap,
SDL_Rect *  box 
)

Draw text input's text.

Parameters:
surfaceSurface to draw on.
xX position.
yY position.
fontFont to use.
textText to draw.
color_notationColor to use.
flagsText flags.
bitmapBitmap to use.
boxContains coordinates to use and maximum string width.

Definition at line 92 of file text_input.c.

int text_input_handle ( SDL_KeyboardEvent *  key)

Handle text input keyboard event.

Parameters:
keyThe keyboard event.
Returns:
1 if the event was handled, 0 otherwise.

Definition at line 295 of file text_input.c.

static void text_input_history_add ( const char *  text) [static]

Add string to the text input history.

Parameters:
textThe text to add to the history.

Definition at line 221 of file text_input.c.

void text_input_history_clear ( )

Clear all the text window history.

Definition at line 248 of file text_input.c.

void text_input_open ( int  maxchar)

Open text input.

Parameters:
maxcharMaximum number of allowed characters.

Definition at line 188 of file text_input.c.

void text_input_show ( SDL_Surface *  surface,
int  x,
int  y,
int  font,
const char *  text,
const char *  color_notation,
uint64  flags,
int  bitmap,
SDL_Rect *  box 
)

Show text input.

Parameters:
surfaceSurface to use.
xX position.
yY position.
fontFont to use.
textText to draw.
color_notationColor to use.
flagsText flags.
bitmapBitmap to use.
boxContains coordinates to use and maximum string width.

Definition at line 127 of file text_input.c.

static void text_input_skip_word ( int *  i,
int  left 
) [static]

Skips whitespace and the first word in the input string.

Parameters:
[out]iPosition to adjust.
leftIf 1, skip to the left, to the right otherwise.

Definition at line 276 of file text_input.c.


Variable Documentation

Number of characters in the text input string.

Definition at line 35 of file text_input.c.

int text_input_cursor_pos = 0 [static]

Cursor position in the text input string.

Definition at line 37 of file text_input.c.

char text_input_history[MAX_HISTORY_LINES][MAX_INPUT_STRING] [static]

Text input history.

Definition at line 42 of file text_input.c.

size_t text_input_history_pos = 0 [static]

Position in the text input history -- used when browsing through the history.

Definition at line 46 of file text_input.c.

int text_input_max [static]

Maximum allowed characters in the text input string.

Definition at line 39 of file text_input.c.

When the console was opened.

Definition at line 55 of file text_input.c.

char text_input_string[MAX_INPUT_STRING]

Current text input string.

Definition at line 33 of file text_input.c.

If 1, we submitted some text using the console.

Definition at line 51 of file text_input.c.

If 1, ESC was pressed while entering some text to console.

Definition at line 53 of file text_input.c.

If 1, we have an open console.

Definition at line 49 of file text_input.c.