Compare commits

..

3 Commits

7 changed files with 32 additions and 13 deletions

View File

@@ -1,8 +1,9 @@
[target.wasm32-unknown-emscripten]
# TODO: Document what the fuck this is.
rustflags = [
"-O", "-C", "link-args=-O2 --profiling",
#"-C", "link-args=-O3 --closure 1",
"-C", "link-args=-sASYNCIFY -sALLOW_MEMORY_GROWTH=1",
"-C", "link-args=-sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS=['png']",
"-C", "link-args=-sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL_EMSCRIPTEN_KEYBOARD_ELEMENT -sSDL2_IMAGE_FORMATS=['png']",
"-C", "link-args=--preload-file assets/ -lidbfs.js",
]

View File

@@ -1,7 +0,0 @@
& cargo build --target=wasm32-unknown-emscripten --release
mkdir -p dist -Force
cp ./target/wasm32-unknown-emscripten/release/Pac_Man.wasm ./dist
cp ./target/wasm32-unknown-emscripten/release/Pac-Man.js ./dist
cp index.html dist

View File

@@ -1,5 +1,5 @@
#!/bin/sh
set -eux
set -eu
echo "Building WASM with Emscripten"
cargo build --target=wasm32-unknown-emscripten --release

28
scripts/build-windows.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -eu
SDL_VERSION="2.28.3"
SDL_IMAGE_VERSION="2.6.3"
SDL_MIXER_VERSION="2.6.3"
SDL_TTF_VERSION="2.20.2"
SDL="https://github.com/libsdl-org/SDL/releases/download/release-${SDL_VERSION}/SDL2-devel-${SDL_VERSION}-mingw.tar.gz"
SLD_IMAGE="https://github.com/libsdl-org/SDL_image/releases/download/release-${SDL_IMAGE_VERSION}/SDL2_image-devel-${SDL_IMAGE_VERSION}-mingw.tar.gz"
SDL_MIXER="https://github.com/libsdl-org/SDL_mixer/releases/download/release-${SDL_MIXER_VERSION}/SDL2_mixer-devel-${SDL_MIXER_VERSION}-mingw.tar.gz"
SDL_TTF="https://github.com/libsdl-org/SDL_ttf/releases/download/release-${SDL_TTF_VERSION}/SDL_ttf-devel-${SDL_TTF_VERSION}-mingw.tar.gz"
# Verify that toolchain is installed
# EXTRACT_DIR="~/.rustup/"
EXTRACT_DIR="~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/"
# if [ ! -d "~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/" ]; then
# ls $EXTRACT_DIR
# echo "Toolchain not installed. Run rustup target add x86_64-pc-windows-gnu. This may not work on environments besides Linux GNU."
# exit 1
# fi
echo "Downloading..."
curl -L -o ./sdl2.tar.gz $SDL
curl -L -o ./sdl2_image.tar.gz $SLD_IMAGE
echo "Done."

View File

@@ -1,3 +0,0 @@
& ./build.ps1
cd ./dist
python -m http.server

View File

@@ -92,6 +92,7 @@ impl<'a> AnimatedTexture<'a> {
direction: Direction,
frame: u32,
) {
// TODO: If the frame we're targeting is in the opposite direction (due to self.reverse), we should pre-emptively reverse.
let current = self.current_frame();
self.render_static(canvas, position, direction, Some(current));

View File

@@ -5,7 +5,6 @@ use sdl2::keyboard::Keycode;
use sdl2::render::{Texture, TextureCreator};
use sdl2::video::WindowContext;
use sdl2::{pixels::Color, render::Canvas, video::Window};
use tracing::event;
use crate::constants::{MapTile, BOARD_HEIGHT, BOARD_WIDTH, RAW_BOARD};
use crate::direction::Direction;