This project is a simple implementation of the classic Minesweeper game using C++ and the Win32 API. The game includes basic functionalities such as initializing the game board, handling mouse operations, and determining win/lose conditions.
- Initialization: Initializes the game board with mines and numbers.
- Mouse Operations: Handles left and right mouse clicks for revealing cells and marking mines.
- Win/Lose Conditions: Determines if the player has won or lost the game.
- Game Restart: Allows the player to restart the game after winning or losing.
- Graphics: Uses the Win32 API for graphical representation of the game board.
- Visual Studio 2022
- Windows operating system
- Open the project in Visual Studio 2022.
- Build the project by selecting
Build > Build Solution. - Run the project by selecting
Debug > Start Without Debugging.
main.cpp: Contains the main game logic and WinMain function.init(): Initializes the game board.draw(): Updates the graphical representation of the game board.Mouseopration(): Handles mouse click events.ZeroBoom(): Handles the chain reaction of revealing cells when a zero cell is clicked.judge(): Determines if the game is won or lost.
- Left-click to reveal a cell.
- Right-click to mark a cell as a mine.
- The game ends when all non-mine cells are revealed or a mine is clicked.