在学习制作一个扫雷小游戏,在鼠标消息代码这里,遇到了,只要拖动鼠标,程序就会自动运行一轮的问题。怎么能屏蔽鼠标移动带来的影响。换言之就是只接受鼠标点击左右键的消息,而屏蔽其他。谢谢各位大佬
//部分代码
int PlayGame()
{
int r, c;
MOUSEMSG msg = { 0 };
while (1)
{
msg = GetMouseMsg();
switch (msg.uMsg)
{
case WM_LBUTTONDOWN:
r = msg.x / SIZ + 1;
c = msg.y / SIZ + 1;
if (map[r][c] >= 19 && map[r][c] <= 28)
{
map[r][c] -= 20;
}
return map[r][c];
break;
case WM_RBUTTONDOWN:
r = msg.x / SIZ + 1;
c = msg.y / SIZ + 1;
if (map[r][c] >= 19 && map[r][c] <= 28)
{
map[r][c] += 30;
}
else if (map[r][c] > 30)
{
map[r][c] -= 30;
}
return map[r][c];
break;
}
break;
}
}
int main()
{
GameInit();
GameSet();
while (1)
{
GameDraw();
PlayGame();
}
cin.get();
}