Fix gtk141

This commit is contained in:
daleclack 2022-10-16 09:42:48 +08:00
parent 67fd417be5
commit 2842b1bac9
2 changed files with 19 additions and 10 deletions

View File

@ -65,7 +65,7 @@ if(WIN32)
set_property(SOURCE ../icon.rc APPEND PROPERTY
OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/../icon.ico
)
add_executable(${PROJECT_NAME} ${app_WINRC} ${SOURCE_FILE} ${RESOURCE_FILE})
add_executable(${PROJECT_NAME} WIN32 ${app_WINRC} ${SOURCE_FILE} ${RESOURCE_FILE})
add_custom_command( TARGET ${PROJECT_NAME}
COMMAND echo * > ${CMAKE_BINARY_DIR}/.gitignore
COMMAND echo **/* > ${CMAKE_BINARY_DIR}/.hgignore)

View File

@ -195,6 +195,7 @@ void MineSweeper::cell_clicked(MineCell *cell1)
void MineSweeper::check_mines(int pos_x, int pos_y)
{
std::cout << pos_y << " " << pos_x << "," << std::endl;
if (pos_x >= 0 && pos_x <= 6 &&
pos_y >= 0 && pos_y <= 6)
{
@ -203,7 +204,7 @@ void MineSweeper::check_mines(int pos_x, int pos_y)
{
mines_clear++;
// std::cout << mines_clear << std::endl;
// std::cout << pos_y << " " << pos_x << std::endl;
if (cell[pos_y * 7 + pos_x].mines_around == 0)
{
// cell->set_label(" ");
@ -220,14 +221,22 @@ void MineSweeper::check_mines(int pos_x, int pos_y)
cell[pos_y * 7 + pos_x].cleared = true;
if (cell[pos_y * 7 + pos_x].mines_around == 0)
{
check_mines(pos_y - 1, pos_x - 1);
check_mines(pos_y + 1, pos_x + 1);
check_mines(pos_y - 1, pos_x + 1);
check_mines(pos_y + 1, pos_x - 1);
check_mines(pos_y, pos_x - 1);
check_mines(pos_y, pos_x + 1);
check_mines(pos_y + 1, pos_x);
check_mines(pos_y - 1, pos_x);
check_mines((pos_x - 1), (pos_y - 1));
check_mines((pos_x + 1), (pos_y + 1));
check_mines((pos_x - 1), (pos_y + 1));
check_mines((pos_x + 1), (pos_y - 1));
check_mines(pos_x, (pos_y - 1));
check_mines(pos_x, (pos_y + 1));
check_mines((pos_x + 1), pos_y);
check_mines((pos_x - 1), pos_y);
// std::cout << pos_y - 1 << " " << pos_x - 1 << "," << std::endl;
// std::cout << pos_y - 1 << " " << pos_x << "," << std::endl;
// std::cout << pos_y - 1 << " " << pos_x + 1 << "," << std::endl;
// std::cout << pos_y << " " << pos_x - 1 << "," << std::endl;
// std::cout << pos_y << " " << pos_x + 1 << "," << std::endl;
// std::cout << pos_y + 1 << " " << pos_x - 1 << "," << std::endl;
// std::cout << pos_y + 1 << " " << pos_x << "," << std::endl;
// std::cout << pos_y + 1 << " " << pos_x + 1 << "," << std::endl;
}
}
}