maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroFlat Input API

Functions and constants for polling and interpreting user input. More...

Collaboration diagram for RetroFlat Input API:

Topics

 RetroFlat Key Definitions
 Keyboard and mouse controls RetroFlat is aware of, for use within the RetroFlat Input API.
 

Data Structures

struct  RETROFLAT_INPUT
 Struct passed to retroflat_poll_input() to hold return data. More...
 

Macros

#define retroflat_buffer_bksp(buffer, buffer_cur, buffer_sz)
 Remove a character from a text buffer before cursor position.
 
#define retroflat_buffer_insert(c, buffer, buffer_cur, buffer_sz, buffer_mx)
 Insert a character into a text buffer at cursor position.
 
#define RETROFLAT_INPUT_MOD_SHIFT   0x01
 
#define RETROFLAT_INPUT_MOD_ALT   0x02
 
#define RETROFLAT_INPUT_MOD_CTRL   0x04
 
#define RETROFLAT_INPUT_FORCE_UPPER   0x08
 

Functions

RETROFLAT_IN_KEY retroflat_poll_input (struct RETROFLAT_INPUT *input)
 Poll input devices (keyboard/mouse) and return the latest event.
 

Detailed Description

Functions and constants for polling and interpreting user input.

Macro Definition Documentation

◆ retroflat_buffer_bksp

#define retroflat_buffer_bksp ( buffer,
buffer_cur,
buffer_sz )
Value:
if( 0 < buffer_cur ) { \
if( buffer_cur < buffer_sz ) { \
memmove( \
&(buffer[(buffer_cur) - 1]), \
&(buffer[buffer_cur]), \
(buffer_sz) - (buffer_cur) ); \
} \
buffer_cur--; \
buffer_sz--; \
buffer[buffer_sz] = '\0'; \
}

Remove a character from a text buffer before cursor position.

◆ retroflat_buffer_insert

#define retroflat_buffer_insert ( c,
buffer,
buffer_cur,
buffer_sz,
buffer_mx )
Value:
if( buffer_sz + 1 < buffer_mx ) { \
if( buffer_cur < buffer_sz ) { \
memmove( \
&(buffer[(buffer_cur) + 1]), \
&(buffer[buffer_cur]), \
(buffer_sz) - (buffer_cur) ); \
} \
buffer[buffer_cur] = c; \
buffer_cur++; \
buffer_sz++; \
buffer[buffer_sz] = '\0'; \
}

Insert a character into a text buffer at cursor position.

Function Documentation

◆ retroflat_poll_input()

RETROFLAT_IN_KEY retroflat_poll_input ( struct RETROFLAT_INPUT * input)

Poll input devices (keyboard/mouse) and return the latest event.

Parameters
inputPointer to a RETROFLAT_INPUT struct to store extended info.
Returns
A symbol from RetroFlat Key Definitions.