1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * ©1995 Artsoft Development *
6 * 33659 Bielefeld-Senne *
7 * Telefon: (0521) 493245 *
8 * eMail: aeglos@valinor.owl.de *
9 * aeglos@uni-paderborn.de *
10 * q99492@pbhrzx.uni-paderborn.de *
11 *----------------------------------------------------------*
13 ***********************************************************/
15 #ifdef USE_SDL_LIBRARY
20 inline void SDLCopyArea(SDL_Surface *src_surface, SDL_Surface *dst_surface,
22 int width, int height,
25 SDL_Surface *surface = (dst_surface == window ? backbuffer : dst_surface);
26 SDL_Rect src_rect, dst_rect;
38 if (src_surface != backbuffer || dst_surface != window)
39 SDL_BlitSurface(src_surface, &src_rect, surface, &dst_rect);
41 if (dst_surface == window)
42 SDL_UpdateRect(backbuffer, dst_x, dst_y, width, height);
45 inline void SDLFillRectangle(SDL_Surface *dst_surface, int x, int y,
46 int width, int height, unsigned int color)
48 SDL_Surface *surface = (dst_surface == window ? backbuffer : dst_surface);
50 unsigned int color_r = (color >> 16) && 0xff;
51 unsigned int color_g = (color >> 8) && 0xff;
52 unsigned int color_b = (color >> 0) && 0xff;
59 SDL_FillRect(surface, &rect,
60 SDL_MapRGB(surface->format, color_r, color_g, color_b));
62 if (dst_surface == window)
63 SDL_UpdateRect(backbuffer, x, y, width, height);
66 inline void SDLDrawSimpleLine(SDL_Surface *surface, int from_x, int from_y,
67 int to_x, int to_y, unsigned int color)
70 unsigned int color_r = (color >> 16) & 0xff;
71 unsigned int color_g = (color >> 8) & 0xff;
72 unsigned int color_b = (color >> 0) & 0xff;
75 swap_numbers(&from_x, &to_x);
78 swap_numbers(&from_y, &to_y);
82 rect.w = (to_x - from_x + 1);
83 rect.h = (to_y - from_y + 1);
85 SDL_FillRect(surface, &rect,
86 SDL_MapRGB(surface->format, color_r, color_g, color_b));
89 #endif /* USE_SDL_LIBRARY */