plat_sdl_screen in RGBSurface, removed debug on screen

This commit is contained in:
Vincent-FK 2021-04-01 22:39:53 +02:00
parent d57c999220
commit 0731283a9f
2 changed files with 36 additions and 9 deletions

11
menu.c
View File

@ -162,8 +162,14 @@ void text_out16(int x, int y, const char *texto, ...)
}
/* draws in 6x8 font, might multiply size by integer */
//#define ALLOW_TEXT_OUT
static void smalltext_out16_(int x, int y, const char *texto, int color)
{
#ifndef ALLOW_TEXT_OUT
return;
#endif //ALLOW_TEXT_OUT
unsigned char *src;
unsigned short *dst;
int multiplier = me_sfont_w / 6;
@ -202,6 +208,11 @@ static void smalltext_out16_(int x, int y, const char *texto, int color)
static void smalltext_out16(int x, int y, const char *texto, int color)
{
#ifndef ALLOW_TEXT_OUT
return;
#endif //ALLOW_TEXT_OUT
char buffer[128];
int maxw = (g_menuscreen_w - x) / me_sfont_w;

View File

@ -90,7 +90,12 @@ int plat_sdl_change_video_mode(int w, int h, int force)
// (seen on r-pi)
SDL_PumpEvents();
plat_sdl_screen = SDL_SetVideoMode(win_w, win_h, 0, flags);
//plat_sdl_screen = SDL_SetVideoMode(win_w, win_h, 0, flags);
if (plat_sdl_screen)
SDL_FreeSurface(plat_sdl_screen);
printf("Creating plat_sdl_screen surface: win_w=%d, win_h=%d\n", win_w, win_h);
plat_sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
win_w, win_h, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
if (plat_sdl_screen == NULL) {
fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
plat_target.vout_method = 0;
@ -123,13 +128,12 @@ int plat_sdl_change_video_mode(int w, int h, int force)
if (plat_target.vout_method == 0) {
SDL_PumpEvents();
#if defined SDL_SURFACE_SW
plat_sdl_screen = SDL_SetVideoMode(w, h, 16, SDL_SWSURFACE);
#elif defined(SDL_TRIPLEBUF) && defined(SDL_BUFFER_3X)
plat_sdl_screen = SDL_SetVideoMode(w, h, 16, SDL_HWSURFACE | SDL_TRIPLEBUF);
#else
plat_sdl_screen = SDL_SetVideoMode(w, h, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
#endif
//plat_sdl_screen = SDL_SetVideoMode(w, h, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
if (plat_sdl_screen)
SDL_FreeSurface(plat_sdl_screen);
printf("Creating plat_sdl_screen surface: w=%d, h=%d\n", w, h);
plat_sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
w, h, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
if (plat_sdl_screen == NULL) {
fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
return -1;
@ -198,6 +202,8 @@ int plat_sdl_init(void)
return -1;
}
SDL_ShowCursor(0);
info = SDL_GetVideoInfo();
if (info != NULL) {
fs_w = info->current_w;
@ -219,7 +225,12 @@ int plat_sdl_init(void)
ret = plat_sdl_change_video_mode(g_menuscreen_w, g_menuscreen_h, 1);
if (ret != 0) {
plat_sdl_screen = SDL_SetVideoMode(0, 0, 16, SDL_SWSURFACE);
//plat_sdl_screen = SDL_SetVideoMode(0, 0, 16, SDL_SWSURFACE);
if (plat_sdl_screen)
SDL_FreeSurface(plat_sdl_screen);
printf("Creating plat_sdl_screen surface: w=%d, h=%d\n", 0, 0);
plat_sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
0, 0, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
if (plat_sdl_screen == NULL) {
fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
goto fail;
@ -237,6 +248,11 @@ int plat_sdl_init(void)
// overlay/gl require native bpp in some cases..
plat_sdl_screen = SDL_SetVideoMode(g_menuscreen_w, g_menuscreen_h,
0, plat_sdl_screen->flags);
if (plat_sdl_screen)
SDL_FreeSurface(plat_sdl_screen);
printf("Creating plat_sdl_screen surface: g_menuscreen_w=%d, g_menuscreen_h=%d\n", g_menuscreen_w, g_menuscreen_h);
plat_sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
g_menuscreen_w, g_menuscreen_h, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
if (plat_sdl_screen == NULL) {
fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
goto fail;