vi-keys menu nav, and 80x60 menu bg img

This commit is contained in:
Llywelwyn 2023-07-11 04:50:55 +01:00
parent aaa5376544
commit 595ec61332
7 changed files with 30 additions and 31 deletions

Binary file not shown.

Binary file not shown.

View file

@ -50,14 +50,14 @@ pub fn delete_the_dead(ecs: &mut World) {
.append("The") .append("The")
.npc_name(&victim_name.name) .npc_name(&victim_name.name)
.colour(rltk::WHITE) .colour(rltk::WHITE)
.append("was destroyed.") .append("was destroyed!")
.log(); .log();
} else { } else {
gamelog::Logger::new() gamelog::Logger::new()
.append("The") .append("The")
.npc_name(&victim_name.name) .npc_name(&victim_name.name)
.colour(rltk::WHITE) .colour(rltk::WHITE)
.append("died.") .append("died!")
.log(); .log();
} }
} }

View file

@ -276,34 +276,34 @@ pub fn main_menu(gs: &mut State, ctx: &mut Rltk) -> MainMenuResult {
ctx.render_xp_sprite(&assets.menu, 0, 0); ctx.render_xp_sprite(&assets.menu, 0, 0);
ctx.print_color(40, 21, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "RUST-RL"); ctx.print_color(50, 26, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "RUST-RL");
if let RunState::MainMenu { menu_selection: selection } = *runstate { if let RunState::MainMenu { menu_selection: selection } = *runstate {
let mut y = 24; let mut y = 29;
if selection == MainMenuSelection::NewGame { if selection == MainMenuSelection::NewGame {
ctx.print_color(37, 24, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "["); ctx.print_color(47, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "[");
ctx.print_color(39, 24, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "new game"); ctx.print_color(49, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "new game");
ctx.print_color(48, 24, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]"); ctx.print_color(58, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]");
} else { } else {
ctx.print_color(39, 24, RGB::named(rltk::WHITE), RGB::from_f32(0.11, 0.11, 0.11), "new game"); ctx.print_color(49, y, RGB::named(rltk::WHITE), RGB::from_f32(0.11, 0.11, 0.11), "new game");
} }
y += 2; y += 2;
if save_exists { if save_exists {
if selection == MainMenuSelection::LoadGame { if selection == MainMenuSelection::LoadGame {
ctx.print_color(36, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "["); ctx.print_color(46, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "[");
ctx.print_color(38, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "load game"); ctx.print_color(48, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "load game");
ctx.print_color(48, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]"); ctx.print_color(58, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]");
} else { } else {
ctx.print_color(38, y, RGB::named(rltk::WHITE), RGB::from_f32(0.11, 0.11, 0.11), "load game"); ctx.print_color(48, y, RGB::named(rltk::WHITE), RGB::from_f32(0.11, 0.11, 0.11), "load game");
} }
y += 2; y += 2;
} }
if selection == MainMenuSelection::Quit { if selection == MainMenuSelection::Quit {
ctx.print_color(37, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "["); ctx.print_color(47, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "[");
ctx.print_color(39, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "goodbye!"); ctx.print_color(49, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "goodbye!");
ctx.print_color(48, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]"); ctx.print_color(58, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]");
} else { } else {
ctx.print_color(43, y, RGB::named(rltk::WHITE), RGB::from_f32(0.11, 0.11, 0.11), "quit"); ctx.print_color(53, y, RGB::named(rltk::WHITE), RGB::from_f32(0.11, 0.11, 0.11), "quit");
} }
match ctx.key { match ctx.key {
@ -314,7 +314,7 @@ pub fn main_menu(gs: &mut State, ctx: &mut Rltk) -> MainMenuResult {
} }
VirtualKeyCode::N => return MainMenuResult::NoSelection { selected: MainMenuSelection::NewGame }, VirtualKeyCode::N => return MainMenuResult::NoSelection { selected: MainMenuSelection::NewGame },
VirtualKeyCode::L => return MainMenuResult::NoSelection { selected: MainMenuSelection::LoadGame }, VirtualKeyCode::L => return MainMenuResult::NoSelection { selected: MainMenuSelection::LoadGame },
VirtualKeyCode::Up => { VirtualKeyCode::Up | VirtualKeyCode::Numpad8 | VirtualKeyCode::J => {
let mut new_selection; let mut new_selection;
match selection { match selection {
MainMenuSelection::NewGame => new_selection = MainMenuSelection::Quit, MainMenuSelection::NewGame => new_selection = MainMenuSelection::Quit,
@ -326,7 +326,7 @@ pub fn main_menu(gs: &mut State, ctx: &mut Rltk) -> MainMenuResult {
} }
return MainMenuResult::NoSelection { selected: new_selection }; return MainMenuResult::NoSelection { selected: new_selection };
} }
VirtualKeyCode::Down => { VirtualKeyCode::Down | VirtualKeyCode::Numpad2 | VirtualKeyCode::K => {
let mut new_selection; let mut new_selection;
match selection { match selection {
MainMenuSelection::NewGame => new_selection = MainMenuSelection::LoadGame, MainMenuSelection::NewGame => new_selection = MainMenuSelection::LoadGame,
@ -338,7 +338,9 @@ pub fn main_menu(gs: &mut State, ctx: &mut Rltk) -> MainMenuResult {
} }
return MainMenuResult::NoSelection { selected: new_selection }; return MainMenuResult::NoSelection { selected: new_selection };
} }
VirtualKeyCode::Return => return MainMenuResult::Selected { selected: selection }, VirtualKeyCode::Return | VirtualKeyCode::NumpadEnter => {
return MainMenuResult::Selected { selected: selection }
}
_ => return MainMenuResult::NoSelection { selected: selection }, _ => return MainMenuResult::NoSelection { selected: selection },
}, },
} }

View file

@ -119,6 +119,9 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState {
return skip_turn(&mut gs.ecs); // (Wait a turn) return skip_turn(&mut gs.ecs); // (Wait a turn)
} }
} }
VirtualKeyCode::NumpadDecimal => {
return skip_turn(&mut gs.ecs);
}
// Items // Items
VirtualKeyCode::G => get_item(&mut gs.ecs), VirtualKeyCode::G => get_item(&mut gs.ecs),

View file

@ -1,6 +1,6 @@
use rltk::rex::XpFile; use rltk::rex::XpFile;
rltk::embedded_resource!(CAVE_TUNNEL, "../resources/cave_tunnel80x50.xp"); rltk::embedded_resource!(CAVE_TUNNEL, "../resources/cave_tunnel80x60.xp");
pub struct RexAssets { pub struct RexAssets {
pub menu: XpFile, pub menu: XpFile,
@ -9,8 +9,8 @@ pub struct RexAssets {
impl RexAssets { impl RexAssets {
#[allow(clippy::new_without_default)] #[allow(clippy::new_without_default)]
pub fn new() -> RexAssets { pub fn new() -> RexAssets {
rltk::link_resource!(CAVE_TUNNEL, "../resources/cave_tunnel80x50.xp"); rltk::link_resource!(CAVE_TUNNEL, "../resources/cave_tunnel80x60.xp");
RexAssets { menu: XpFile::from_resource("../resources/cave_tunnel80x50.xp").unwrap() } RexAssets { menu: XpFile::from_resource("../resources/cave_tunnel80x60.xp").unwrap() }
} }
} }

View file

@ -93,15 +93,9 @@ pub fn spawn_room(ecs: &mut World, room: &Rect, map_depth: i32) {
let category = category_table().roll(&mut rng); let category = category_table().roll(&mut rng);
let spawn_table; let spawn_table;
match category.as_ref() { match category.as_ref() {
"mob" => { "mob" => spawn_table = mob_table(map_depth),
spawn_table = mob_table(map_depth); "item" => spawn_table = item_table(map_depth),
} _ => spawn_table = debug_table(),
"item" => {
spawn_table = item_table(map_depth);
}
_ => {
spawn_table = debug_table();
}
} }
spawn_points.insert(idx, spawn_table.roll(&mut rng)); spawn_points.insert(idx, spawn_table.roll(&mut rng));
added = true; added = true;