diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-28 15:26:29 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-28 15:26:29 +0200 |
commit | e7da86053b3df2882816b0df8089e1a51b61939f (patch) | |
tree | 8f7430f7d1e82ddb8449548886f57a3a7c646c05 /src/osc_graphics.h | |
parent | 9b134ea457f91ba8ea6ae558c9192f58c09f62bc (diff) | |
download | osc-graphics-e7da86053b3df2882816b0df8089e1a51b61939f.tar.gz |
autotools based build system
Diffstat (limited to 'src/osc_graphics.h')
-rw-r--r-- | src/osc_graphics.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/osc_graphics.h b/src/osc_graphics.h new file mode 100644 index 0000000..2a08678 --- /dev/null +++ b/src/osc_graphics.h @@ -0,0 +1,46 @@ +#ifndef __OSC_GRAPHICS_H +#define __OSC_GRAPHICS_H + +#include <stdio.h> + +#include <SDL.h> + +#include "osc_server.h" +#include "layer.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; + +extern int config_dump_osc; + +#endif |