新人,画的围棋棋盘和鼠标点击绘棋子
easyx吧
全部回复
仅看楼主
level 8
2014年01月29日 12点01分 1
level 8
#include <graphics.h>
#include <conio.h>
void main()
{
initgraph(680,480);// 初始化680*480窗口
MOUSEMSG m;
for(int bg = 0; bg < 680; bg ++)
{
setlinecolor(RGB(255, 204, 102));
line(bg,0,bg,680);
}
for(int x = 20; x < 680; x += 30)
{
if( (x / 10 % 2) == 0)
{
setlinecolor(BLACK);
}
else
{
setlinecolor(RED);
}
line(x,10,x,470);
}
for(int y = 10; y < 480 ; y += 30)
{
if(y / 10 % 2 == 0 )
{
setlinecolor(BLACK);
}
else
{
setlinecolor(RED);
}
line(20,y,650,y);
}
setfillcolor(BLACK);
solidcircle(80,40,10);
setfillcolor(WHITE);
solidcircle(140,40,10);
while(true)
{
m = GetMouseMsg();
switch(m.uMsg)
{
case(WM_LBUTTONDOWN ):
{
setfillcolor(WHITE);
solidcircle(m.x,m.y,10);
break;
}
case(WM_RBUTTONDOWN):
{
return;
}
}
}
closegraph();
}
2014年01月29日 12点01分 2
level 8
求指导
2014年01月29日 12点01分 3
能加个游戏规则判断代码就更上一个档次了
2014年01月29日 13点01分
level 12
嗯,刚开始写得不错~~
下一步,先把落字的位置对齐到格子上吧。
2014年02月07日 08点02分 4
嗯,努力完善中
2014年02月07日 10点02分
吧主,晚上我发下我的代码,求教下,我自己写的打砖块的代码那个和砖块反弹弄不好
2014年06月18日 13点06分
村长晚上好!!
2014年12月03日 16点12分
我已经对齐了落子的位置,要怎么判断某个点上是否已经有棋子了呢
2014年12月06日 12点12分
level 1
楼主求教。编译错误什么情况。 error C2065: 'setlinecolor' : undeclared identifier
2014年03月05日 10点03分 5
[滑稽]装了ESAYX图形函数库没,没装的话装个,因为要调用它里面的一些函数
2014年03月05日 13点03分
T T我装了的。没装的时候提示我没有graphics.h
2014年03月06日 04点03分
level 2
这个如果要判断胜负该怎么弄啊
2014年03月07日 14点03分 6
假设,X轴每隔10个值为一个落子点。用三角函数,五子连成或(10,0)(60,0)的线段为赢,否则继续游戏。直到某方,五子连成5个不间断落子点坐标线段。实际就是计算,任意白棋与白棋5个落子点直线距离内是否存在黑棋,如果存在,则又计算以这个白棋为端点的直线范围内是否存在黑棋,以此内推。
2014年03月07日 15点03分
回复 梦幻流苏147258 :需要一定的数学知识哈。
2014年03月07日 15点03分
回复 梦幻流苏147258 :谢谢,我考虑考虑
2014年03月08日 12点03分
level 12
[真棒]
2014年03月13日 02点03分 7
level 11
不错[笑眼][笑眼][真棒][真棒][真棒][真棒][真棒][真棒][真棒][真棒]真好啊........
2014年03月15日 14点03分 8
level 2
不错不错[真棒]
2014年03月16日 01点03分 9
level 12
必须牛逼啊[真棒]
2014年03月16日 02点03分 11
level 2
[大拇指]
2014年06月18日 02点06分 12
level 2
楼主为什么我用vc6.0编译会出现d:\microsoft visual studio\myprojects\baorui\1.c(35) : fatal error C1189: #error : EasyX is only for C++这个错误。你安装的easyx插件什么版本的,和版本有关系吗
2014年06月18日 10点06分 13
后缀.c 改为.cpp就行了
2014年11月28日 16点11分
level 11
楼楼你好,这个东西我也想学,请问在哪里可以学到?麻烦了[委屈][委屈]
2014年11月17日 08点11分 15
level 12
点赞
2014年11月18日 01点11分 16
level 8
这个有个缺点就是,棋子可以放在任何位置,你能修改下让它只能放在棋盘的格子里吗?
2014年11月19日 10点11分 17
level 12
真简单 m.x和m.y 对边长取整就是第二个格子
2014年12月03日 09点12分 18
知道了
2014年12月09日 13点12分
level 1
楼主 能不能带点注释
2014年12月16日 13点12分 19
level 2
话说是不是不能下黑棋了。。。
2015年09月13日 12点09分 20
level 2
还没仔细看代码,毕竟没注释,有点。。。
2015年09月13日 12点09分 21
1