/* * games/_shared/ - shared routines for games * * my-graph.h - universal graphics library header file * ____________________________________________________________ * * Developed by Ondrej Jombik * Copyright (c) 2003-2004 Platon SDG, http://platon.sk/ * All rights reserved. * * See README file for more information about this software. * See COPYING file for license information. * * Download the latest version from * http://platon.sk/projects/games/ * * Changelog: * 2003-05-10 - created * 2003-08-12 - X11 adaptations */ /* $Platon: games/_shared/my-graph.h,v 1.7 2003/08/12 20:50:59 nepto Exp $ */ #ifndef _MY_GRAPH_H # define _MY_GRAPH_H #include /* target operating system type */ #if PLATON_SYSTEM_MSDOS # include #endif #if PLATON_SYSTEM_WIN32 # include #endif #if PLATON_SYSTEM_SVGALIB # include # include #endif #if PLATON_SYSTEM_X11 # include #endif int my_graph_init(int pagging); void my_graph_refresh(void); void my_graph_close(void); #if PLATON_SYSTEM_MSDOS # define putimage_BGI putimage # define putimage_BGI_cached putimage #else /* old putimage() functionality for all platforms except MS-Dos */ # define PUTIMAGE_BGI_CACHE_SIZE (32) void putimage_BGI_cached(const int x, const int y, void *image, const int op); void putimage_BGI(const int x, const int y, void *image, const int op); #endif #if PLATON_SYSTEM_SVGALIB struct BGIimage { short width; short height; int reserved; /* let bits be aligned to DWORD boundary */ char bits[1]; }; struct textsettingstype { int font; int direction; int charsize; int horiz; int vert; }; #define MAXCOLORS 15 struct palettetype { unsigned char size; signed char colors[MAXCOLORS+1]; }; enum text_just /* Horizontal and vertical justification for settextjustify */ { LEFT_TEXT = 0, CENTER_TEXT = 1, RIGHT_TEXT = 2, BOTTOM_TEXT = 0, /* CENTER_TEXT = 1, already defined above */ TOP_TEXT = 2 }; enum fill_patterns { /* Fill patterns for get/setfillstyle */ EMPTY_FILL, /* fills area in background color */ SOLID_FILL, /* fills area in solid fill color */ LINE_FILL, /* --- fill */ LTSLASH_FILL, /* /// fill */ SLASH_FILL, /* /// fill with thick lines */ BKSLASH_FILL, /* \\\ fill with thick lines */ LTBKSLASH_FILL, /* \\\ fill */ HATCH_FILL, /* light hatch fill */ XHATCH_FILL, /* heavy cross hatch fill */ INTERLEAVE_FILL, /* interleaving line fill */ WIDE_DOT_FILL, /* Widely spaced dot fill */ CLOSE_DOT_FILL, /* Closely spaced dot fill */ USER_FILL /* user defined fill */ }; enum putimage_ops { /* BitBlt operators for putimage */ COPY_PUT, /* MOV */ XOR_PUT, /* XOR */ OR_PUT, /* OR */ AND_PUT, /* AND */ NOT_PUT /* NOT */ }; #define grOk 1 #define graphresult() 1 #define grapherrormsg(__code) "grapherrormsg()" #define cleardevice() gl_clearscreen(BLACK) #define getmaxx() (vga_getxdim() - 1) #define getmaxy() (vga_getydim() - 1) #define putpixel(__x, __y, __color) gl_setpixel(__x, __y, __color) #define getpixel(__x, __y) gl_getpixel(__x, __y) void setcolor(const int color); void setfillstyle(const int pattern, const int color); void moveto(const int x, const int y); void moverel(const int dx, const int dy); void line(const int x1, const int y1, const int x2, const int y2); void rectangle(const int x1, const int y1, const int x2, const int y2); void bar(const int x1, const int y1, const int x2, const int y2); void bar3d(const int x1, const int y1, const int x2, const int y2, const int depth, const int topflag); void ellipse(const int x, const int y, const int stangle, const int endangle, const int xradius, const int yradius); void fillellipse(const int x, const int y, const int xradius, const int yradius); int textheight(char *str); int textwidth(char *str); void gettextsettings(struct textsettingstype *texttypeinfo); void settextstyle(int font, int direction, int charsize); void settextjustify(int horiz, int vert); void outtext(char *str); void outtextxy(const int x, const int y, char *str); unsigned int imagesize(const int x1, const int y1, const int x2, const int y2); void getimage(const int x1, const int y1, const int x2, const int y2, void *image); void putimage(const int x, const int y, void *image, int bitblt); struct palettetype *getdefaultpalette(void); void getpalette(struct palettetype *palette); void setpalette(int colornum, int color); void setallpalette(const struct palettetype *palette); #endif /* #if PLATON_SYSTEM_SVGALIB */ #endif /* ifndef _MY_GRAPH_H */