2010-09-27 05:53:05 -05:00
|
|
|
#ifndef GRAPHICS_H
|
|
|
|
#define GRAPHICS_H
|
|
|
|
#include <SDL/SDL.h>
|
|
|
|
#include "defines.h"
|
|
|
|
#include "hmap.h"
|
|
|
|
|
|
|
|
#ifdef PIX16
|
|
|
|
#define PIXELSIZE 2
|
|
|
|
#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F))
|
|
|
|
#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F))
|
|
|
|
#define PIXR(x) (((x)>>8)&0xF8)
|
|
|
|
#define PIXG(x) (((x)>>3)&0xFC)
|
|
|
|
#define PIXB(x) (((x)<<3)&0xF8)
|
|
|
|
#else
|
|
|
|
#define PIXELSIZE 4
|
|
|
|
#ifdef PIX32BGR
|
|
|
|
#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000))
|
|
|
|
#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r))
|
|
|
|
#define PIXR(x) ((x)&0xFF)
|
|
|
|
#define PIXG(x) (((x)>>8)&0xFF)
|
|
|
|
#define PIXB(x) ((x)>>16)
|
|
|
|
#else
|
|
|
|
#ifdef PIX32BGRA
|
|
|
|
#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000))
|
|
|
|
#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8))
|
|
|
|
#define PIXR(x) (((x)>>8)&0xFF)
|
|
|
|
#define PIXG(x) (((x)>>16)&0xFF)
|
|
|
|
#define PIXB(x) (((x)>>24))
|
|
|
|
#else
|
|
|
|
#define PIXPACK(x) (x)
|
|
|
|
#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b))
|
|
|
|
#define PIXR(x) ((x)>>16)
|
|
|
|
#define PIXG(x) (((x)>>8)&0xFF)
|
|
|
|
#define PIXB(x) ((x)&0xFF)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern unsigned cmode;
|
|
|
|
extern SDL_Surface *sdl_scrn;
|
|
|
|
extern int sdl_scale;
|
|
|
|
|
|
|
|
extern unsigned char fire_r[YRES/CELL][XRES/CELL];
|
|
|
|
extern unsigned char fire_g[YRES/CELL][XRES/CELL];
|
|
|
|
extern unsigned char fire_b[YRES/CELL][XRES/CELL];
|
|
|
|
|
|
|
|
extern unsigned int fire_alpha[CELL*3][CELL*3];
|
|
|
|
extern pixel *fire_bg;
|
2011-02-19 09:34:04 -06:00
|
|
|
extern pixel *pers_bg;
|
2010-09-27 05:53:05 -05:00
|
|
|
|
2011-06-09 11:53:41 -05:00
|
|
|
void draw_rgba_image(pixel *vid, unsigned char *data, int x, int y, float a);
|
|
|
|
|
2011-05-28 07:49:07 -05:00
|
|
|
void *ptif_pack(pixel *src, int w, int h, int *result_size);
|
|
|
|
|
|
|
|
pixel *ptif_unpack(void *datain, int size, int *w, int *h);
|
|
|
|
|
2011-06-08 07:30:39 -05:00
|
|
|
pixel *resample_img_nn(pixel *src, int sw, int sh, int rw, int rh);
|
|
|
|
|
2011-05-28 08:19:01 -05:00
|
|
|
pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh);
|
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f);
|
|
|
|
|
2011-07-18 17:58:08 -05:00
|
|
|
void render_gravlensing(pixel *src, pixel * dst);
|
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch);
|
|
|
|
|
|
|
|
void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch);
|
|
|
|
|
|
|
|
void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch);
|
|
|
|
|
|
|
|
void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb);
|
|
|
|
|
|
|
|
void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall);
|
|
|
|
|
|
|
|
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc);
|
|
|
|
|
|
|
|
void draw_menu(pixel *vid_buf, int i, int hover);
|
|
|
|
|
2011-04-08 09:28:57 -05:00
|
|
|
void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a);
|
2010-09-27 05:53:05 -05:00
|
|
|
|
2011-04-08 09:28:57 -05:00
|
|
|
int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a);
|
2010-09-27 05:53:05 -05:00
|
|
|
|
|
|
|
int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a);
|
|
|
|
|
2011-08-14 12:31:48 -05:00
|
|
|
int drawtext_outline(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a, int or, int og, int ob, int oa);
|
|
|
|
|
2010-10-20 16:31:19 -05:00
|
|
|
int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, int b, int a);
|
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
void clearrect(pixel *vid, int x, int y, int w, int h);
|
|
|
|
|
|
|
|
void drawdots(pixel *vid, int x, int y, int h, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
int textwidth(char *s);
|
|
|
|
|
|
|
|
int drawtextmax(pixel *vid, int x, int y, int w, char *s, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
int textnwidth(char *s, int n);
|
|
|
|
|
2010-11-03 10:51:02 -05:00
|
|
|
void textnpos(char *s, int n, int w, int *cx, int *cy);
|
2010-10-21 17:49:45 -05:00
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
int textwidthx(char *s, int w);
|
|
|
|
|
2010-11-03 10:51:02 -05:00
|
|
|
int textposxy(char *s, int width, int w, int h);
|
2011-04-08 09:28:57 -05:00
|
|
|
|
2011-04-02 09:49:06 -05:00
|
|
|
int textwrapheight(char *s, int width);
|
2010-11-03 10:51:02 -05:00
|
|
|
|
2010-10-21 17:49:45 -05:00
|
|
|
void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a);
|
2010-09-27 05:53:05 -05:00
|
|
|
|
|
|
|
void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag);
|
|
|
|
|
|
|
|
void draw_air(pixel *vid);
|
|
|
|
|
2011-06-09 16:35:00 -05:00
|
|
|
void draw_grav_zones(pixel *vid);
|
|
|
|
|
2011-04-22 11:06:09 -05:00
|
|
|
void draw_grav(pixel *vid);
|
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
void xor_pixel(int x, int y, pixel *vid);
|
|
|
|
|
|
|
|
void xor_line(int x1, int y1, int x2, int y2, pixel *vid);
|
|
|
|
|
|
|
|
void xor_rect(pixel *vid, int x, int y, int w, int h);
|
|
|
|
|
2011-08-14 12:31:48 -05:00
|
|
|
void blend_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
void draw_parts(pixel *vid);
|
2011-04-08 09:28:57 -05:00
|
|
|
|
2011-05-14 07:28:02 -05:00
|
|
|
void draw_walls(pixel *vid);
|
|
|
|
|
2011-05-29 21:18:47 -05:00
|
|
|
void create_decorations(int x, int y, int rx, int ry, int r, int g, int b, int click);
|
|
|
|
|
|
|
|
void line_decorations(int x1, int y1, int x2, int y2, int rx, int ry, int r, int g, int b, int click);
|
|
|
|
|
|
|
|
void box_decorations(int x1, int y1, int x2, int y2, int r, int g, int b, int click);
|
|
|
|
|
2011-03-15 10:28:32 -05:00
|
|
|
void draw_wavelengths(pixel *vid, int x, int y, int h, int wl);
|
2011-04-08 09:28:57 -05:00
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
void render_signs(pixel *vid_buf);
|
|
|
|
|
|
|
|
void render_fire(pixel *dst);
|
|
|
|
|
2011-08-11 07:02:00 -05:00
|
|
|
void prepare_alpha(int size, float intensity);
|
2010-09-27 05:53:05 -05:00
|
|
|
|
|
|
|
void draw_image(pixel *vid, pixel *img, int x, int y, int w, int h, int a);
|
|
|
|
|
|
|
|
void dim_copy(pixel *dst, pixel *src);
|
|
|
|
|
2010-12-19 08:20:38 -06:00
|
|
|
void dim_copy_pers(pixel *dst, pixel *src);
|
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
void render_zoom(pixel *img);
|
|
|
|
|
|
|
|
pixel *prerender_save(void *save, int size, int *width, int *height);
|
|
|
|
|
|
|
|
int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl);
|
|
|
|
|
2010-12-05 09:49:48 -06:00
|
|
|
void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry);
|
2010-09-27 05:53:05 -05:00
|
|
|
|
2011-05-24 08:54:14 -05:00
|
|
|
int sdl_open(void);
|
2010-09-27 05:53:05 -05:00
|
|
|
|
2011-08-14 12:31:48 -05:00
|
|
|
int draw_debug_info(pixel* vid, int lm, int lx, int ly, int cx, int cy);
|
2011-08-11 14:12:52 -05:00
|
|
|
|
2010-09-27 05:53:05 -05:00
|
|
|
#ifdef OpenGL
|
|
|
|
void Enable2D ();
|
|
|
|
void RenderScene ();
|
|
|
|
void ClearScreen();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|