象棋棋盘 Posted on 2018-10-14 | 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177#include <graphics.h> // 绘图库头文件,绘图语句需要#include <conio.h> // 控制台输入输出头文件,getch()语句需要void main(){ initgraph(500, 550); // 初始化640x480的绘图屏幕 setbkcolor(RGB(255, 255, 255)); //加载图片 clearcliprgn(); for (int i = 50; i <= 450; i = i + 50) { setlinecolor(RGB(200, 0, 0)); line(i, 50, i, 250); line(i, 300, i, 500); } for (int i = 50; i <= 500; i = i + 50) { setlinecolor(RGB(200, 0, 0)); line(50, i, 450, i); } //将 士 line(200, 50, 300, 150); line(200, 150, 300, 50); line(200, 500, 300, 400); line(200, 400, 300, 500); line(50, 250, 50, 300); line(450, 250, 450, 300); //图片 IMAGE img; // 定义 IMAGE 对象 loadimage(&img, "C:\\IMAGES_S\\POLISH\\BRS.GIF"); // 读取图片黑车到 img 对象中 putimage(30, 30, &img); // 在坐标 (0, 0) 位置显示 IMAGE 对象 IMAGE img2; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BA.GIF");//黑士 putimage(180, 30, &img); IMAGE img3; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BB.GIF");//黑象 putimage(130, 30, &img); IMAGE img4; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BKS.GIF");//黑将 putimage(230, 30, &img); IMAGE img5; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BNS.GIF");//黑马 putimage(80, 30, &img); IMAGE img6; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BAS.GIF");//黑士 putimage(280, 30, &img); IMAGE img7; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BBS.GIF");//黑象 putimage(330, 30, &img); IMAGE img8; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BNS.GIF");//黑马 putimage(380, 30, &img); IMAGE img9; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BR.GIF");//黑车 putimage(430, 30, &img); IMAGE img10; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BP.GIF");//黑卒 putimage(30, 180, &img); IMAGE img11; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BP1.GIF");//黑卒 putimage(130, 180, &img); IMAGE img12; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BP2.GIF");//黑卒 putimage(230, 180, &img); IMAGE img13; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BP3.GIF");//黑卒 putimage(330, 180, &img); IMAGE img14; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BP4.GIF");//黑卒 putimage(430, 180, &img); IMAGE img15; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BC.GIF");//黑炮 putimage(80, 130, &img); IMAGE img16; loadimage(&img, "C:\\IMAGES_S\\POLISH\\BCS.GIF");//黑炮 putimage(380, 130, &img); //红方 IMAGE img17; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RK.GIF");//红帅 putimage(230, 480, &img); IMAGE img18; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RA.GIF");//红士 putimage(180, 480, &img); IMAGE img19; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RAS.GIF");//红士 putimage(280,480, &img); IMAGE img20; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RB.GIF");//红相 putimage(130, 480, &img); IMAGE img21; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RBS.GIF");//红相 putimage(330, 480, &img); IMAGE img22; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RN.GIF");//红马 putimage(380, 480, &img); IMAGE img23; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RNS.GIF");//红马 putimage(80, 480, &img); IMAGE img24; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RR.GIF");//红车 putimage(30, 480, &img); IMAGE img25; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RR.GIF");//红车 putimage(30, 480, &img); IMAGE img26; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RR.GIF");//红车 putimage(30, 480, &img); IMAGE img36; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RRS.GIF");//红车 putimage(430, 480, &img); IMAGE img27; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RPS.GIF");//红卒 putimage(30, 330, &img); IMAGE img28; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RPS1.GIF");//红卒 putimage(130, 330, &img); IMAGE img29; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RPS2.GIF");//红卒 putimage(230, 330, &img); IMAGE img30; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RPS3.GIF");//红卒 putimage(330, 330, &img); IMAGE img31; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RPS4.GIF");//红卒 putimage(430, 330, &img); IMAGE img32; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RC.GIF");//红车 putimage(80, 380, &img); IMAGE img33; loadimage(&img, "C:\\IMAGES_S\\POLISH\\RCS.GIF");//红车 putimage(380, 380, &img); _getch(); // 按任意键 closegraph(); // 关闭绘图屏幕}