data to consts, cheatmenu
This commit is contained in:
parent
a2fb893f49
commit
0d4c0c9558
47 changed files with 178 additions and 87 deletions
|
|
@ -1,5 +1,9 @@
|
|||
use super::State;
|
||||
use super::{ State };
|
||||
use bracket_lib::prelude::*;
|
||||
use notan::prelude::*;
|
||||
use notan::draw::DrawTextSection;
|
||||
use std::collections::HashMap;
|
||||
use crate::consts::TILESIZE;
|
||||
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
pub enum CheatMenuResult {
|
||||
|
|
@ -12,8 +16,52 @@ pub enum CheatMenuResult {
|
|||
GodMode,
|
||||
}
|
||||
|
||||
pub fn show_cheat_menu(_gs: &mut State, ctx: &mut BTerm) -> CheatMenuResult {
|
||||
let (x_offset, y_offset) = (1, 10);
|
||||
pub fn show_cheat_menu(_gs: &mut State, ctx: &mut App) -> CheatMenuResult {
|
||||
let key = &ctx.keyboard;
|
||||
for keycode in key.pressed.iter() {
|
||||
match *keycode {
|
||||
KeyCode::A => {
|
||||
return CheatMenuResult::Ascend;
|
||||
}
|
||||
KeyCode::D => {
|
||||
return CheatMenuResult::Descend;
|
||||
}
|
||||
KeyCode::H => {
|
||||
return CheatMenuResult::Heal;
|
||||
}
|
||||
KeyCode::M => {
|
||||
return CheatMenuResult::MagicMap;
|
||||
}
|
||||
KeyCode::G => {
|
||||
return CheatMenuResult::GodMode;
|
||||
}
|
||||
KeyCode::Escape => {
|
||||
return CheatMenuResult::Cancel;
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
}
|
||||
return CheatMenuResult::NoResponse;
|
||||
}
|
||||
|
||||
pub fn draw_cheat_menu(
|
||||
draw: &mut notan::draw::Draw,
|
||||
atlas: &HashMap<String, Texture>,
|
||||
font: ¬an::draw::Font
|
||||
) {
|
||||
let offsets = crate::camera::get_offset();
|
||||
const DEBUG_MENU: &str =
|
||||
r#"DEBUG MENU! [aA-zZ][Esc.]
|
||||
|
||||
a - ASCEND A FLOOR
|
||||
d - DESCEND A FLOOR
|
||||
h - HEAL TO FULL
|
||||
m - MAGIC MAP REVEAL
|
||||
g - GOD MODE"#;
|
||||
draw.text(&font, DEBUG_MENU)
|
||||
.position(1.0 + (offsets.x as f32) * TILESIZE, 1.0 + (offsets.y as f32) * TILESIZE)
|
||||
.color(Color::RED);
|
||||
/*let (x_offset, y_offset) = (1, 10);
|
||||
ctx.print_color(
|
||||
1 + x_offset,
|
||||
1 + y_offset,
|
||||
|
|
@ -46,19 +94,5 @@ pub fn show_cheat_menu(_gs: &mut State, ctx: &mut BTerm) -> CheatMenuResult {
|
|||
y += 1;
|
||||
// Godmode
|
||||
ctx.set(x_offset + 2, y, RGB::named(YELLOW), RGB::named(BLACK), to_cp437('g'));
|
||||
ctx.print(x_offset + 4, y, "GOD MODE");
|
||||
// Match keys
|
||||
match ctx.key {
|
||||
None => CheatMenuResult::NoResponse,
|
||||
Some(key) =>
|
||||
match key {
|
||||
VirtualKeyCode::A => CheatMenuResult::Ascend,
|
||||
VirtualKeyCode::D => CheatMenuResult::Descend,
|
||||
VirtualKeyCode::H => CheatMenuResult::Heal,
|
||||
VirtualKeyCode::M => CheatMenuResult::MagicMap,
|
||||
VirtualKeyCode::G => CheatMenuResult::GodMode,
|
||||
VirtualKeyCode::Escape => CheatMenuResult::Cancel,
|
||||
_ => CheatMenuResult::NoResponse,
|
||||
}
|
||||
}
|
||||
ctx.print(x_offset + 4, y, "GOD MODE");*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue