Skip to content

Commit

Permalink
Merge pull request #125 from red-life-project/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
Nereuxofficial authored Nov 24, 2022
2 parents 98e1c37 + 9151406 commit ad436b6
Show file tree
Hide file tree
Showing 32 changed files with 1,049 additions and 236 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Run cargo test w/ -D warnings
if: ${{ runner.os == 'Linux' }}
run: cargo test headless -- --test-threads=1
run: cargo test -- --test-threads=1
#env:
#RUSTFLAGS: "-D warnings"

Expand Down Expand Up @@ -92,4 +92,4 @@ jobs:
run: sudo apt-get update; sudo apt-get install --no-install-recommends libudev-dev

- name: Run cargo clippy --package game --all-targets -- -D warnings
run: cargo clippy --package game --all-targets #-- -D warnings
run: cargo clippy --package game --all-targets #-- -D warnings
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# Save files
saves/

game/saves/

Binary file added assets/3D-gedrucktes-Teil.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 assets/Benzin.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 assets/SuperGlue.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 modified assets/icon.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 modified assets/mainmenu.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 modified assets/player.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 assets/test_Maschiene.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion game/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ serde = "1.0.145"
serde_yaml = "0.9.13"
ggez = "0.8.1"
dyn-clone = "1.0.9"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
fastrand = "1.8.0"
chrono = "0.4.23"

[build-dependencies]
fs_extra = "1.2.0"

[profile.dev.package.'*']
opt-level = 3
opt-level = 3

[profile.release]
lto = true
panic = "abort"
4 changes: 4 additions & 0 deletions game/src/backend/area.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use crate::backend::utils::is_colliding;
use crate::game_core::player::Player;
use dyn_clone::DynClone;
use ggez::graphics::Rect;
use std::fmt::Debug;

pub trait Area: DynClone + Debug {
fn interact(&mut self, player: &Player);
fn is_interactable(&self, pos: (usize, usize)) -> bool {
is_colliding(pos, &self.get_interaction_area())
}
fn get_collision_area(&self) -> Rect;
fn get_interaction_area(&self) -> Rect;
}
21 changes: 19 additions & 2 deletions game/src/backend/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use crate::backend::screen::StackCommand;
use ggez::GameError;
use std::io;
use std::sync::mpsc::SendError;
use tracing::error;

#[warn(clippy::enum_variant_names)]
#[derive(Debug)]
pub enum RLError {
Expand All @@ -11,18 +15,31 @@ pub enum RLError {

impl From<GameError> for RLError {
fn from(e: GameError) -> Self {
error!("GameError: {}", e);
RLError::Ui(e)
}
}

impl From<serde_yaml::Error> for RLError {
fn from(e: serde_yaml::Error) -> Self {
error!("Deserialization Error: {}", e);
RLError::Deserialization(e)
}
}

impl From<std::io::Error> for RLError {
fn from(e: std::io::Error) -> Self {
impl From<io::Error> for RLError {
fn from(e: io::Error) -> Self {
error!("IO Error: {}", e);
RLError::IO(e)
}
}

impl From<SendError<StackCommand>> for RLError {
fn from(value: SendError<StackCommand>) -> Self {
error!("Could not send StackCommand: {}", value);
RLError::IO(io::Error::new(
io::ErrorKind::Other,
format!("Could not send StackCommand: {}", value),
))
}
}
Loading

0 comments on commit ad436b6

Please sign in to comment.