summaryrefslogtreecommitdiff
path: root/src/xSDL.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2017-12-28 21:30:20 +0100
committerOlivier Gayot <duskcoder@gmail.com>2017-12-28 21:31:01 +0100
commit54f40f6cb863f00fbcaa77ebdb930d8d7fc6988d (patch)
tree0757b1da4f95b1096877fcbd101ef7edf923b4ce /src/xSDL.c
Imported the code into Git
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
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);
+}