summaryrefslogtreecommitdiff
path: root/src/xSDL.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xSDL.c')
-rw-r--r--src/xSDL.c35
1 files changed, 35 insertions, 0 deletions
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 <gayot_o@epitech.net>
+**
+** 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);
+}