From a4238d842f964687a88d036ac6d433e78f0f64c3 Mon Sep 17 00:00:00 2001 From: Paul Bellchambers Date: Wed, 3 Feb 2021 23:18:47 +0000 Subject: [PATCH] fix: added conditional for windows build directories (#2) * docs: Added shields * fix: added conditional for windows build directories * docs: clarified documentation * chore: linting --- .github/workflows/main.yml | 23 +++++++++++++++++++++-- README.md | 12 ++++++++++-- src/engine.rs | 4 ++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d141d9..e2f2e90 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,13 +42,32 @@ jobs: - name: Format Check run: cargo fmt -- --check --verbose - name: Lint Check - run: cargo clippy --verbose + run: cargo clippy -p rustybox -- --verbose -D warnings - name: Test run: cargo test --verbose - name: Build Release run: cargo build --release --verbose - - name: Upload Artifact + - name: Upload Artifact (ubuntu) + if: ${{ matrix.build == 'ubuntu' }} uses: actions/upload-artifact@v2.2.2 with: name: rustybox-${{ matrix.build }} path: target/release/rustybox + - name: Upload Artifact (macos) + if: ${{ matrix.build == 'macos' }} + uses: actions/upload-artifact@v2.2.2 + with: + name: rustybox-${{ matrix.build }} + path: target/release/rustybox + - name: Upload Artifact (win32) + if: ${{ matrix.build == 'win32' }} + uses: actions/upload-artifact@v2.2.2 + with: + name: rustybox-${{ matrix.build }} + path: target\release\rustybox.exe + - name: Upload Artifact (win64) + if: ${{ matrix.build == 'win64' }} + uses: actions/upload-artifact@v2.2.2 + with: + name: rustybox-${{ matrix.build }} + path: target\release\rustybox.exe diff --git a/README.md b/README.md index e9fdb23..81a5ab0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ # rustybox -Mostly a sandbox for learning rust. +Mostly a sandbox for learning rust. Currently produces a console program that allows a player to move around a box with arrow keys. -Currently produces a console program that allows a player to move around a box with arrow keys. +[![Build status](https://img.shields.io/github/workflow/status/pbellchambers/rustybox/CI/main)](https://github.com/pbellchambers/rustybox/actions) +[![Downloads](https://img.shields.io/github/downloads/pbellchambers/rustybox/total)](https://github.com/pbellchambers/rustybox/releases) +![License](https://img.shields.io/github/license/pbellchambers/rustybox?color=blue) + + +## Usage +Run `rustybox` from the command line. + +Use arrow keys to move around. diff --git a/src/engine.rs b/src/engine.rs index 95c7fdf..de61560 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -34,7 +34,7 @@ fn update_entities( entity_map: &mut HashMap, viewport: &Viewport, ) { - for (_, entity) in entity_map { + for entity in entity_map.values_mut() { match entity { Entity::Player(ref mut player) => update_player_location(player, &console, &viewport), } @@ -70,7 +70,7 @@ fn check_lower_bounds(boundary: u32, current_location: i32, movement: i32) -> i3 } fn draw_entities(console: &mut ConsoleEngine, entity_map: &HashMap) { - for (_, entity) in entity_map { + for entity in entity_map.values() { match entity { Entity::Player(player) => console.print( player.location.x,