This is one of my school projects written in C++. Now, it's open source for anyone who is interested in C programming.
| Command | Behavior |
|---|---|
Left |
Move left |
Right |
Move right |
Down |
Faster drop |
Space |
Instant drop |
X or Z |
Rotate block |
First, you'll need to install Conan 2, a C and C++ package manager.
Next, create a Conan profile:
conan profile list
conan profile show -pr default
Here is my profile configuration for reference:
| Macos | Windows |
|---|---|
| [settings] | [settings] |
| arch=x86_64 | arch=x86_64 |
| build_type=Release | build_type=Release |
| compiler=apple-clang | compiler=gcc |
| compiler.cppstd=gnu17 | compiler.cppstd=14 |
| compiler.libcxx=libc++ | compiler.libcxx=libstdc++11 |
| compiler.version=15 | compiler.version=13 |
| os=Macos | os=Windows |
Once you have configured your Conan profile, navigate to the project directory to pull dependencies.
conan install conanfile.txt --build=missingYou will notice that a CMakeUserPresets.json file is generated, making it easy to use the new CMake command.
conanfile.txt: CMakeToolchain generated: CMakeUserPresets.jsonThen, run these commands to build the app:
cmake --preset conan-release
cmake --build --preset conan-releaseAlternatively, you can use Visual Studio Code to compile, checkout the configuration from the vscode branch:
| OS | Build |
|---|---|
| Macos | Command + Shift + B |
| Windows | Ctrl + Shift + B |
After that, the build is successfully created in the build/Release folder.
-- Build files have been written to: tetris/build/ReleaseFinally, to run the game, navigate to the Release folder in the terminal, then run the command:
./tetris
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or feedback, please contact Justin at justin@pixelcarrot.com or visit pixelcarrot.com.
