# Run with compiled executable file:
[Windows 64 bit](https://github.com/MihailRis/VoxelEngine-Cpp/releases/download/v18/voxelengine_v18_win64.zip)
[Linux x86_64 (.AppImage)](https://github.com/MihailRis/VoxelEngine-Cpp/releases/download/v18/VoxelEngine-0.18-x86_64.AppImage)
# Controls:
- **Esc** - pause
- **Tab** - open inventory
- **W** **A** **S** **D** - movement
- **Space** - jump
- **LMB** - remove block
- **RMB** - place block
- **F** - toggle flight mode
- **N** - noclip mode
- **F1** - toggle interface
- **F2** - save screenshot
- **F3** - debug mode
- **F5** - reload chunks
#### Build with CMake
```sh
git clone --recursive https://github.com/MihailRis/VoxelEngine-Cpp.git
cd VoxelEngine-Cpp
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
```
## Install libs:
#### Debian-based distro:
```sh
sudo apt install libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev
```
CMake missing LUA_INCLUDE_DIR and LUA_LIBRARIES fix:
```sh
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
```
#### RHEL-based distro:
```sh
sudo dnf install glfw-devel glfw glew-devel glm-devel libpng-devel openal-devel
```
\+ install LuaJIT
#### Arch-based distro:
If you use X11
```sh
sudo pacman -S glfw-x11 glew glm libpng openal
```
If you use Wayland
```sh
sudo pacman -S glfw-wayland glew glm libpng openal
```
\+ install LuaJIT
#### LuaJIT installation:
```sh
git clone https://luajit.org/git/luajit.git
cd luajit
make && sudo make install INSTALL_INC=/usr/include/lua
```
#### macOS:
```
brew install glfw3 glew glm libpng lua luajit openal-soft
```
If homebrew for some reason could not install the necessary packages: ```lua luajit openal-soft```, then download, install and compile them manually (Lua, LuaJIT and OpenAL).
## Build using Docker
### Step 0. Install docker on your system
See https://docs.docker.com/engine/install
### Step 1. Build docker container
```
docker build -t voxel-engine .
```
### Step 2. Build project using the docker container
```
docker run --rm -it -v$(pwd):/project voxel-engine bash -c "cmake -DCMAKE_BUILD_TYPE=Release -Bbuild && cmake --build build"
```
### Step 3. Run project using the docker container
```
docker run --rm -it -v$(pwd):/project -v/tmp/.X11-unix:/tmp/.X11-unix -v${XAUTHORITY}:/home/user/.Xauthority:ro -eDISPLAY --network=host voxel-engine ./build/VoxelEngine
```
## Build with CMake and vcpkg for Windows
```sh
git clone --recursive https://github.com/MihailRis/VoxelEngine-Cpp.git
cd VoxelEngine-Cpp
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON ..
del CMakeCache.txt
rmdir /s /q CMakeFiles
cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON ..
cmake --build . --config Release
```
note: you can use ```rm CMakeCache.txt``` and ```rm -rf CMakeFiles``` while using Git Bash
If you have issues during the vcpkg integration, try navigate to ```vcpkg\downloads``` and extract PowerShell-[version]-win-x86 to ```vcpkg\downloads\tools``` as powershell-core-[version]-windows. Then rerun ```cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON ..```