{ KSYM_Page_Up, "XK_Page_Up", "page up" },
{ KSYM_Page_Down, "XK_Page_Down", "page down" },
+#if defined(TARGET_SDL2)
{ KSYM_Menu, "XK_Menu", "menu" }, /* menu key */
{ KSYM_Back, "XK_Back", "back" }, /* back key */
+#endif
/* ASCII 0x20 to 0x40 keys (except numbers) */
{ KSYM_space, "XK_space", "space" },
if (file == NULL)
return -1;
- int result;
+ int result = 0;
#if defined(PLATFORM_ANDROID)
if (file->asset_file)
if (dir == NULL)
return -1;
- int result;
+ int result = 0;
#if defined(PLATFORM_ANDROID)
if (dir->asset_toc_file)
}
}
+#endif /* DEBUG */
+
void print_timestamp_ext(char *message, char *mode)
{
#if DEBUG_PRINT_INIT_TIMESTAMPS
{
print_timestamp_ext(message, "DONE");
}
-
-#endif /* DEBUG */
static SDL_Window *sdl_window = NULL;
static SDL_Renderer *sdl_renderer = NULL;
static SDL_Texture *sdl_texture = NULL;
+
+#define USE_RENDERER 1
#endif
/* stuff needed to work around SDL/Windows fullscreen drawing bug */
/* functions from SGE library */
void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
+#if defined(TARGET_SDL2)
static void UpdateScreen(SDL_Rect *rect)
{
-#if 1
+#if USE_RENDERER
SDL_Surface *screen = backbuffer->surface;
+#if 1
+ if (rect)
+ {
+ int bytes_x = screen->pitch / video.width;
+ int bytes_y = screen->pitch;
+
+ SDL_UpdateTexture(sdl_texture, rect,
+ screen->pixels + rect->x * bytes_x + rect->y * bytes_y,
+ screen->pitch);
+ }
+ else
+ {
+ SDL_UpdateTexture(sdl_texture, NULL, screen->pixels, screen->pitch);
+ }
+#else
SDL_UpdateTexture(sdl_texture, NULL, screen->pixels, screen->pitch);
+#endif
SDL_RenderClear(sdl_renderer);
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
SDL_RenderPresent(sdl_renderer);
SDL_UpdateWindowSurface(sdl_window);
#endif
}
+#endif
static void setFullscreenParameters(char *fullscreen_mode_string)
{
new_surface = SDL_GetWindowSurface(sdl_window);
// SDL_UpdateWindowSurface(sdl_window); // immediately map window
- UpdateScreen(NULL); // immediately map window
+ // UpdateScreen(NULL); // immediately map window
}
#else
new_surface = SDL_SetVideoMode(fullscreen_width, fullscreen_height,
/* switch display to window mode */
#if defined(TARGET_SDL2)
-#if 1
- float scale_factor = 1;
+#if USE_RENDERER
+ float scale_factor = 1.2;
int test_fullscreen = 0;
int surface_flags = (test_fullscreen ? surface_flags_fullscreen :
surface_flags_window);
if (sdl_texture != NULL)
{
+#if 1
+ // (do not use alpha channel)
+ new_surface = SDL_CreateRGBSurface(0, video.width, video.height, 32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ 0x00000000);
+#else
+ // (this uses an alpha channel, which we don't want here)
new_surface = SDL_CreateRGBSurface(0, video.width, video.height, 32,
0x00FF0000,
0x0000FF00,
0x000000FF,
0xFF000000);
+#endif
+
+ printf("::: pitch == %d\n", new_surface->pitch);
if (new_surface == NULL)
Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s",
new_surface = SDL_GetWindowSurface(sdl_window);
// SDL_UpdateWindowSurface(sdl_window); // immediately map window
- UpdateScreen(NULL); // immediately map window
+ // UpdateScreen(NULL); // immediately map window
}
#endif
}
}
+#if defined(TARGET_SDL2)
+ UpdateScreen(NULL); // map window
+#endif
+
#if 1
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
dst_rect.w = width;
dst_rect.h = height;
- if (src_bitmap != backbuffer || dst_bitmap != window)
+ // if (src_bitmap != backbuffer || dst_bitmap != window)
+ if (!(src_bitmap == backbuffer && dst_bitmap == window))
SDL_BlitSurface((mask_mode == BLIT_MASKED ?
src_bitmap->surface_masked : src_bitmap->surface),
&src_rect, real_dst_bitmap->surface, &dst_rect);
void PlaySound(int nr)
{
+ if (!setup.sound_simple)
+ return;
+
PlaySoundExt(nr, SOUND_MAX_VOLUME, SOUND_MIDDLE, SND_CTRL_PLAY_SOUND);
}
void PlaySoundStereo(int nr, int stereo_position)
{
+ if (!setup.sound_simple)
+ return;
+
PlaySoundExt(nr, SOUND_MAX_VOLUME, stereo_position, SND_CTRL_PLAY_SOUND);
}
void PlaySoundLoop(int nr)
{
+ if (!setup.sound_loops)
+ return;
+
PlaySoundExt(nr, SOUND_MAX_VOLUME, SOUND_MIDDLE, SND_CTRL_PLAY_LOOP);
}
void PlaySoundMusic(int nr)
{
+ if (!setup.sound_music)
+ return;
+
PlaySoundExt(nr, SOUND_MAX_VOLUME, SOUND_MIDDLE, SND_CTRL_PLAY_MUSIC);
}