set up Rust project, delete C++ files
This commit is contained in:
parent
efa898ebaa
commit
7df31f6b5c
26 changed files with 185 additions and 930 deletions
9
build/.gitignore
vendored
9
build/.gitignore
vendored
|
@ -1,9 +1,2 @@
|
|||
CMakeFiles
|
||||
cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
compile_commands.json
|
||||
Makefile
|
||||
septadrop
|
||||
septadrop_1.0_amd64/usr/bin/septadrop
|
||||
septadrop_1.0_amd64.deb
|
||||
.cmake
|
||||
*.deb
|
|
@ -1,23 +1,6 @@
|
|||
# Building
|
||||
|
||||
This build setup is only working/tested for GNU/Linux systems. In order to have the required development dependencies, install them using your system's package manager. This is `libsfml-dev` on Debian-based systems and `sfml` on Arch-based systems. They package must be at version 2.5.
|
||||
|
||||
To compile:
|
||||
|
||||
```SH
|
||||
./build.sh
|
||||
```
|
||||
|
||||
To compile and run:
|
||||
|
||||
```SH
|
||||
./run.sh
|
||||
```
|
||||
|
||||
To run:
|
||||
```SH
|
||||
./septadrop
|
||||
```
|
||||
This build setup is only working/tested for GNU/Linux systems. In order to have the required development dependencies, install them using your system's package manager. This is `libsfml-dev` on Debian-based systems and `sfml` on Arch-based systems. The package must be at version 2.5. Since septadrop now uses Rust bindings of SFML, `libcsfml-dev` needs to also be installed on Debian-based systems, and and `csfml` on Arch-based systems.
|
||||
|
||||
## Packaging
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
# DCMAKE_EXPORT_COMPILE_COMMANDS=ON generates compile_commands.json in build folder,
|
||||
# which clangd will pick up
|
||||
# Without this, clangd might assume the wrong C++ version
|
||||
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
|
||||
python3 packer.py
|
||||
cmake --build .
|
|
@ -1,5 +1,7 @@
|
|||
TARGET=septadrop_1.0_amd64
|
||||
./build.sh
|
||||
mkdir -p ${TARGET}/usr/bin/
|
||||
cp septadrop ${TARGET}/usr/bin/
|
||||
cd ..
|
||||
cargo build --release
|
||||
cp target/release/septadrop build/${TARGET}/usr/bin/
|
||||
cd build
|
||||
dpkg-deb --build ${TARGET}
|
|
@ -1,57 +0,0 @@
|
|||
import os, shutil
|
||||
|
||||
RES_DIR = "../res/"
|
||||
PACKED_DIR = "../include/packed/"
|
||||
SHARED_HEADER_PATH = f"{PACKED_DIR}/SharedResources.hpp"
|
||||
|
||||
resources = os.fsencode(RES_DIR)
|
||||
os.makedirs(PACKED_DIR, exist_ok=True)
|
||||
packed_dir = os.fsencode(PACKED_DIR)
|
||||
|
||||
for filename in os.listdir(packed_dir):
|
||||
file_path = os.path.join(packed_dir, filename)
|
||||
if os.path.isfile(file_path) or os.path.islink(file_path):
|
||||
os.unlink(file_path)
|
||||
elif os.path.isdir(file_path):
|
||||
shutil.rmtree(file_path)
|
||||
|
||||
shared_header = "#pragma once\n\n"
|
||||
|
||||
for folder in os.listdir(resources):
|
||||
folder_path = os.path.join(resources, folder)
|
||||
if os.path.isfile(folder_path):
|
||||
continue
|
||||
packed_path = os.path.join(packed_dir, folder)
|
||||
os.makedirs(packed_path, exist_ok=True)
|
||||
for resource in os.listdir(folder_path):
|
||||
resource_path = os.path.join(folder_path, resource)
|
||||
|
||||
res = "#pragma once\n\n"
|
||||
|
||||
splitext = os.path.splitext(resource)
|
||||
name = splitext[0].decode()
|
||||
ext = splitext[1].decode()
|
||||
|
||||
if ext == ".png":
|
||||
name += "_texture"
|
||||
elif ext == ".wav":
|
||||
name += "_audio"
|
||||
name += "_data"
|
||||
|
||||
encoded = f"const unsigned char {name.upper()}[] = {'{'}"
|
||||
file = open(resource_path, "rb") # read binary
|
||||
bytes_processed = 0
|
||||
for byte in file.read():
|
||||
if bytes_processed % 16 == 0:
|
||||
encoded += "\n\t"
|
||||
encoded += f"0x{byte.to_bytes(1, byteorder='little').hex()}, "
|
||||
bytes_processed += 1
|
||||
encoded = encoded[:-2] + "\n};"
|
||||
res += encoded + "\n"
|
||||
header_name = f"{name}.hpp"
|
||||
with open(os.path.join(packed_path.decode(), header_name), "w") as f:
|
||||
f.write(res)
|
||||
shared_header += f'#include "{folder.decode()}/{header_name}"\n'
|
||||
|
||||
with open(SHARED_HEADER_PATH, "w") as f:
|
||||
f.write(shared_header)
|
|
@ -1,2 +0,0 @@
|
|||
./build.sh
|
||||
./septadrop
|
|
@ -1,10 +1,10 @@
|
|||
Package: septadrop
|
||||
Version: 1.0
|
||||
Version: 1.1
|
||||
Architecture: amd64
|
||||
Essential: no
|
||||
Priority: optional
|
||||
Maintainer: ElnuDev <elnu@elnu.com>
|
||||
Description: A block game made in C++ and SFML.
|
||||
Description: A block game made in Rust and SFML.
|
||||
Homepage: https://github.com/ElnuDev/septadrop
|
||||
Vcs-Browser: https://github.com/ElnuDev/septadrop
|
||||
Vcs-Git: https://github.com/ElnuDev/septadrop.git
|
|
@ -2,7 +2,7 @@
|
|||
Version=1.0
|
||||
Name=septadrop
|
||||
GenericName=septadrop
|
||||
Comment=A block game made in C++ and SFML.
|
||||
Comment=A block game made in Rust and SFML.
|
||||
Exec=/usr/bin/septadrop
|
||||
TryExec=/usr/bin/septadrop
|
||||
Icon=/usr/share/icons/septadrop-icon.xpm
|
Loading…
Add table
Add a link
Reference in a new issue