Table of Contents

 
DoInput
 

Purpose

Takes the current keystroke and passes it to the input function

 

Protoype

void CtextMngr::DoInput (SDL_keysym sym_keystroke)
 

Parameters

keystroke the SDL keysym extracted from a keypress (SDL_KEYDOWN) event
 

Description

When an Input Text object is selected, this function takes the key pressed (represented as an SDL keysym) and appends that character onto the input text string. The function first checks a flag to make sure that an Input Text object has been actiavted with EnableInput(). Then it also updates the position of the input cursor and resizes the hotspot for future selection.

NOTE: This function can only be placed inside an SDL_KEYDOWN event. The reason is because it uses unicode values to decipher the character to append to the text string, and the SDL_KEYUP event does not use unicode values - whether they are enabled or not.

 

Use

CTextMngr text;
SDL_event event;
// in SDL event loop
case SDL_KEYDOWN:
    {
        text.DoInput(event.key.keysym);
    } break;
 

Prev: Assign