vi-keys menu nav, and 80x60 menu bg img
This commit is contained in:
parent
aaa5376544
commit
595ec61332
7 changed files with 30 additions and 31 deletions
Binary file not shown.
BIN
resources/cave_tunnel80x60.xp
Normal file
BIN
resources/cave_tunnel80x60.xp
Normal file
Binary file not shown.
|
|
@ -50,14 +50,14 @@ pub fn delete_the_dead(ecs: &mut World) {
|
|||
.append("The")
|
||||
.npc_name(&victim_name.name)
|
||||
.colour(rltk::WHITE)
|
||||
.append("was destroyed.")
|
||||
.append("was destroyed!")
|
||||
.log();
|
||||
} else {
|
||||
gamelog::Logger::new()
|
||||
.append("The")
|
||||
.npc_name(&victim_name.name)
|
||||
.colour(rltk::WHITE)
|
||||
.append("died.")
|
||||
.append("died!")
|
||||
.log();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
36
src/gui.rs
36
src/gui.rs
|
|
@ -276,34 +276,34 @@ pub fn main_menu(gs: &mut State, ctx: &mut Rltk) -> MainMenuResult {
|
|||
|
||||
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 {
|
||||
let mut y = 24;
|
||||
let mut y = 29;
|
||||
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(39, 24, 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(47, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "[");
|
||||
ctx.print_color(49, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "new game");
|
||||
ctx.print_color(58, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]");
|
||||
} 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;
|
||||
if save_exists {
|
||||
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(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::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(48, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "load game");
|
||||
ctx.print_color(58, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]");
|
||||
} 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;
|
||||
}
|
||||
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(39, 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(47, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "[");
|
||||
ctx.print_color(49, y, RGB::named(rltk::GREEN), RGB::from_f32(0.11, 0.11, 0.11), "goodbye!");
|
||||
ctx.print_color(58, y, RGB::named(rltk::YELLOW), RGB::from_f32(0.11, 0.11, 0.11), "]");
|
||||
} 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 {
|
||||
|
|
@ -314,7 +314,7 @@ pub fn main_menu(gs: &mut State, ctx: &mut Rltk) -> MainMenuResult {
|
|||
}
|
||||
VirtualKeyCode::N => return MainMenuResult::NoSelection { selected: MainMenuSelection::NewGame },
|
||||
VirtualKeyCode::L => return MainMenuResult::NoSelection { selected: MainMenuSelection::LoadGame },
|
||||
VirtualKeyCode::Up => {
|
||||
VirtualKeyCode::Up | VirtualKeyCode::Numpad8 | VirtualKeyCode::J => {
|
||||
let mut new_selection;
|
||||
match selection {
|
||||
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 };
|
||||
}
|
||||
VirtualKeyCode::Down => {
|
||||
VirtualKeyCode::Down | VirtualKeyCode::Numpad2 | VirtualKeyCode::K => {
|
||||
let mut new_selection;
|
||||
match selection {
|
||||
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 };
|
||||
}
|
||||
VirtualKeyCode::Return => return MainMenuResult::Selected { selected: selection },
|
||||
VirtualKeyCode::Return | VirtualKeyCode::NumpadEnter => {
|
||||
return MainMenuResult::Selected { selected: selection }
|
||||
}
|
||||
_ => return MainMenuResult::NoSelection { selected: selection },
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState {
|
|||
return skip_turn(&mut gs.ecs); // (Wait a turn)
|
||||
}
|
||||
}
|
||||
VirtualKeyCode::NumpadDecimal => {
|
||||
return skip_turn(&mut gs.ecs);
|
||||
}
|
||||
|
||||
// Items
|
||||
VirtualKeyCode::G => get_item(&mut gs.ecs),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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 menu: XpFile,
|
||||
|
|
@ -9,8 +9,8 @@ pub struct RexAssets {
|
|||
impl RexAssets {
|
||||
#[allow(clippy::new_without_default)]
|
||||
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() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,15 +93,9 @@ pub fn spawn_room(ecs: &mut World, room: &Rect, map_depth: i32) {
|
|||
let category = category_table().roll(&mut rng);
|
||||
let spawn_table;
|
||||
match category.as_ref() {
|
||||
"mob" => {
|
||||
spawn_table = mob_table(map_depth);
|
||||
}
|
||||
"item" => {
|
||||
spawn_table = item_table(map_depth);
|
||||
}
|
||||
_ => {
|
||||
spawn_table = debug_table();
|
||||
}
|
||||
"mob" => spawn_table = mob_table(map_depth),
|
||||
"item" => spawn_table = item_table(map_depth),
|
||||
_ => spawn_table = debug_table(),
|
||||
}
|
||||
spawn_points.insert(idx, spawn_table.roll(&mut rng));
|
||||
added = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue