diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..668b596c9 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,43 @@ +ARG VARIANT=debian-12 +FROM mcr.microsoft.com/devcontainers/base:${VARIANT} +USER root + +# Install APT packages +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install tar curl zip unzip bash-completion build-essential ripgrep htop \ + ninja-build ccache g++ mold gdb clang-format clang-tidy \ + rpm pkg-config cmake git smpq gettext libsdl2-dev libsdl2-image-dev libsodium-dev \ + libpng-dev libbz2-dev libfmt-dev libgtest-dev libgmock-dev libsimpleini-dev zsh \ + qtbase5-dev qt6-base-dev ristretto \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# Install devilutionx-graphics-tools +RUN git clone https://github.com/diasurgical/devilutionx-graphics-tools.git /tmp/devilutionx-graphics-tools && \ + cd /tmp/devilutionx-graphics-tools && \ + cmake -S. -Bbuild-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \ + cmake --build build-rel -j $(getconf _NPROCESSORS_ONLN) && \ + cmake --install build-rel --component Binaries && \ + rm -rf /tmp/devilutionx-graphics-tools + +# Install devilutionx-mpq-tools +RUN git clone https://github.com/diasurgical/devilutionx-mpq-tools.git /tmp/devilutionx-mpq-tools && \ + cd /tmp/devilutionx-mpq-tools && \ + cmake -S. -Bbuild-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \ + cmake --build build-rel -j $(getconf _NPROCESSORS_ONLN) && \ + cmake --install build-rel && \ + rm -rf /tmp/devilutionx-mpq-tools + +# Install d1-graphics-tool +RUN curl -O -L https://github.com/diasurgical/d1-graphics-tool/releases/latest/download/D1GraphicsTool-Linux-x64.deb && \ + dpkg -i D1GraphicsTool-Linux-x64.deb && \ + rm D1GraphicsTool-Linux-x64.deb + +# Download spawn.mpq and fonts.mpq +RUN curl --create-dirs -O -L --output-dir /usr/local/share/diasurgical/devilutionx/ \ + https://github.com/diasurgical/devilutionx-assets/releases/latest/download/spawn.mpq && \ + curl --create-dirs -O -L --output-dir /usr/local/share/diasurgical/devilutionx/ \ + https://github.com/diasurgical/devilutionx-assets/releases/latest/download/fonts.mpq && \ + chown -R vscode: /usr/local/share/diasurgical/ + +# Desktop environment configuration +COPY fluxbox /home/vscode/.fluxbox/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..6bdd635a3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "github.vscode-github-actions", + "ms-vscode.cmake-tools" + ] + } + }, + "features": { + // https://github.com/devcontainers/features/tree/main/src/desktop-lite + "ghcr.io/devcontainers/features/desktop-lite:1": { + "webPort": 6080, + "password": "vscode" + }, + "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {}, + "ghcr.io/stuartleeks/dev-container-features/shell-history:0": {} + }, + "forwardPorts": [ + 6080 + ], + "portsAttributes": { + "6080": { + "label": "desktop" + } + } +} diff --git a/.devcontainer/fluxbox/apps b/.devcontainer/fluxbox/apps new file mode 100644 index 000000000..df1a03c86 --- /dev/null +++ b/.devcontainer/fluxbox/apps @@ -0,0 +1,7 @@ +[transient] (role=GtkFileChooserDialog) + [Dimensions] {70% 70%} + [Position] (CENTER) {0 0} +[end] +[app] (name=AppRun) (class=tiled) + [Fullscreen] {yes} +[end] diff --git a/.devcontainer/fluxbox/menu b/.devcontainer/fluxbox/menu new file mode 100644 index 000000000..a01a06abc --- /dev/null +++ b/.devcontainer/fluxbox/menu @@ -0,0 +1,20 @@ +[begin] ( Application Menu ) + [exec] (File Manager) { nautilus /workspaces/devilutionX } + [exec] (D1 Graphics Tool) { D1GraphicsTool } <> + [exec] (Text Editor) { mousepad } <> + [exec] (Terminal) { tilix -w ~ -e $(readlink -f /proc/$$/exe) -il } <> + [exec] (Web Browser) { x-www-browser --disable-dev-shm-usage } <> + [submenu] (System) {} + [exec] (Set Resolution) { tilix -t "Set Resolution" -e bash /usr/local/bin/set-resolution } <> + [exec] (Edit Application Menu) { mousepad ~/.fluxbox/menu } <> + [exec] (Passwords and Keys) { seahorse } <> + [exec] (Top Processes) { tilix -t "Top" -e htop } <> + [exec] (Disk Utilization) { tilix -t "Disk Utilization" -e ncdu / } <> + [exec] (Editres) {editres} <> + [exec] (Xfontsel) {xfontsel} <> + [exec] (Xkill) {xkill} <> + [exec] (Xrefresh) {xrefresh} <> + [end] + [config] (Configuration) + [workspaces] (Workspaces) +[end] diff --git a/docs/gh-codespaces-ports-browser.png b/docs/gh-codespaces-ports-browser.png new file mode 100644 index 000000000..6778f5a28 Binary files /dev/null and b/docs/gh-codespaces-ports-browser.png differ diff --git a/docs/github-codespaces.md b/docs/github-codespaces.md new file mode 100644 index 000000000..690d0a319 --- /dev/null +++ b/docs/github-codespaces.md @@ -0,0 +1,13 @@ +# Developing with GitHub Codespaces + +A GitHub codespace container with all dependencies and several useful tools preinstalled is configured in the `.devcontainer` directory. + +You can go to https://github.dev/diasurgical/devilutionX/ and immediately begin developing. + +To view the graphical desktop of the container, click Ports > Browser. + +The password is `vscode`. + +![screenshot](gh-codespaces-ports-browser.png) + +For more information about the deskopt envorinonment, see https://github.com/devcontainers/features/tree/main/src/desktop-lite \ No newline at end of file