象棋棋盘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#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(); // 关闭绘图屏幕
}