Skip to content

Commit

Permalink
test browser version
Browse files Browse the repository at this point in the history
  • Loading branch information
helio-frota committed Oct 21, 2024
1 parent 7f7b73c commit bfd3c37
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 69 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: write
pages: write

jobs:
ci:
runs-on: ubuntu-latest
Expand All @@ -18,3 +20,15 @@ jobs:
run: cargo check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_used
- name: Build wasm
run: cargo build --release --target wasm32-unknown-unknown
- name: Prepare deploy dir
run: |
mkdir -p ./deploy
cp ./target/wasm32-unknown-unknown/release/tuco.wasm ./deploy/
cp index.html ./deploy/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
tuco.wasm
Binary file added 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 0 additions & 58 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ edition = "2021"
[dependencies]
macroquad = { version = "0.4", features = ["audio"] }
anyhow = "1"
rand = "0.8"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Rust version of [a game I made years ago](https://github.com/helio-frota/ecstasy
cargo run
```

![status](./status.png)
![status](./1.png)

![status2](./status2.png)
![status2](./2.png)
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>tuco</title>
<style>
html,
body,
canvas {
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background: black;
z-index: 0;
}
</style>
</head>
<body>
<canvas id="glcanvas" tabindex='1'></canvas>
<script src="https://not-fl3.github.io/miniquad-samples/mq_js_bundle.js"></script>
<script>load("tuco.wasm");</script>
</body>
</html>
6 changes: 1 addition & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ use macroquad::{
prelude::*,
};

extern crate rand;
use rand::Rng;

#[derive(Clone)]
struct Player {
x: f32,
Expand All @@ -32,8 +29,7 @@ const RIGHT_TOP: u8 = 2;
const RIGHT_BOTTOM: u8 = 3;

fn rand_gold_position() -> u8 {
let mut rng = rand::thread_rng();
rng.gen_range(0..=3) as u8
rand::gen_range(0, 3)
}

fn basic_collision(
Expand Down
Binary file removed status.png
Binary file not shown.
Binary file removed status2.png
Binary file not shown.

0 comments on commit bfd3c37

Please sign in to comment.