Compare commits

..

2 Commits

Author SHA1 Message Date
Joachim Lusiardi c429784775 run tests on all branches 2024-10-30 13:06:26 +01:00
Joachim Lusiardi e96660cea0 redo some colors 2024-10-30 13:01:28 +01:00
3 changed files with 28 additions and 11 deletions

View File

@ -0,0 +1,16 @@
name: publish package
on:
push:
branches-ignore:
- main
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: run tests
run: |
cd ${{ gitea.workspace }}
cargo test

View File

@ -39,7 +39,7 @@ impl Chest {
impl Artifact for Chest {
fn get_representation(&self) -> (&str, Color) {
("C", Color::Blue)
("C", Color::Cyan)
}
fn get_immutable_position(&self) -> &Position {

View File

@ -7,7 +7,8 @@ use crate::game::Game;
use crate::level::StructureElement;
use crate::position::HasPosition;
const FG_BROWN: Color = Color::Rgb(186, 74, 0);
const FG_BROWN: Color = Color::Rgb(140, 34, 0);
const BACKGROUND: Color = Color::Black;
pub struct LevelWidget {}
@ -42,36 +43,36 @@ impl StatefulWidget for LevelWidget {
(Some(structure_element), None, None) => {
match structure_element {
StructureElement::Start => {
self.set_cell(buf, x, y, "α", Color::Black, Color::Gray);
self.set_cell(buf, x, y, "α", Color::White, BACKGROUND);
}
StructureElement::End => {
self.set_cell(buf, x, y, "Ω", Color::Black, Color::Gray);
self.set_cell(buf, x, y, "Ω", Color::White, BACKGROUND);
}
StructureElement::Wall => {
// TODO add fancy walls with https://en.wikipedia.org/wiki/Box-drawing_characters
self.set_cell(buf, x, y, "#", FG_BROWN, FG_BROWN);
}
StructureElement::Floor => {
self.set_cell(buf, x, y, " ", FG_BROWN, Color::Gray);
self.set_cell(buf, x, y, " ", FG_BROWN, BACKGROUND);
}
StructureElement::StairDown => {
self.set_cell(buf, x, y, ">", Color::Black, Color::Gray);
self.set_cell(buf, x, y, ">", Color::White, BACKGROUND);
}
StructureElement::StairUp => {
self.set_cell(buf, x, y, "<", Color::Black, Color::Gray);
self.set_cell(buf, x, y, "<", Color::White, BACKGROUND);
}
StructureElement::Unknown => {
self.set_cell(buf, x, y, "", Color::DarkGray, Color::Gray);
self.set_cell(buf, x, y, "", Color::Gray, BACKGROUND);
}
}
}
(_, Some(m), _) => {
let (s, c) = m.get_representation();
self.set_cell(buf, x, y, s, c, Color::Gray);
self.set_cell(buf, x, y, s, c, BACKGROUND);
}
(_, _, Some(t)) => {
let (s, c) = t.get_representation();
self.set_bold_cell(buf, x, y, s, c, Color::Gray);
self.set_bold_cell(buf, x, y, s, c, BACKGROUND);
}
(None, None, None) => {}
};
@ -83,7 +84,7 @@ impl StatefulWidget for LevelWidget {
let player_pos = player.get_immutable_position();
let player_x = al + player_pos.get_x() as u16;
let player_y = at + player_pos.get_y() as u16;
self.set_cell(buf, player_x, player_y, "8", Color::Red, Color::Gray);
self.set_cell(buf, player_x, player_y, "8", Color::LightRed, BACKGROUND);
}
}
}