Abstraction layer header for retro systems.
More...
|
file | retroflt.h |
| Abstraction layer header for retro systems.
|
|
|
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().
|
|
typedef size_t | retroflat_pxxy_t |
| Type used for surface pixel coordinates.
|
|
typedef maug_ms_t | retroflat_ms_t |
|
|
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.
|
|
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().
|
|
RETROFLAT_IN_KEY | retroflat_repeat_input (RETROFLAT_IN_KEY key_out, struct RETROFLAT_INPUT *input, RETROFLAT_IN_KEY *prev_input, int *prev_delay) |
|
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) |
| Set the procedure to call when the window is resized (on platforms that support resizing).
|
|
void | retroflat_resize_v () |
| Platform-specific function to resize virtual screen to match physical window size.
|
|
|
MAUG_CONST char *SEG_MCONST | gc_retroflat_color_names [] |
|
struct RETROFLAT_STATE *SEG_MGLOBAL | g_retroflat_state |
|
#define | RETROSND_ARGS_FLAG_LIST_DEVS 0x01 |
|
Abstraction layer header for retro systems.
◆ RETROFLAT_COLOR_TABLE_CONSTS
#define RETROFLAT_COLOR_TABLE_CONSTS |
( |
| idx, |
|
|
| name_l, |
|
|
| name_u, |
|
|
| r, |
|
|
| g, |
|
|
| b, |
|
|
| cgac, |
|
|
| cgad ) |
Value:
int8_t RETROFLAT_COLOR
Defines an index in the platform-specific color-table.
Definition retroflt.h:325
◆ RETROFLAT_FLAGS_KEY_REPEAT
#define RETROFLAT_FLAGS_KEY_REPEAT 0x04 |
|
related |
Flag indicating keyboard repeat is enabled.
- Warning
- This flag should only be set inside retroflat!
◆ RETROFLAT_FLAGS_RUNNING
#define RETROFLAT_FLAGS_RUNNING 0x01 |
|
related |
Flag indicating that retroflat_loop() should continue executing.
- Warning
- This flag is not used on all platforms! It should only be removed using retroflat_quit().
◆ RETROFLAT_FLAGS_SCREENSAVER
#define RETROFLAT_FLAGS_SCREENSAVER 0x08 |
|
related |
Flag indicating the current application is running as a screensaver.
- Warning
- This flag should only be set inside retroflat!
◆ RETROFLAT_FLAGS_UNLOCK_FPS
#define RETROFLAT_FLAGS_UNLOCK_FPS 0x02 |
|
related |
Flag indicating FPS should not be capped.
- Warning
- This flag should only be set inside retroflat!
◆ retroflat_heartbeat
#define retroflat_heartbeat |
( |
| ) |
|
|
related |
◆ retroflat_heartbeat_set
#define retroflat_heartbeat_set |
( |
| len, |
|
|
| max ) |
|
related |
◆ retroflat_heartbeat_update
#define retroflat_heartbeat_update |
( |
| ) |
|
|
related |
Value: \
if( g_retroflat_state->heartbeat_next <= retroflat_get_ms() ) { \
g_retroflat_state->heartbeat_frame++; \
if( \
g_retroflat_state->heartbeat_frame >= \
g_retroflat_state->heartbeat_max \
) { \
g_retroflat_state->heartbeat_frame = 0; \
} \
g_retroflat_state->heartbeat_next = \
retroflat_get_ms() + g_retroflat_state->heartbeat_len; \
}
Check and update RETROFLAT_STATE::heartbeat_frame. This should be called in the API HAL on every iteration of the main loop (this is done automatically in the generic main loop).
◆ retroflat_is_waiting_for_frame
#define retroflat_is_waiting_for_frame |
( |
| ) |
|
Value: (RETROFLAT_FLAGS_WAIT_FOR_FPS == \
(g_retroflat_state->retroflat_flags & RETROFLAT_FLAGS_WAIT_FOR_FPS))
◆ retroflat_on_resize
#define retroflat_on_resize |
( |
| w, |
|
|
| h ) |
Value: g_retroflat_state->screen_w = w; \
g_retroflat_state->screen_h = h;
◆ retroflat_wait_for_frame
#define retroflat_wait_for_frame |
( |
| ) |
|
Value: (g_retroflat_state->retroflat_flags |= RETROFLAT_FLAGS_WAIT_FOR_FPS)
◆ retroflat_pxxy_t
Type used for surface pixel coordinates.
- Todo
- Make this signed when most of the library uses it. Right now, it causes too many issues with passed references.
◆ retroflat_init()
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_set_proc_resize()
void retroflat_set_proc_resize |
( |
retroflat_proc_resize_t | on_resize_in, |
|
|
void * | data_in ) |
Set the procedure to call when the window is resized (on platforms that support resizing).
- Parameters
-
on_resize_in | Procedure to call when window is resized. |
data_in | Data to pass to on_resize_in. |
If this is not set, no procedure is called. Some platforms may stretch the "virtual" screen to fill the physical window.
◆ 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
-
retval | Return value from retroflat_init(), so we know what layers are in what state. |