Skip to content

This project was a personal learning experience aimed at revisiting and reinforcing the core concepts of Qt in a fun and practical way. By building a classic game like Minesweeper, I gained hands-on experience with Qt widgets, event handling, layout management, and signals/slots.

Notifications You must be signed in to change notification settings

Mathis-L/minesweeper

Repository files navigation

Minesweeper Game with Qt

This is a simple Minesweeper game implemented using C++ and Qt .


Project Purpose

This project was a personal learning experience aimed at revisiting and reinforcing the core concepts of Qt in a fun and practical way. By building a classic game like Minesweeper, I gained hands-on experience with Qt widgets, event handling, layout management, and signals/slots.


Features

  • Interactive Grid : Click on tiles to reveal them, and flag them with right-click.

  • Timer : A countdown timer keeps track of how long you've been playing.

  • Flags : Place flags to mark suspected mine locations.

  • Game Over and Win Notifications : Alerts when you hit a mine or successfully clear all non-mine cells.


Prerequisites

  • Qt Creator : You'll need Qt Creator (with a version compatible with C++11 or higher) to build and run the project if you are working from source.

For Windows users:

  • You can download the executable Minesweeper.exe from the exe folder (if available) and run it directly.

For Linux/Mac users:

  • Follow the steps below to build the project.

Setup Instructions

Option 1: Build from Source (Qt Creator)

  1. Download and install Qt Creator from the official Qt website: https://www.qt.io/download .

  2. Clone this repository to your local machine.

  3. Navigate to the project directory and open the CMakeLists.txt file in Qt Creator .

  4. Click on the Build button to compile the project. This will generate the executable.

  5. After building, you can run the project directly from Qt Creator.

Option 2: Run the Executable (Windows only)

  1. Download the Minesweeper.exe file from the exe folder in the project.

  2. Navigate to the exe folder.

  3. Double-click Minesweeper.exe to run the game.

Packaging the Executable for Windows (Using windeployqt) If you're building the executable on Windows and want to distribute it, follow these steps to package the application:

  1. After building the project using Qt Creator , go to the directory where windeployqt.exe is located. This is typically inside the Qt installation folder (for example: C:\Qt\5.x.x\mingwXX_64\bin).

  2. Open Command Prompt (Terminal).

  3. Navigate to the folder where the Minesweeper.exe was built.

  4. Run the following command, replacing <path-to-mine-sweeper-exe> with the path of the Minesweeper.exe file generated from the Qt Creator build:

windeployqt.exe <path-to-mine-sweeper-exe>

This will automatically copy all the necessary Qt libraries and dependencies into the folder with your executable, allowing you to run the game on other Windows machines without needing to install Qt.


How to Play

  • Left-click : Reveal a tile.

  • Right-click : Place or remove a flag on a tile.

  • Game Over : The game ends if you reveal a mine.

  • Win : The game is won when all non-mined tiles are revealed.

About

This project was a personal learning experience aimed at revisiting and reinforcing the core concepts of Qt in a fun and practical way. By building a classic game like Minesweeper, I gained hands-on experience with Qt widgets, event handling, layout management, and signals/slots.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published