aboutsummaryrefslogtreecommitdiff
path: root/osc_graphics.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-21 18:24:57 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-21 18:24:57 +0200
commit75667b81215bdb3896599ec477a256c41fc90436 (patch)
tree44eb5919b596666997b972fc75fe5fdea60a633b /osc_graphics.h
parent0e81cd9a89de9bdd6824bbe7265f91f3835dae97 (diff)
downloadosc-graphics-75667b81215bdb3896599ec477a256c41fc90436.tar.gz
split program into multiple files; switched to C++
Diffstat (limited to 'osc_graphics.h')
-rw-r--r--osc_graphics.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/osc_graphics.h b/osc_graphics.h
new file mode 100644
index 0000000..ab40fb5
--- /dev/null
+++ b/osc_graphics.h
@@ -0,0 +1,41 @@
+#ifndef __HAVE_OSC_GRAPHICS_H
+#define __HAVE_OSC_GRAPHICS_H
+
+#include <stdio.h>
+
+#include <SDL.h>
+
+/*
+ * Macros
+ */
+#define NARRAY(ARRAY) \
+ (sizeof(ARRAY) / sizeof((ARRAY)[0]))
+
+#define SDL_MAYBE_LOCK(SURFACE) do { \
+ if (SDL_MUSTLOCK(SURFACE)) \
+ SDL_LockSurface(SURFACE); \
+} while (0)
+
+#define SDL_MAYBE_UNLOCK(SURFACE) do { \
+ if (SDL_MUSTLOCK(SURFACE)) \
+ SDL_UnlockSurface(SURFACE); \
+} while (0)
+
+#define SDL_FREESURFACE_SAFE(SURFACE) do { \
+ if (SURFACE) { \
+ SDL_FreeSurface(SURFACE); \
+ SURFACE = NULL; \
+ } \
+} while (0)
+
+#define SDL_ERROR(FMT, ...) do { \
+ fprintf(stderr, "%s(%d): " FMT ": %s\n", \
+ __FILE__, __LINE__, ##__VA_ARGS__, SDL_GetError()); \
+} while (0)
+
+/*
+ * Declarations
+ */
+extern SDL_Surface *screen;
+
+#endif \ No newline at end of file