refactor setup_frontend()

This commit is contained in:
Gwenhael Le Moine 2023-09-18 16:45:43 +02:00
parent e2b815c5ff
commit a6fa514d3d
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 30 additions and 24 deletions

View file

@ -38,30 +38,7 @@ int main( int argc, char** argv ) {
/**********/
parse_args( argc, argv );
switch ( frontend_type ) {
case FRONTEND_SDL:
ui__disp_draw_nibble = ui_sdl__disp_draw_nibble;
ui__menu_draw_nibble = ui_sdl__menu_draw_nibble;
ui__get_event = ui_sdl__get_event;
ui__update_LCD = ui_sdl__update_LCD;
ui__adjust_contrast = ui_sdl__adjust_contrast;
ui__draw_annunc = ui_sdl__draw_annunc;
ui__init_LCD = ui_sdl__init_LCD;
init_ui = init_sdl_ui;
break;
case FRONTEND_X11:
default:
ui__disp_draw_nibble = ui_x11__disp_draw_nibble;
ui__menu_draw_nibble = ui_x11__menu_draw_nibble;
ui__get_event = ui_x11__get_event;
ui__update_LCD = ui_x11__update_LCD;
ui__adjust_contrast = ui_x11__adjust_contrast;
ui__draw_annunc = ui_x11__draw_annunc;
ui__init_LCD = ui_x11__init_LCD;
init_ui = init_x11_ui;
break;
}
setup_frontend();
/*****************************************/
/* handlers for SIGALRM, SIGPIPE */

View file

@ -1,4 +1,5 @@
#include "ui.h"
#include "runtime_options.h"
void ( *ui__disp_draw_nibble )( word_20 addr, word_4 val );
void ( *ui__menu_draw_nibble )( word_20 addr, word_4 val );
@ -8,3 +9,30 @@ void ( *ui__adjust_contrast )( void );
void ( *ui__draw_annunc )( void );
void ( *ui__init_LCD )( void );
void ( *init_ui )( int argc, char** argv );
void setup_frontend( void ) {
switch ( frontend_type ) {
case FRONTEND_SDL:
ui__disp_draw_nibble = ui_sdl__disp_draw_nibble;
ui__menu_draw_nibble = ui_sdl__menu_draw_nibble;
ui__get_event = ui_sdl__get_event;
ui__update_LCD = ui_sdl__update_LCD;
ui__adjust_contrast = ui_sdl__adjust_contrast;
ui__draw_annunc = ui_sdl__draw_annunc;
ui__init_LCD = ui_sdl__init_LCD;
init_ui = init_sdl_ui;
break;
case FRONTEND_X11:
default:
ui__disp_draw_nibble = ui_x11__disp_draw_nibble;
ui__menu_draw_nibble = ui_x11__menu_draw_nibble;
ui__get_event = ui_x11__get_event;
ui__update_LCD = ui_x11__update_LCD;
ui__adjust_contrast = ui_x11__adjust_contrast;
ui__draw_annunc = ui_x11__draw_annunc;
ui__init_LCD = ui_x11__init_LCD;
init_ui = init_x11_ui;
break;
}
}

View file

@ -65,4 +65,5 @@ extern void ( *ui__init_LCD )( void );
/*******************/
extern void ( *init_ui )( int argc, char** argv );
extern void setup_frontend( void );
#endif /* !_X48_GUI_H */