Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
BJMinhNhut committed Jan 8, 2024
1 parent 9b91eba commit 3b6d6d9
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 103 deletions.
165 changes: 62 additions & 103 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,103 +1,62 @@
# CMake SFML Project Template

This repository template should allow for a fast and hassle-free kick start of your next SFML project using CMake.
Thanks to [GitHub's nature of templates](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template), you can fork this repository without inheriting its Git history.

The template starts out very basic, but might receive additional features over time:

- Basic CMake script to build your project and link SFML on any operating system
- Basic [GitHub Actions](https://github.com/features/actions) script for all major platforms

## How to Use

1. Follow the above instructions about how to use GitHub's project template feature to create your own project.
1. Open [CMakeLists.txt](CMakeLists.txt). Rename the project and the executable to whatever name you want. The project and executable names don't have to match.
1. If you want to add or remove any .cpp files, change the source files listed in the [`add_executable`](CMakeLists.txt#L10) call in CMakeLists.txt to match the source files your project requires. If you plan on keeping the default main.cpp file then no changes are required.
1. If you use Linux, install SFML's dependencies using your system package manager. On Ubuntu and other Debian-based distributions you can use the following commands:
```
sudo apt update
sudo apt install \
libxrandr-dev \
libxcursor-dev \
libudev-dev \
libfreetype-dev \
libopenal-dev \
libflac-dev \
libvorbis-dev \
libgl1-mesa-dev \
libegl1-mesa-dev
```
1. Configure and build your project. Most popular IDEs support CMake projects with very little effort on your part.
- [VS Code](https://code.visualstudio.com) via the [CMake extension](https://code.visualstudio.com/docs/cpp/cmake-linux)
- [Visual Studio](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170)
- [CLion](https://www.jetbrains.com/clion/features/cmake-support.html)
- [Qt Creator](https://doc.qt.io/qtcreator/creator-project-cmake.html)

Using CMake from the command line is straightforward as well.

For a single-configuration generator (typically the case on Linux and macOS):
```
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
```

For a multi-configuration generator (typically the case on Windows):
```
cmake -S . -B build
cmake --build build --config Release
```
1. Enjoy!

## Upgrading SFML

SFML is found via CMake's [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) module.
FetchContent automatically downloads SFML from GitHub and builds it alongside your own code.
Beyond the convenience of not having to install SFML yourself, this ensures ABI compatability and simplifies things like specifying static versus shared libraries.

Modifying what version of SFML you want is as easy as changing the [`GIT_TAG`](CMakeLists.txt#L7) argument.
Currently it uses the latest in-development version of SFML 2 via the `2.6.x` tag.
If you're feeling adventurous and want to give SFML 3 a try, use the `master` tag.
Beware, this requires changing your code to suit the modified API!
The nice folks in the [SFML community](https://github.com/SFML/SFML#community) can help you with that transition and the bugs you may encounter along the way.

## But I want to...

Modify CMake options by adding them as configuration parameters (with a `-D` flag) or by modifying the contents of CMakeCache.txt and rebuilding.

### Use Static Libraries

By default SFML builds shared libraries and this default is inherited by your project.
CMake's [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) option lets you pick static or shared libraries for the entire project.

### Change Compilers

See the variety of [`CMAKE_<LANG>_COMPILER`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html) options.
In particular you'll want to modify `CMAKE_CXX_COMPILER` to point to the C++ compiler you wish to use.

### Change Compiler Optimizations

CMake abstracts away specific optimizer flags through the [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) option.
By default this project recommends `Release` builds which enable optimizations.
Other build types include `Debug` builds which enable debug symbols but disable optimizations.
If you're using a multi-configuration generator (as is often the case on Windows), you can modify the [`CMAKE_CONFIGURATION_TYPES`](https://cmake.org/cmake/help/latest/variable/CMAKE_CONFIGURATION_TYPES.html#variable:CMAKE_CONFIGURATION_TYPES) option.

### Change Generators

While CMake will attempt to pick a suitable default generator, some systems offer a number of generators to choose from.
Ubuntu, for example, offers Makefiles and Ninja as two potential options.
For a list of generators, click [here](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
To modify the generator you're using you must reconfigure your project providing a `-G` flag with a value corresponding to the generator you want.
You can't simply modify an entry in the CMakeCache.txt file unlike the above options.
Then you may rebuild your project with this new generator.

## More Reading

Here are some useful resources if you want to learn more about CMake:

- [How to Use CMake Without the Agonizing Pain - Part 1](https://alexreinking.com/blog/how-to-use-cmake-without-the-agonizing-pain-part-1.html)
- [How to Use CMake Without the Agonizing Pain - Part 2](https://alexreinking.com/blog/how-to-use-cmake-without-the-agonizing-pain-part-2.html)
- [Better CMake YouTube series by Jefferon Amstutz](https://www.youtube.com/playlist?list=PL8i3OhJb4FNV10aIZ8oF0AA46HgA2ed8g)

## License

The source code is dual licensed under Public Domain and MIT -- choose whichever you prefer.
# Chess & Chill - CS202 OOP Project

## 1. Project Description
Author: Nhut Dang - HCMUS - 22APCS1 - 22125071.

This is a CS202 Solo Lab Project using C++. The project is a basic chess game with GUI, that help players learn to play chess. The game also have a chess engine that can play against the player, and analyze the board. The game also provides chess puzzles, chess variations, and data of played games.

## 2. Features
- [x] Basic chess game with GUI.
- [x] **3** game modes: Player vs Player, Player vs Computer, Computer vs Computer.
- [x] Multiple time limit options: 1 min, 3 mins, 5 mins, 10 mins, 15 mins, 30 mins,...
- [x] Chess engine that can play against the player, and analyze the board.
- [x] **100** chess puzzles (read from .csv file)
- [x] **2** chess variations.
- [Chess960](https://vi.wikipedia.org/wiki/Chess960).
- [King of the Hill](https://www.chess.com/terms/king-of-the-hill).
- [x] Save & load old games for reviewing (using binary file).
- [x] Customizable game settings.
- [x] **9** board themes
- [x] **8** piece sets themes
- [x] Sound on/off

## 3. Screenshots & Demo
- Youtube demo [here]().
- Screenshots:
- Main menu:

![Main menu](demo1.png)
- Game:

- ![Game](demo2.png)
- Game settings:

- ![Game settings](demo3.png)
- Puzzle:

- ![Puzzle](demo4.png)
- Variation:

- ![Variation](demo5.png)
- Old games data:

- ![Game data](demo6.png)

## 4. How to run
### 4.1. Build from source
- Clone the repository.
- Open the project in Visual Studio (or any IDE).
- Build the project.
- Run the executable file.

### 4.2. Run the executable file (Windows only)
- Download the `ChessChill_vx.x.zip` file from a release [here](https://github.com/BJMinhNhut/Chess/releases).
- Extract the zip file.
- Run the `Chess-Chill.exe` file.

## 5. References
- [Chess Programming Wiki](https://www.chessprogramming.org/Main_Page)
- [Ameye's blog](https://ameye.dev/notes/chess-engine/)
- [Lichess puzzle database](https://www.kaggle.com/datasets/reinism/lichess-database-puzzles)
- [Lichess themes](https://github.com/lichess-org/lila/tree/master/public)
- [Chess.com sound effects](https://www.chess.com/forum/view/general/chessboard-sound-files)
Binary file added demo1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/images/gui/about_panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3b6d6d9

Please sign in to comment.