#ifdef USE_SDL_LIBRARY
#include "main.h"
+#include "misc.h"
inline void SDLCopyArea(SDL_Surface *src_surface, SDL_Surface *dst_surface,
int src_x, int src_y,
dst_rect.h = height;
SDL_BlitSurface(src_surface, &src_rect, dst_surface, &dst_rect);
- SDL_UpdateRect(dst_surface, dst_x, dst_y, width, height);
+
+ if (dst_surface == window)
+ SDL_UpdateRect(dst_surface, dst_x, dst_y, width, height);
}
inline void SDLFillRectangle(SDL_Surface *surface, int x, int y,
rect.w = width;
rect.h = height;
+ SDL_FillRect(surface, &rect,
+ SDL_MapRGB(surface->format, color_r, color_g, color_b));
+ SDL_UpdateRect(surface, x, y, width, height);
+}
+
+inline void SDLDrawSimpleLine(SDL_Surface *surface, int from_x, int from_y,
+ int to_x, int to_y, unsigned int color)
+{
+ SDL_Rect rect;
+ unsigned int color_r = (color >> 2) & 0xff;
+ unsigned int color_g = (color >> 1) & 0xff;
+ unsigned int color_b = (color >> 0) & 0xff;
+
+ if (from_x > to_x)
+ swap_numbers(&from_x, &to_x);
+
+ if (from_y > to_y)
+ swap_numbers(&from_y, &to_y);
+
+ rect.x = from_x;
+ rect.y = from_y;
+ rect.w = (to_x - from_x + 1);
+ rect.h = (to_y - from_y + 1);
+
SDL_FillRect(surface, &rect,
SDL_MapRGB(surface->format, color_r, color_g, color_b));
}