minor fixes
This commit is contained in:
@@ -10,9 +10,9 @@ impl Iterator for LevelLadder {
|
||||
let current = self.curr;
|
||||
|
||||
self.curr = self.next;
|
||||
self.next = current + self.next;
|
||||
self.next += current;
|
||||
|
||||
// Since there's no endpoint to a Fibonacci sequence, the `Iterator`
|
||||
// Since there's no endpoint to a Fibonacci sequence, the `Iterator`
|
||||
// will never return `None`, and `Some` is always returned.
|
||||
Some(current * 30)
|
||||
}
|
||||
|
||||
23
src/main.rs
23
src/main.rs
@@ -14,7 +14,6 @@ use crossterm::{
|
||||
ExecutableCommand,
|
||||
};
|
||||
use ratatui::prelude::*;
|
||||
use ratatui::widgets::block::{Position, Title};
|
||||
use ratatui::widgets::{Block, BorderType, Borders, Wrap};
|
||||
use ratatui::{
|
||||
prelude::{CrosstermBackend, Terminal},
|
||||
@@ -32,12 +31,12 @@ mod constants;
|
||||
mod game;
|
||||
mod level;
|
||||
mod level_generator;
|
||||
mod level_ladder;
|
||||
mod level_widget;
|
||||
mod monster;
|
||||
mod player;
|
||||
mod position;
|
||||
mod room;
|
||||
mod level_ladder;
|
||||
|
||||
//
|
||||
fn main() -> Result<()> {
|
||||
@@ -101,10 +100,8 @@ fn main() -> Result<()> {
|
||||
height: map_area.height / 2 + 1,
|
||||
};
|
||||
let block = Block::default()
|
||||
.title(
|
||||
Title::from(format!(" {} ", game.get_player().get_name()))
|
||||
.alignment(Alignment::Center)
|
||||
.position(Position::Top),
|
||||
.title_top(
|
||||
Line::from(format!(" {} ", game.get_player().get_name())).centered()
|
||||
)
|
||||
.borders(Borders::TOP)
|
||||
.border_style(Style::default().fg(Color::White))
|
||||
@@ -134,10 +131,8 @@ fn main() -> Result<()> {
|
||||
};
|
||||
// Display the latest messages from the game to the user
|
||||
let block = Block::default()
|
||||
.title(
|
||||
Title::from(" messages ")
|
||||
.alignment(Alignment::Center)
|
||||
.position(Position::Top),
|
||||
.title_top(
|
||||
Line::from(" messages ").centered()
|
||||
)
|
||||
.borders(Borders::TOP)
|
||||
.border_style(Style::default().fg(Color::White))
|
||||
@@ -219,12 +214,8 @@ fn main() -> Result<()> {
|
||||
area.width = 40;
|
||||
area.height = 20;
|
||||
let block = Block::default()
|
||||
.title(
|
||||
Title::from(" Game ended ")
|
||||
.alignment(Alignment::Center)
|
||||
.position(Position::Top),
|
||||
)
|
||||
.title(Title::from("Press `q` to quit!").position(Position::Bottom))
|
||||
.title_top(Line::from(" Game ended ").centered())
|
||||
.title_bottom(Line::from("Press `q` to quit!"))
|
||||
.borders(Borders::ALL)
|
||||
.border_style(Style::default().fg(Color::White))
|
||||
.border_type(BorderType::Rounded)
|
||||
|
||||
Reference in New Issue
Block a user