From 54f40f6cb863f00fbcaa77ebdb930d8d7fc6988d Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 28 Dec 2017 21:30:20 +0100 Subject: Imported the code into Git Signed-off-by: Olivier Gayot --- src/xSDL.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/xSDL.c (limited to 'src/xSDL.c') diff --git a/src/xSDL.c b/src/xSDL.c new file mode 100644 index 0000000..3ee36cb --- /dev/null +++ b/src/xSDL.c @@ -0,0 +1,35 @@ +/* +** xSDL.c for in /home/gayot_o/prog/minesweeper/src +** +** Made by olivier gayot +** Login +** +** Started on Wed Apr 25 23:40:24 2012 olivier gayot +** Last update Wed Apr 25 23:40:24 2012 olivier gayot +*/ + +#include "minesweeper.h" + +int xSDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dest, SDL_Rect *dstrect) { + int ret; + if (dest != scr) + ret = SDL_BlitSurface(src, srcrect, dest, dstrect); + else + { + if (SDL_mutexP(mutex) == -1) + fprintf(stderr, "Error during SDL_mutexP: %s\n", SDL_GetError()); + ret = SDL_BlitSurface(src, srcrect, dest, dstrect); + if (SDL_mutexV(mutex) == -1) + fprintf(stderr, "Error during SDL_mutexV: %s\n", SDL_GetError()); + } + return (ret); +} + +void xSDL_Flip(SDL_Surface *surf) { + if (surf == scr) + SDL_mutexP(mutex); + SDL_Flip(surf); + if (surf == scr) + SDL_mutexV(mutex); +} -- cgit v1.2.3