[sdl2] minimal UI ported to sdl2, only LCD area displayed for now
This commit is contained in:
parent
6d36927849
commit
d8fdd2e467
7 changed files with 1615 additions and 40 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
src/*.o
|
src/*.o
|
||||||
src/tools/*.o
|
src/legacy_tools/*.o
|
||||||
|
|
||||||
dist/x48ng*
|
dist/x48ng*
|
||||||
|
|
11
Makefile
11
Makefile
|
@ -105,6 +105,17 @@ ifeq ($(WITH_X11), yes)
|
||||||
DOTOS += src/ui_x11.o
|
DOTOS += src/ui_x11.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
### SDL2 UI
|
||||||
|
ifeq ($(WITH_SDL2), yes)
|
||||||
|
WITH_SDL = no
|
||||||
|
SDLCFLAGS = $(shell "$(PKG_CONFIG)" --cflags sdl2)
|
||||||
|
SDLLIBS = $(shell "$(PKG_CONFIG)" --libs sdl2)
|
||||||
|
|
||||||
|
override CFLAGS += $(SDLCFLAGS) -DHAS_SDL2=1
|
||||||
|
LIBS += $(SDLLIBS)
|
||||||
|
DOTOS += src/ui_sdl2.o
|
||||||
|
endif
|
||||||
|
|
||||||
### SDL UI
|
### SDL UI
|
||||||
ifeq ($(WITH_SDL), yes)
|
ifeq ($(WITH_SDL), yes)
|
||||||
SDLCFLAGS = $(shell "$(PKG_CONFIG)" --cflags SDL_gfx sdl12_compat)
|
SDLCFLAGS = $(shell "$(PKG_CONFIG)" --cflags SDL_gfx sdl12_compat)
|
||||||
|
|
|
@ -278,6 +278,7 @@ int config_init( int argc, char* argv[] )
|
||||||
|
|
||||||
{"debug", no_argument, &clopt_useDebugger, true },
|
{"debug", no_argument, &clopt_useDebugger, true },
|
||||||
|
|
||||||
|
{"sdl2", no_argument, &clopt_frontend_type, FRONTEND_SDL2},
|
||||||
{"sdl", no_argument, &clopt_frontend_type, FRONTEND_SDL },
|
{"sdl", no_argument, &clopt_frontend_type, FRONTEND_SDL },
|
||||||
{"no-chrome", no_argument, &clopt_hide_chrome, true },
|
{"no-chrome", no_argument, &clopt_hide_chrome, true },
|
||||||
{"fullscreen", no_argument, &clopt_show_ui_fullscreen, true },
|
{"fullscreen", no_argument, &clopt_show_ui_fullscreen, true },
|
||||||
|
@ -327,6 +328,7 @@ int config_init( int argc, char* argv[] )
|
||||||
"%s)\n"
|
"%s)\n"
|
||||||
" -V --verbose be verbose (default: false)\n"
|
" -V --verbose be verbose (default: false)\n"
|
||||||
" --x11 use X11 front-end (default: true)\n"
|
" --x11 use X11 front-end (default: true)\n"
|
||||||
|
" --sdl2 use SDL2 front-end (default: false)\n"
|
||||||
" --sdl use SDL front-end (default: false)\n"
|
" --sdl use SDL front-end (default: false)\n"
|
||||||
" --tui use text front-end (default: false)\n"
|
" --tui use text front-end (default: false)\n"
|
||||||
" --tui-small use text small front-end (2×2 pixels per character) (default: "
|
" --tui-small use text small front-end (2×2 pixels per character) (default: "
|
||||||
|
@ -522,6 +524,8 @@ int config_init( int argc, char* argv[] )
|
||||||
lua_getglobal( config_lua_values, "frontend" );
|
lua_getglobal( config_lua_values, "frontend" );
|
||||||
#ifdef HAS_X11
|
#ifdef HAS_X11
|
||||||
# define DEFAULT_FRONTEND "x11"
|
# define DEFAULT_FRONTEND "x11"
|
||||||
|
#elif HAS_SDL2
|
||||||
|
# define DEFAULT_FRONTEND "sdl2"
|
||||||
#elif HAS_SDL
|
#elif HAS_SDL
|
||||||
# define DEFAULT_FRONTEND "sdl"
|
# define DEFAULT_FRONTEND "sdl"
|
||||||
#else
|
#else
|
||||||
|
@ -531,6 +535,8 @@ int config_init( int argc, char* argv[] )
|
||||||
if ( svalue != NULL ) {
|
if ( svalue != NULL ) {
|
||||||
if ( strcmp( svalue, "x11" ) == 0 )
|
if ( strcmp( svalue, "x11" ) == 0 )
|
||||||
config.frontend_type = FRONTEND_X11;
|
config.frontend_type = FRONTEND_X11;
|
||||||
|
if ( strcmp( svalue, "sdl2" ) == 0 )
|
||||||
|
config.frontend_type = FRONTEND_SDL2;
|
||||||
if ( strcmp( svalue, "sdl" ) == 0 )
|
if ( strcmp( svalue, "sdl" ) == 0 )
|
||||||
config.frontend_type = FRONTEND_SDL;
|
config.frontend_type = FRONTEND_SDL;
|
||||||
if ( strcmp( svalue, "tui" ) == 0 ) {
|
if ( strcmp( svalue, "tui" ) == 0 ) {
|
||||||
|
@ -691,6 +697,9 @@ int config_init( int argc, char* argv[] )
|
||||||
case FRONTEND_X11:
|
case FRONTEND_X11:
|
||||||
fprintf( stdout, "x11" );
|
fprintf( stdout, "x11" );
|
||||||
break;
|
break;
|
||||||
|
case FRONTEND_SDL2:
|
||||||
|
fprintf( stdout, "sdl2" );
|
||||||
|
break;
|
||||||
case FRONTEND_SDL:
|
case FRONTEND_SDL:
|
||||||
fprintf( stdout, "sdl" );
|
fprintf( stdout, "sdl" );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#define FRONTEND_SDL2 3
|
||||||
#define FRONTEND_SDL 0
|
#define FRONTEND_SDL 0
|
||||||
#define FRONTEND_X11 1
|
#define FRONTEND_X11 1
|
||||||
#define FRONTEND_TEXT 2
|
#define FRONTEND_TEXT 2
|
||||||
|
|
22
src/ui.c
22
src/ui.c
|
@ -2104,6 +2104,15 @@ void start_UI( int argc, char** argv )
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined( HAS_SDL2 )
|
||||||
|
case FRONTEND_SDL2:
|
||||||
|
# if !defined( HAS_X11 )
|
||||||
|
default:
|
||||||
|
# endif
|
||||||
|
init_sdl2_ui( argc, argv );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined( HAS_SDL )
|
#if defined( HAS_SDL )
|
||||||
case FRONTEND_SDL:
|
case FRONTEND_SDL:
|
||||||
# if !defined( HAS_X11 )
|
# if !defined( HAS_X11 )
|
||||||
|
@ -2114,7 +2123,7 @@ void start_UI( int argc, char** argv )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case FRONTEND_TEXT:
|
case FRONTEND_TEXT:
|
||||||
#if ( !defined( HAS_X11 ) && !defined( HAS_SDL ) )
|
#if ( !defined( HAS_X11 ) && !defined( HAS_SDL2 ) && !defined( HAS_SDL ) )
|
||||||
default:
|
default:
|
||||||
#endif
|
#endif
|
||||||
init_text_ui( argc, argv );
|
init_text_ui( argc, argv );
|
||||||
|
@ -2132,6 +2141,15 @@ void ui_stop( void )
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined( HAS_SDL2 )
|
||||||
|
case FRONTEND_SDL2:
|
||||||
|
# if !defined( HAS_X11 )
|
||||||
|
default:
|
||||||
|
# endif
|
||||||
|
sdl2_ui_stop();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined( HAS_SDL )
|
#if defined( HAS_SDL )
|
||||||
case FRONTEND_SDL:
|
case FRONTEND_SDL:
|
||||||
# if !defined( HAS_X11 )
|
# if !defined( HAS_X11 )
|
||||||
|
@ -2142,7 +2160,7 @@ void ui_stop( void )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case FRONTEND_TEXT:
|
case FRONTEND_TEXT:
|
||||||
#if ( !defined( HAS_X11 ) && !defined( HAS_SDL ) )
|
#if ( !defined( HAS_X11 ) && !defined( HAS_SDL2 ) && !defined( HAS_SDL ) )
|
||||||
default:
|
default:
|
||||||
#endif
|
#endif
|
||||||
text_ui_stop();
|
text_ui_stop();
|
||||||
|
|
5
src/ui.h
5
src/ui.h
|
@ -21,6 +21,11 @@ extern void init_x11_ui( int argc, char** argv );
|
||||||
extern void x11_ui_stop( void );
|
extern void x11_ui_stop( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_SDL2
|
||||||
|
extern void init_sdl2_ui( int argc, char** argv );
|
||||||
|
extern void sdl2_ui_stop( void );
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SDL
|
#ifdef HAS_SDL
|
||||||
extern void init_sdl_ui( int argc, char** argv );
|
extern void init_sdl_ui( int argc, char** argv );
|
||||||
extern void sdl_ui_stop( void );
|
extern void sdl_ui_stop( void );
|
||||||
|
|
1531
src/ui_sdl2.c
Normal file
1531
src/ui_sdl2.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue