Home › Forums › C Programming › draw chess board
- This topic has 1 reply, 2 voices, and was last updated 16 years, 9 months ago by msaqib.
Viewing 1 reply thread
- AuthorPosts
- March 17, 2008 at 11:57 am #2079abhishek3013Participant
please i need a clue on how to start drawing a chess board in dev-c++.
it seems it does not find the header file. need help. - March 17, 2008 at 5:45 pm #3360msaqibParticipant
Someone has already done the hard work for you :D. So you can use the same graphis.h functions and library. So what you have to do is, https://www.mycplus.com/tutorials/c-programming-tutorials/graphics-programming/ checkout this webpage, read through it, and download the gaphics library and graphics.h header file.
Next step is to read the manual on how to prepare you project to use this library. And thats it, you are done.
Here is a simple graphics program which i wrote for my Borland compiler 3. But the same program without any modifications is working fine on Dev-C++ 4.9.C12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576#include <stdio.h>#include <graphics.h>#include <conio.h>#include <process.h>int main(void){int mx, my;/* request auto detection */int gd= DETECT, gm, errorcode;initgraph(&gd,&gm,"F:\tc\bgi"); //Last argument is the path to the graphics library of Turbo C/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */{printf("Graphics error: %sn", grapherrormsg(errorcode));printf("Press any key to halt:");getch();exit(1); /* return with error code */}mx = (getmaxx() / 2);my = (getmaxy() / 2);//SET baqckground colorsetfillstyle(9, 1);bar(0,0,getmaxx(),getmaxy());//DRAW a bar, and make it look like a 3d barsetfillstyle(1,7);//bar(50,20,600,400);//DRAW lines for the top and left sidesetcolor(15);line(50,20,600,20);line(51,21,599,21);line(50,20,50,400);line(51,21,51,399);//DRAW lines for the bottom and right sidesetcolor(8);line(600,20,600,400);line(599,21,599,400);line(50,400,600,400);line(51,399,600,399);//DRAW two 3D bars for the left and right sidesetfillstyle(9,8);bar(70,40,100,380);bar(70,40,550,70);bar(70,350,550,379);bar(545,40,575,380);settextstyle(1, 0, 4);settextjustify(1,1);setcolor(LIGHTGREEN);outtextxy(mx+2, my - 46, "Graphics - Dev-C++");setcolor(LIGHTGREEN);outtextxy(mx + 1, my - 45, "Graphics - Dev-C++");setcolor(GREEN);outtextxy(mx + 2, my - 44, "Graphics - Dev-C++");//PRINT 3D text 2008setcolor(LIGHTGREEN);outtextxy(mx, my + 10, "2008");setcolor(LIGHTGREEN);outtextxy(mx + 1, my + 11, "2008");setcolor(GREEN);outtextxy(mx + 2, my + 12, "2008");getch(); //PAUSE for a whileclosegraph();return 0;}
- AuthorPosts
Viewing 1 reply thread
- The forum ‘C Programming’ is closed to new topics and replies.