// copy tile selection cursor to render target buffer, if defined (above all)
if (gfx.draw_tile_cursor_function != NULL)
gfx.draw_tile_cursor_function(draw_target);
+
+ // copy global animations to render target buffer, if defined (mouse pointer)
+ if (gfx.draw_global_anim_function != NULL)
+ gfx.draw_global_anim_function(draw_target, DRAW_GLOBAL_ANIM_STAGE_3);
}
static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay)
{
+ if (program.headless)
+ return;
+
static DelayCounter update_screen_delay = { 50 }; // (milliseconds)
SDL_Surface *screen = backbuffer->surface;
if (sdl_window)
{
- SDL_DestroyWindow(sdl_window);
- sdl_window = NULL;
+ SDL_SetWindowSize(sdl_window, video.window_width, video.window_height);
}
}
case 1:
{
// Assuming 8-bpp
- *((Uint8 *)surface->pixels + y*surface->pitch + x) = color;
+ *((Uint8 *)surface->pixels + y * surface->pitch + x) = color;
}
break;
case 2:
{
// Probably 15-bpp or 16-bpp
- *((Uint16 *)surface->pixels + y*surface->pitch/2 + x) = color;
+ *((Uint16 *)surface->pixels + y * surface->pitch / 2 + x) = color;
}
break;
int shift;
// Gack - slow, but endian correct
- pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3;
+ pix = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
shift = surface->format->Rshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
shift = surface->format->Gshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
shift = surface->format->Bshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
}
break;
case 4:
{
// Probably 32-bpp
- *((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color;
+ *((Uint32 *)surface->pixels + y * surface->pitch / 4 + x) = color;
}
break;
}
static void _PutPixel8(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color)
{
- *((Uint8 *)surface->pixels + y*surface->pitch + x) = color;
+ *((Uint8 *)surface->pixels + y * surface->pitch + x) = color;
}
static void _PutPixel16(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color)
{
- *((Uint16 *)surface->pixels + y*surface->pitch/2 + x) = color;
+ *((Uint16 *)surface->pixels + y * surface->pitch / 2 + x) = color;
}
static void _PutPixel24(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color)
int shift;
// Gack - slow, but endian correct
- pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3;
+ pix = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
shift = surface->format->Rshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
shift = surface->format->Gshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
shift = surface->format->Bshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
}
static void _PutPixel32(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color)
{
- *((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color;
+ *((Uint32 *)surface->pixels + y * surface->pitch / 4 + x) = color;
}
-static void _PutPixelX(SDL_Surface *dest,Sint16 x,Sint16 y,Uint32 color)
+static void _PutPixelX(SDL_Surface *dest, Sint16 x, Sint16 y, Uint32 color)
{
switch (dest->format->BytesPerPixel)
{
case 1:
- *((Uint8 *)dest->pixels + y*dest->pitch + x) = color;
+ *((Uint8 *)dest->pixels + y * dest->pitch + x) = color;
break;
case 2:
- *((Uint16 *)dest->pixels + y*dest->pitch/2 + x) = color;
+ *((Uint16 *)dest->pixels + y * dest->pitch / 2 + x) = color;
break;
case 3:
- _PutPixel24(dest,x,y,color);
+ _PutPixel24(dest, x, y, color);
break;
case 4:
- *((Uint32 *)dest->pixels + y*dest->pitch/4 + x) = color;
+ *((Uint32 *)dest->pixels + y * dest->pitch / 4 + x) = color;
break;
}
}
switch (dest->format->BytesPerPixel)
{
case 1:
- return y*dest->pitch;
+ return y * dest->pitch;
break;
case 2:
- return y*dest->pitch/2;
+ return y * dest->pitch / 2;
break;
case 3:
- return y*dest->pitch;
+ return y * dest->pitch;
break;
case 4:
- return y*dest->pitch/4;
+ return y * dest->pitch / 4;
break;
}
}
int shift;
// Gack - slow, but endian correct
- pix = (Uint8 *)surface->pixels + ypitch + x*3;
+ pix = (Uint8 *)surface->pixels + ypitch + x * 3;
shift = surface->format->Rshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
shift = surface->format->Gshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
shift = surface->format->Bshift;
- *(pix+shift/8) = color>>shift;
+ *(pix + shift / 8) = color>>shift;
}
break;
// quick (no, it's slow) and dirty hack to "invert" rectangle inside SDL surface
// ----------------------------------------------------------------------------
-void SDLInvertArea(Bitmap *bitmap, int src_x, int src_y,
- int width, int height, Uint32 color)
-{
- int x, y;
-
- for (y = src_y; y < src_y + height; y++)
- {
- for (x = src_x; x < src_x + width; x++)
- {
- Uint32 pixel = SDLGetPixel(bitmap, x, y);
-
- SDLPutPixel(bitmap, x, y, pixel == BLACK_PIXEL ? color : BLACK_PIXEL);
- }
- }
-}
-
void SDLCopyInverseMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
int src_x, int src_y, int width, int height,
int dst_x, int dst_y)