Compare commits

...

5 Commits

3 changed files with 25 additions and 29 deletions

View File

@@ -6,7 +6,7 @@ permissions:
contents: write contents: write
env: env:
RUST_TOOLCHAIN: 1.88.0 RUST_TOOLCHAIN: 1.86.0
jobs: jobs:
wasm: wasm:
@@ -72,19 +72,11 @@ jobs:
- name: Vcpkg - name: Vcpkg
run: | run: |
cargo install cargo-vcpkg cargo install cargo-vcpkg
cargo vcpkg build cargo vcpkg -v build
- name: Build - name: Build
run: cargo build --release run: cargo build --release
- name: Assemble Archive
run: |
mkdir /tmp/example/
cp ./target/release/pacman /tmp/example/
chmod a+x /tmp/example/pacman
mkdir /tmp/example/assets
cp ./assets/TerminalVector.ttf ./assets/fruit.png /tmp/example/assets
- name: Install Cargo Binstall - name: Install Cargo Binstall
uses: cargo-bins/cargo-binstall@main uses: cargo-bins/cargo-binstall@main
@@ -98,7 +90,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}" name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}"
path: /tmp/example/ path: ./target/release/pacman
retention-days: 7 retention-days: 7
if-no-files-found: error if-no-files-found: error
@@ -128,13 +120,6 @@ jobs:
- name: Build - name: Build
run: cargo build --release run: cargo build --release
- name: Assemble Archive
run: |
mkdir /tmp/example/
cp ./target/release/pacman /tmp/example/
mkdir /tmp/example/assets
cp ./assets/TerminalVector.ttf ./assets/fruit.png /tmp/example/assets
- name: Install Cargo Binstall - name: Install Cargo Binstall
uses: cargo-bins/cargo-binstall@main uses: cargo-bins/cargo-binstall@main
@@ -148,7 +133,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}" name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}"
path: /tmp/example/ path: ./target/release/pacman
retention-days: 7 retention-days: 7
if-no-files-found: error if-no-files-found: error
@@ -183,14 +168,6 @@ jobs:
- name: Build - name: Build
run: cargo build --release run: cargo build --release
- name: Prepare Archive
run: |
New-Item -Type Directory ./release/
Move-Item -Path ./target/release/pacman.exe -Destination ./release/
Move-Item -Path ./SDL2.dll, ./SDL2_image.dll, ./SDL2_ttf.dll, ./SDL2_mixer.dll, ./SDL2_gfx.dll -Destination ./release/
New-Item -Type Directory ./release/assets/
Move-Item -Path ./assets/TerminalVector.ttf, ./assets/fruit.png -Destination ./release/assets/
- name: Install Cargo Binstall - name: Install Cargo Binstall
uses: cargo-bins/cargo-binstall@main uses: cargo-bins/cargo-binstall@main
@@ -204,6 +181,6 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}" name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}"
path: ./release/ path: ./target/release/pacman.exe
retention-days: 7 retention-days: 7
if-no-files-found: error if-no-files-found: error

View File

@@ -35,7 +35,7 @@ default-features = false
features = ["ttf","image","gfx","mixer","static-link","use-vcpkg"] features = ["ttf","image","gfx","mixer","static-link","use-vcpkg"]
[package.metadata.vcpkg] [package.metadata.vcpkg]
dependencies = ["sdl2", "sdl2-image[libjpeg-turbo,tiff,libwebp]", "sdl2-ttf", "sdl2-gfx", "sdl2-mixer"] dependencies = ["sdl2", "sdl2-image", "sdl2-ttf", "sdl2-gfx", "sdl2-mixer"]
git = "https://github.com/microsoft/vcpkg" git = "https://github.com/microsoft/vcpkg"
rev = "2024.05.24" # release 2024.05.24 # to check for a new one, check https://github.com/microsoft/vcpkg/releases rev = "2024.05.24" # release 2024.05.24 # to check for a new one, check https://github.com/microsoft/vcpkg/releases

View File

@@ -31,6 +31,25 @@ pub enum Asset {
// Add more as needed // Add more as needed
} }
impl Asset {
pub fn path(&self) -> &str {
use Asset::*;
match self {
Wav1 => "wav/1.ogg",
Wav2 => "wav/2.ogg",
Wav3 => "wav/3.ogg",
Wav4 => "wav/4.ogg",
Pacman => "32/pacman.png",
Pellet => "24/pellet.png",
Energizer => "24/energizer.png",
Map => "map.png",
FontKonami => "font/konami.ttf",
GhostBody => "32/ghost_body.png",
GhostEyes => "32/ghost_eyes.png",
}
}
}
#[cfg(not(target_os = "emscripten"))] #[cfg(not(target_os = "emscripten"))]
mod imp { mod imp {
use super::*; use super::*;