dev c++的图形库问题

Dev C++中使用图形库

C语言 2009-05-05 09:25:50 阅读158 评论0 字号:大中小 订阅

下载:http://classes.engr.oregonstate.edu/eecs/summer2008/cs151/devcFiles.zip

因为TurboC的图形库是16位的,所以在Dev C++的32位环境中不能使用,Dev C++中又没有自带的图形库,所以一直让我郁闷着.搜了好久关于Dev C++使用图形库的文章,也发现许多网友有同样的问题.

最后总算找到一个高人的文章(http://blog.csdn.net/stkim/archive/2006/02/15/599802.aspx),知道了点端倪,不过按照他的方法又不行,按照他的用Dev C++ Update下载已经失效......琢磨良久,总算找到了方法.....



首先要保证你有Dev C++ IDE,如果没有,可以去Bloodshed( http://www.bloodshed.net/ )下载或Google一下(记得初中里买的那本<21天学通C语言>光盘里也有),最好是4.9.9.2版的,因为里面有中文界面可选.

然后去http://classes.engr.oregonstate.edu/eecs/summer2008/cs151/Dev-C++.htm(里面有更详细的介绍)下载 devcFiles.zip,里面有必需的文件:

CS151.template (新文件)
ConsoleGDI.template (替换原文件)
BGI.ico (新文件)
cs151.ico (新文件)
CS151App_c.txt (新文件)
ConsoleGDI.txt (替换原文件)



下载好之后解压到Dev C++安装文件夹中的Templates文件夹中,然后:

1. 将提取出来的libbgi.a,libconio.a两个文件放到lib文件夹中

2. 将提取出来的winbgim.h, conio.h, 和 conio2.h三个文件放到include文件夹中



搞定之后,打开Dev C++,新建->工程->other,会出现”Console GDI”模板,建立,就会出现一个默认的工程

编译运行,就出现了一个可爱的圆……-_-!

如果出现链接错误,可以加入一句”#include

这样以来,就可以在Dev C++中使用图形库了,而且函数名也和Turbo C图形库中的差不多,摘抄一段winbgim.h中的函数:

extern int bgiemu_default_mode;

void _graphfreemem PROTO((void *ptr, unsigned int size));

void* _graphgetmem PROTO((unsigned int size));

void arc PROTO((int, int, int, int, int));

void bar PROTO((int, int, int, int));

void bar3d PROTO((int, int, int, int, int, int));

void circle PROTO((int, int, int));

void cleardevice PROTO((void));

void clearviewport PROTO((void));

void closegraph PROTO((void));

void detectgraph PROTO((int *, int *));

void drawpoly PROTO((int, int *));

void ellipse PROTO((int, int, int, int, int, int));

void fillellipse PROTO((int, int, int, int));

void fillpoly PROTO((int, int *));

void floodfill PROTO((int, int, int));

void getarccoords PROTO((arccoordstype *));

void getaspectratio PROTO((int *, int *));

int getbkcolor PROTO((void));

int getcolor PROTO((void));

palettetype* getdefaultpalette PROTO((void));

char* getdrivername PROTO((void));

void getfillpattern PROTO((fillpatterntype)); //3.51: fixed argument type

void getfillsettings PROTO((fillsettingstype *));

int getgraphmode PROTO((void));

void getimage PROTO((int, int, int, int, void *));

void getlinesettings PROTO((linesettingstype *));

int getmaxcolor PROTO((void));

int getmaxmode PROTO((void));

int getmaxx PROTO((void));

int getmaxy PROTO((void));

char* getmodename PROTO((int));

void getmoderange PROTO((int, int *, int *));

void getpalette PROTO((palettetype *));

int getpalettesize PROTO((void));

unsigned int getpixel PROTO((int, int));

void gettextsettings PROTO((textsettingstype *));

void getviewsettings PROTO((viewporttype *));

int getx PROTO((void));

int gety PROTO((void));

void graphdefaults PROTO((void));

char* grapherrormsg PROTO((int));

int graphresult PROTO((void));

unsigned int imagesize PROTO((int, int, int, int));

void initgraph PROTO((int *, int *, char const *));

int installuserdriver PROTO((char const *, int *));

int installuserfont PROTO((char const *));

void line PROTO((int, int, int, int));

void linerel PROTO((int, int));

void lineto PROTO((int, int));

void moverel PROTO((int, int));

void moveto PROTO((int, int));

void outtext PROTO((char const *));

void outtextxy PROTO((int, int, char const *));

void pieslice PROTO((int, int, int, int, int));

void putimage PROTO((int, int, void *, int));

void putpixel PROTO((int, int, int));

void rectangle PROTO((int, int, int, int));

int registerbgidriver PROTO((void *));

int registerbgifont PROTO((void *));

void restorecrtmode PROTO((void));

void sector PROTO((int, int, int, int, int, int));

void setactivepage PROTO((int));

void setallpalette PROTO((palettetype *));

void setaspectratio PROTO((int, int));

void setbkcolor PROTO((int));

void setcolor PROTO((int));

void setfillpattern PROTO((char const *, int));

void setfillstyle PROTO((int, int));

unsigned int setgraphbufsize PROTO((unsigned int));

void setgraphmode PROTO((int));

void setlinestyle PROTO((int, unsigned int, int));

void setpalette PROTO((int, int));

void setrgbpalette PROTO((int, int, int, int));

void settextjustify PROTO((int, int));

void settextstyle PROTO((int, int, int));

void setusercharsize PROTO((int, int, int, int));

void setviewport PROTO((int, int, int, int, int));

void setvisualpage PROTO((int));

void setwritemode PROTO((int));

int textheight PROTO((char const *));

int textwidth PROTO((char const *));

int getch PROTO((void));

int kbhit PROTO((void));

void delay PROTO((unsigned msec));

void restorecrtmode PROTO((void));

你可能感兴趣的:(【其他】,C,C++,C#,.net,Google)