mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-06 07:15:41 -06:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a1f565f72 | |||
| 2ddf2611d9 | |||
| b3a3664578 | |||
| 2b667bb6a2 | |||
| 9a88e71202 |
28
.cargo/config.toml
Normal file
28
.cargo/config.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
[target.wasm32-unknown-emscripten]
|
||||
rustflags = [
|
||||
"-C",
|
||||
"link-arg=-s",
|
||||
"-C",
|
||||
"link-arg=FULL_ES2",
|
||||
"-C",
|
||||
"link-arg=-s",
|
||||
"-C",
|
||||
"link-arg=FULL_ES3",
|
||||
"-C",
|
||||
"link-arg=-s",
|
||||
"-C",
|
||||
"link-arg=USE_SDL=2",
|
||||
"-C",
|
||||
"link-arg=-s",
|
||||
"-C",
|
||||
"link-arg=MAX_WEBGL_VERSION=2 ",
|
||||
"-C",
|
||||
"link-arg=-s",
|
||||
"-C",
|
||||
"link-arg=MIN_WEBGL_VERSION=2",
|
||||
"-C",
|
||||
"link-arg=-s",
|
||||
"-C",
|
||||
"link-arg=ERROR_ON_UNDEFINED_SYMBOLS=0", # for ignoring some egl symbols. needed for wgpu
|
||||
|
||||
]
|
||||
28
.github/workflows/deploy.yaml
vendored
Normal file
28
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Github Pages
|
||||
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-github-pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2 # repo checkout
|
||||
- uses: mymindstorm/setup-emsdk@v11 # setup emscripten toolchain
|
||||
# with:
|
||||
# version: 3.1.35
|
||||
- uses: actions-rs/toolchain@v1 # get rust toolchain for wasm
|
||||
with:
|
||||
toolchain: stable
|
||||
target: wasm32-unknown-emscripten
|
||||
override: true
|
||||
- name: Rust Cache # cache the rust build artefacts
|
||||
uses: Swatinem/rust-cache@v1
|
||||
- name: Build # build
|
||||
run: ./build.sh
|
||||
- name: Deploy
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
folder: dist
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/target
|
||||
.idea
|
||||
10
build.sh
Executable file
10
build.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -eux
|
||||
|
||||
cargo build --target=wasm32-unknown-emscripten --release
|
||||
|
||||
mkdir -p dist
|
||||
|
||||
cp target/wasm32-unknown-emscripten/release/rust_sdl2_wasm.wasm dist
|
||||
cp target/wasm32-unknown-emscripten/release/rust-sdl2-wasm.js dist
|
||||
cp index.html dist
|
||||
21
index.html
Normal file
21
index.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas"></canvas>
|
||||
<script type="text/javascript">
|
||||
const Module = {
|
||||
canvas: (function () {
|
||||
// this is how we provide a canvas to our sdl2
|
||||
return document.getElementById("canvas");
|
||||
})(),
|
||||
preRun: [function () {
|
||||
ENV.RUST_LOG = "info,wgpu=warn"
|
||||
}]
|
||||
};
|
||||
</script>
|
||||
<script src="rust-sdl2-wasm.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
0
src/board.rs
Normal file
0
src/board.rs
Normal file
44
src/constants.rs
Normal file
44
src/constants.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
pub const BOARD_WIDTH: u32 = 28;
|
||||
pub const BOARD_HEIGHT: u32 = 36;
|
||||
pub const BLOCK_SIZE_24: u32 = 24;
|
||||
pub const BLOCK_SIZE_32: u32 = 32;
|
||||
|
||||
pub const WINDOW_WIDTH: u32 = BLOCK_SIZE_24 * BOARD_WIDTH;
|
||||
pub const WINDOW_HEIGHT: u32 = BLOCK_SIZE_24 * BOARD_HEIGHT;
|
||||
|
||||
pub const RAW_BOARD: &str = r###"
|
||||
|
||||
|
||||
############################
|
||||
#............##............#
|
||||
#.####.#####.##.#####.####.#
|
||||
#o####.#####.##.#####.####o#
|
||||
#.####.#####.##.#####.####.#
|
||||
#..........................#
|
||||
#.####.##.########.##.####.#
|
||||
#.####.##.########.##.####.#
|
||||
#......##....##....##......#
|
||||
######.##### ## #####.######
|
||||
#.##### ## #####.#
|
||||
#.## 1 ##.#
|
||||
#.## ###==### ##.#
|
||||
######.## # # ##.######
|
||||
. #2 3 4 # .
|
||||
######.## # # ##.######
|
||||
#.## ######## ##.#
|
||||
#.## ##.#
|
||||
#.## ######## ##.#
|
||||
######.## ######## ##.######
|
||||
#............##............#
|
||||
#.####.#####.##.#####.####.#
|
||||
#.####.#####.##.#####.####.#
|
||||
#o..##.......0 .......##..o#
|
||||
###.##.##.########.##.##.###
|
||||
###.##.##.########.##.##.###
|
||||
#......##....##....##......#
|
||||
#.##########.##.##########.#
|
||||
#.##########.##.##########.#
|
||||
#..........................#
|
||||
############################
|
||||
|
||||
"###;
|
||||
11
src/game.rs
Normal file
11
src/game.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
pub struct Game {}
|
||||
|
||||
impl Game {
|
||||
pub fn new() -> Game {
|
||||
Game {}
|
||||
}
|
||||
|
||||
pub fn tick() {}
|
||||
|
||||
pub fn draw() {}
|
||||
}
|
||||
Reference in New Issue
Block a user