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

Abstraction layer header for retro systems. More...

Collaboration diagram for RetroFlat API:

Topics

 RetroFlat Example
 An extremely simple single-file annotated example program written with the RetroFlat API.
 
 RetroFlat Compilation
 Makefile examples and compiler considerations for using RetroFlat.
 
 RetroFlat Colors
 Color definitions RetroFlat is aware of, for use with the RetroFlat Drawing API.
 
 RetroFlat API Return Values
 Standardized return values from RetroFlat API functions.
 
 RetroFlat Drawing API
 Functions for drawing primitives on-screen.
 
 Global Flags
 Flags that may be present on RETROFLAT_STATE::retroflat_flags.
 
 RetroFlat Message API
 These flags can be passed to retroflat_message() to indicate the type of message being conveyed.
 
 RetroFlat VDP API
 Video Display Processor tools for modifying display output.
 
 RetroFlat Bitmap API
 Tools for loading bitmaps from disk and drawing them on-screen.
 
 RetroFlat Assets API
 Functions and macros for handling graphical asset files.
 
 RetroFlat Input API
 Functions and constants for polling and interpreting user input.
 

Files

file  retroflt.h
 Abstraction layer header for retro systems.
 

Data Structures

struct  RETROFLAT_ARGS
 Struct containing configuration values for a RetroFlat program. More...
 
struct  RETROFLAT_STATE
 Global singleton containing state for the current platform. More...
 

Macros

#define RETROFLAT_BITMAP_TRACE_LVL   0
 
#define RETROFLAT_KB_TRACE_LVL   0
 
#define RETROFLAT_DEFAULT_SCREEN_W   320
 
#define RETROFLAT_DEFAULT_SCREEN_H   200
 
#define RETROFLAT_GL_Z   -0.001
 
#define retroflat_on_resize(w, h)
 
#define retroflat_screen_w()
 Get the current screen width in pixels.
 
#define retroflat_screen_h()
 Get the current screen height in pixels.
 
#define retroflat_screen_buffer()   (&(g_retroflat_state->buffer))
 Get the direct screen buffer or the VDP buffer if a VDP is loaded.
 
#define retroflat_quit(retval_in)
 This should be called in order to quit a program using RetroFlat.
 
#define RETROFLAT_COLOR_TABLE_CONSTS(idx, name_l, name_u, r, g, b, cgac, cgad)    extern MAUG_CONST RETROFLAT_COLOR RETROFLAT_COLOR_ ## name_u;
 

Typedefs

typedef MERROR_RETVAL(* retroflat_proc_resize_t) (uint16_t new_w, uint16_t new_h, void *data)
 
typedef void(* retroflat_loop_iter) (void *data)
 Prototype for the main loop function passed to retroflat_loop().
 

Functions

MERROR_RETVAL retroflat_loop (retroflat_loop_iter frame_iter, retroflat_loop_iter loop_iter, void *data)
 This should be called once in the main body of the program in order to enter the main loop. The main loop will continuously call loop_iter with data as an argument until retroflat_quit() is called.
 
void retroflat_message (uint8_t flags, const char *title, const char *format,...)
 Display a message in a dialog box and/or on stderr.
 
MERROR_RETVAL retroflat_init (int argc, char *argv[], struct RETROFLAT_ARGS *args)
 Initialize RetroFlat and its underlying layers. This should be called once at the beginning of the program and should quit if the return value indicates any failures.
 
void retroflat_shutdown (int retval)
 Deinitialize RetroFlat and its underlying layers. This should be called once at the end of the program, after retroflat_loop().
 
void retroflat_set_title (const char *format,...)
 
retroflat_ms_t retroflat_get_ms ()
 
uint32_t retroflat_get_rand ()
 
char retroflat_vk_to_ascii (RETROFLAT_IN_KEY k, uint8_t flags)
 
void retroflat_set_proc_resize (retroflat_proc_resize_t on_resize_in, void *data_in)
 
void retroflat_resize_v ()
 

Variables

MAUG_CONST char *SEG_MCONST gc_retroflat_color_names []
 
struct RETROFLAT_STATEg_retroflat_state
 

Detailed Description

Abstraction layer header for retro systems.

Macro Definition Documentation

◆ retroflat_on_resize

#define retroflat_on_resize ( w,
h )
Value:
g_retroflat_state->screen_w = w; \
g_retroflat_state->screen_h = h;
int screen_w
The screen width as seen by the system, after scaling.
Definition retroflt.h:2186
int screen_h
The screen height as seen by the system, after scaling.
Definition retroflt.h:2188

◆ retroflat_quit

#define retroflat_quit ( retval_in)

This should be called in order to quit a program using RetroFlat.

Parameters
retvalThe return value to pass back to the operating system.

Function Documentation

◆ retroflat_init()

MERROR_RETVAL retroflat_init ( int argc,
char * argv[],
struct RETROFLAT_ARGS * args )

Initialize RetroFlat and its underlying layers. This should be called once at the beginning of the program and should quit if the return value indicates any failures.

Returns
RETROFLAT_OK if there were no problems or other RetroFlat API Return Values if there were.

◆ retroflat_message()

void retroflat_message ( uint8_t flags,
const char * title,
const char * format,
... )

Display a message in a dialog box and/or on stderr.

Parameters
titleA string with the title to use for a dialog box.
formatA format string to be passed to vsnprintf().
Todo
This should display a dialog box on every platform if possible.

◆ retroflat_shutdown()

void retroflat_shutdown ( int retval)

Deinitialize RetroFlat and its underlying layers. This should be called once at the end of the program, after retroflat_loop().

Parameters
retvalReturn value from retroflat_init(), so we know what layers are in what state.