# EXT = pcx
EXT = png
-FILES = RocksBusy.$(EXT) \
- RocksDC.$(EXT) \
- RocksDC2.$(EXT) \
- RocksDoor.$(EXT) \
- RocksDoor2.$(EXT) \
- RocksEMC.$(EXT) \
- RocksElements.$(EXT) \
- RocksFontBig.$(EXT) \
- RocksFontDC.$(EXT) \
- RocksFontEM.$(EXT) \
- RocksFontMedium.$(EXT) \
- RocksFontSmall.$(EXT) \
- RocksHeroes.$(EXT) \
- RocksMore.$(EXT) \
- RocksSP.$(EXT) \
- RocksScreen.$(EXT) \
- RocksToons.$(EXT) \
- \
- RocksCE.$(EXT) # dynamically generated from template
+FILES = RocksBusy.$(EXT) \
+ RocksDC.$(EXT) \
+ RocksDC2.$(EXT) \
+ RocksDoor.$(EXT) \
+ RocksDoor2.$(EXT) \
+ RocksEMC.$(EXT) \
+ RocksElements.$(EXT) \
+ RocksFontBig.$(EXT) \
+ RocksFontDC.$(EXT) \
+ RocksFontEM.$(EXT) \
+ RocksFontMedium.$(EXT) \
+ RocksFontSmall.$(EXT) \
+ RocksHeroes.$(EXT) \
+ RocksMore.$(EXT) \
+ RocksSP.$(EXT) \
+ RocksScreen.$(EXT) \
+ RocksToons.$(EXT) \
+ overlay/VirtualButtons.$(EXT) \
+ \
+ RocksCE.$(EXT) # dynamically generated from template
# -----------------------------------------------------------------------------
InitVideoDisplay();
InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
+ InitOverlayInfo();
+
print_timestamp_time("[init video stuff]");
InitElementPropertiesStatic();
/* functions from SGE library */
void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
+/* functions to draw overlay graphics for touch device input */
+static void DrawTouchInputOverlay();
+
void SDLLimitScreenUpdates(boolean enable)
{
limit_screen_updates = enable;
SDL_SetRenderTarget(sdl_renderer, NULL);
SDL_RenderCopy(sdl_renderer, sdl_texture_target, src_rect2, dst_rect2);
}
+
+ // draw overlay graphics for touch device input, if needed
+ DrawTouchInputOverlay();
#endif
// global synchronization point of the game to align video frame delay
video.screen_xoffset = 0;
video.screen_yoffset = 0;
-#if defined(PLATFORM_ANDROID)
+#if defined(USE_COMPLETE_DISPLAY)
float ratio_video = (float) width / height;
float ratio_display = (float) video.display_width / video.display_height;
return TRUE;
}
+
+static void DrawTouchInputOverlay()
+{
+#if defined(USE_TOUCH_INPUT_OVERLAY)
+ static SDL_Texture *texture = NULL;
+ static boolean initialized = FALSE;
+ static boolean deactivated = TRUE;
+ static int width = 0, height = 0;
+ static int alpha_max = SDL_ALPHA_OPAQUE / 2;
+ static int alpha_step = 5;
+ static int alpha_last = 0;
+ static int alpha = 0;
+
+ if (!overlay.active && deactivated)
+ return;
+
+ if (overlay.active)
+ {
+ if (alpha < alpha_max)
+ alpha = MIN(alpha + alpha_step, alpha_max);
+
+ deactivated = FALSE;
+ }
+ else
+ {
+ alpha = MAX(0, alpha - alpha_step);
+
+ if (alpha == 0)
+ deactivated = TRUE;
+ }
+
+ if (!initialized)
+ {
+ char *basename = "overlay/VirtualButtons.png";
+ char *filename = getCustomImageFilename(basename);
+
+ if (filename == NULL)
+ Error(ERR_EXIT, "LoadCustomImage(): cannot find file '%s'", basename);
+
+ SDL_Surface *surface;
+
+ if ((surface = IMG_Load(filename)) == NULL)
+ Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
+
+ width = surface->w;
+ height = surface->h;
+
+ /* set black pixel to transparent if no alpha channel / transparent color */
+ if (!SDLHasAlpha(surface) &&
+ !SDLHasColorKey(surface))
+ SDL_SetColorKey(surface, SET_TRANSPARENT_PIXEL,
+ SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
+
+ if ((texture = SDLCreateTextureFromSurface(surface)) == NULL)
+ Error(ERR_EXIT, "SDLCreateTextureFromSurface() failed");
+
+ SDL_FreeSurface(surface);
+
+ SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
+ SDL_SetTextureAlphaMod(texture, alpha_max);
+
+ initialized = TRUE;
+ }
+
+ if (alpha != alpha_last)
+ SDL_SetTextureAlphaMod(texture, alpha);
+
+ alpha_last = alpha;
+
+ SDL_Rect src_rect = { 0, 0, width, height };
+ SDL_Rect dst_rect = { 0, 0, video.screen_width, video.screen_height };
+
+ SDL_RenderCopy(sdl_renderer, texture, &src_rect, &dst_rect);
+#endif
+}
struct VideoSystemInfo video;
struct AudioSystemInfo audio;
struct GfxInfo gfx;
+struct OverlayInfo overlay;
struct ArtworkInfo artwork;
struct JoystickInfo joystick;
struct SetupInfo setup;
gfx.cursor_mode = CURSOR_DEFAULT;
}
+void InitOverlayInfo()
+{
+ overlay.active = FALSE;
+}
+
+void SetOverlayActive(boolean active)
+{
+ overlay.active = active;
+}
+
+boolean GetOverlayActive()
+{
+ return overlay.active;
+}
+
void SetDrawDeactivationMask(int draw_deactivation_mask)
{
gfx.draw_deactivation_mask = draw_deactivation_mask;
#define TOUCH_DROP_DISTANCE_DEFAULT 5
-/* values for screen keyboard on mobile devices */
+/* values for special settings for mobile devices */
#if defined(PLATFORM_ANDROID)
+#define USE_TOUCH_INPUT_OVERLAY
+#define USE_COMPLETE_DISPLAY
#define HAS_SCREEN_KEYBOARD
#define SCREEN_KEYBOARD_POS(h) ((h) / 2)
#endif
int cursor_mode;
};
+struct OverlayInfo
+{
+ boolean active;
+};
+
struct JoystickInfo
{
int status;
extern struct VideoSystemInfo video;
extern struct AudioSystemInfo audio;
extern struct GfxInfo gfx;
+extern struct OverlayInfo overlay;
extern struct AnimInfo anim;
extern struct ArtworkInfo artwork;
extern struct JoystickInfo joystick;
void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int));
void InitGfxCustomArtworkInfo();
void InitGfxOtherSettings();
+void InitOverlayInfo();
+void SetOverlayActive(boolean);
+boolean GetOverlayActive();
void SetDrawDeactivationMask(int);
void SetDrawBackgroundMask(int);
void SetWindowBackgroundBitmap(Bitmap *);
FADE_SXSIZE = FULL_SXSIZE;
FADE_SYSIZE = FULL_SYSIZE;
+ if (game_status == GAME_MODE_PLAYING &&
+ strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS))
+ SetOverlayActive(TRUE);
+
SetScreenStates_AfterFadingIn();
// force update of global animation status in case of rapid screen changes
SetScreenStates_BeforeFadingOut();
+ SetOverlayActive(FALSE);
+
#if 0
DrawMaskedBorder(REDRAW_ALL);
#endif
boolean Request(char *text, unsigned int req_state)
{
+ boolean overlay_active = GetOverlayActive();
+ boolean result;
+
+ SetOverlayActive(FALSE);
+
if (global.use_envelope_request)
- return RequestEnvelope(text, req_state);
+ result = RequestEnvelope(text, req_state);
else
- return RequestDoor(text, req_state);
+ result = RequestDoor(text, req_state);
+
+ SetOverlayActive(overlay_active);
+
+ return result;
}
static int compareDoorPartOrderInfo(const void *object1, const void *object2)