Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __sdl_gen_h
- #define __sdl_gen_h
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <SDL/SDL.h>
- #define True (1)
- #define False (0)
- typedef char s8;
- typedef unsigned char u8;
- typedef short s16;
- typedef unsigned short u16;
- typedef int s32;
- typedef unsigned int u32;
- typedef long long s64;
- typedef unsigned long long u64;
- #define S8(n) ((s8)(n))
- #define U8(n) ((u8)(n))
- #define S16(n) ((s16)(n))
- #define U16(n) ((u16)(n))
- #define S32(n) ((s32)(n))
- #define U32(n) ((u32)(n))
- #define S64(n) ((s64)(n))
- #define U64(n) ((u64)(n))
- typedef u32 color_t;
- color_t color_new( u8 r, u8 g, u8 b, u8 a );
- // The 8 digital colors
- #define c_black 0x000000FF
- #define c_blue 0x0000FFFF
- #define c_green 0x00FF00FF
- #define c_cyan 0x00FFFFFF
- #define c_red 0xFF0000FF
- #define c_pink 0xFF00FFFF
- #define c_yellow 0xFFFF00FF
- #define c_white 0xFFFFFFFF
- // various shades of gray
- #define c_gray 0xAAAAAAFF
- #define c_gray50 0x808080FF
- #define c_gray25 0x404040FF
- // an ugly color for transparent pixels
- #define c_trans 0xFF00FEFF
- size_t fsize( FILE* fp );
- u32 color_to_surf( SDL_Surface* surf, color_t color );
- u32 surf_to_color( SDL_Surface* surf, u32 color_sdl );
- void SDL_Clear( SDL_Surface* surf, color_t color );
- void SDL_Clear_rect_easy( SDL_Surface* surf, int x, int y, int w, int h, color_t color );
- void SDL_PutPixel( SDL_Surface* surf, long x, long y, color_t color );
- color_t SDL_GetPixel( SDL_Surface* surf, long x, long y ); // this could be broken
- void SDL_Line( SDL_Surface* surf, int x1, int y1, int x2, int y2, color_t color );
- void SDL_Line_Straight( SDL_Surface* surf, int x, int y, int dx, int dy, int length, color_t color );
- void SDL_Circle( SDL_Surface* surf, int x, int y, int radius, color_t color );
- SDL_Surface* surf_new( int w, int h );
- // out=target_surface - modify target_surface in place
- // out=NULL - return new surface
- SDL_Surface* scale_surface( SDL_Surface* in, SDL_Surface* out, int new_w, int new_h );
- int save_to_tga( SDL_Surface* surf, char* path );
- typedef struct rgb96_t rgb96_t;
- struct rgb96_t {
- u32 r;
- u32 g;
- u32 b;
- };
- #define RGB96_BLACK ((rgb96_t){.r=0,.g=0,.b=0})
- u32 pixel_high_gray( rgb96_t c );
- rgb96_t pixel_high_get( SDL_Surface* surf, long x, long y );
- int pixel_high_put( SDL_Surface* surf, long x, long y, rgb96_t c );
- rgb96_t pixel_high_add( rgb96_t c1, rgb96_t c2 );
- rgb96_t pixel_high_div_n( rgb96_t c1, u32 n );
- //_Bool pixel_high_LT( rgb96_t c1, rgb96_t c2 );
- //_Bool pixel_high_LTE( rgb96_t c1, rgb96_t c2 );
- //_Bool pixel_high_GT( rgb96_t c1, rgb96_t c2 );
- //_Bool pixel_high_GTE( rgb96_t c1, rgb96_t c2 );
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement