Skip to content

therealvidem/Minesweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minesweeper

Overview

A simple Minesweeper game coded in C using RayLib.

TODO

  • Implement the backend of basic game functionality.
  • Implement the frontend (UI) of basic game functionality.
  • Add some basic testing.
  • Implement the flood fill algorithm for opening empty cells.
  • Implement chording.
  • Add info texts, such as number of mines and a timer.
  • Add end screen.
  • Implement menu functionality.
  • Add multiple difficulties/sizes.
  • Add custom sizes.
  • Add (optional) animations.

Project Structure

The minesweeper/ folder contains the standalone library for the underlying Minesweeper game. This means any other project could utilize this library to make another interface. Using CMake, this is integrated into this game as a static library.

The src/ folder contains the code for the actual game itself, utilizing the minesweeper/ library. It uses RayLib to draw the game as well as handle user input. The src/ folder is split into two other components: src/graphics/ and src/input/, each handling their respective domain every frame in the game.

The assets/ folder contains all assets for the game, including textures and sounds.

Developing

This project uses CMake to organize the building process (and, hopefully soon, testing process).

Fortunately, you do not have to have RayLib installed prior to using this project's CMake, as the CMakeLists.txt provided automatically installs RayLib if it is not found on your system.

Do note, however, that there are prerequisites for Linux, as outlined in Linux Prerequisites.

Regardless, I personally develop on Windows and use vcpkg to install RayLib outside the project.

Manually Installing RayLib on Windows

I personally use vcpkg to install the RayLib package. Note that when building your CMake build folder, you must set the CMAKE_TOOLCHAIN_FILE flag to [your vcpkg location]/scripts/buildsystems/vcpkg.cmake. This can be done by running the following command inside the build folder (build/):

cmake -DCMAKE_TOOLCHAIN_FILE="[your vcpkg location]/scripts/buildsystems/vcpkg.cmake" ..

If using VSCode, you can in use the following setting to make the CMake extension automatically use the flag:

"cmake.configureSettings": {
    "CMAKE_TOOLCHAIN_FILE": "[your vcpkg location]/scripts/buildsystems/vcpkg.cmake"
}

Manually Installing RayLib on Linux

Follow this guide on the RayLib wiki.

Linux Prerequisites

In order for RayLib to be installed, the libraries outlined here are necessary.

Note that OpenGL 3.3 is required for RayLib 3.5, which is the currently required version of this game. The game may not run properly otherwise, if at all.

Building

Setup CMake first by making the build folder build/ and running CMake inside of it:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..

Note for Windows users using vcpkg: Add the flag -DCMAKE_TOOLCHAIN_FILE="[your vcpkg location]/scripts/buildsystems/vcpkg.cmake".

Note that to build for release, use -DCMAKE_BUILD_TYPE=Release instead of -DCMAKE_BUILD_TYPE=Debug.

Finally, to build, run the following command:

cmake --build build/

The resulting binary or executable should be inside build/.

About

Minesweeper game using RayLib

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors