Display help
This commit is contained in:
parent
55fe2fb538
commit
30aee61cad
@ -95,6 +95,8 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.display_sender.send(DisplayMessage::Help).unwrap();
|
||||||
|
|
||||||
let mut current_position = fetch_initial_chess_position(&client, &mut stream);
|
let mut current_position = fetch_initial_chess_position(&client, &mut stream);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -242,6 +244,7 @@ pub enum DisplayMessage {
|
|||||||
Message(String),
|
Message(String),
|
||||||
Information(String),
|
Information(String),
|
||||||
Debug(String),
|
Debug(String),
|
||||||
|
Help,
|
||||||
Input(Key),
|
Input(Key),
|
||||||
RemoveLastInput,
|
RemoveLastInput,
|
||||||
SwitchAsciiMode,
|
SwitchAsciiMode,
|
||||||
@ -295,7 +298,7 @@ fn start_display_thread(request_recv: Receiver<DisplayMessage>) {
|
|||||||
stdout,
|
stdout,
|
||||||
"{}{}{}{}{}",
|
"{}{}{}{}{}",
|
||||||
termion::cursor::Save,
|
termion::cursor::Save,
|
||||||
termion::cursor::Goto(3, 20),
|
termion::cursor::Goto(3, 18),
|
||||||
termion::clear::CurrentLine,
|
termion::clear::CurrentLine,
|
||||||
s,
|
s,
|
||||||
termion::cursor::Restore
|
termion::cursor::Restore
|
||||||
@ -327,11 +330,12 @@ fn start_display_thread(request_recv: Receiver<DisplayMessage>) {
|
|||||||
termion::clear::AfterCursor
|
termion::clear::AfterCursor
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
DisplayMessage::Help => print_help(&mut stdout),
|
||||||
DisplayMessage::Debug(s) => write!(
|
DisplayMessage::Debug(s) => write!(
|
||||||
stdout,
|
stdout,
|
||||||
"{}{}{}{}{}",
|
"{}{}{}{}{}",
|
||||||
termion::cursor::Save,
|
termion::cursor::Save,
|
||||||
termion::cursor::Goto(3, 25),
|
termion::cursor::Goto(3, 30),
|
||||||
termion::clear::CurrentLine,
|
termion::clear::CurrentLine,
|
||||||
s,
|
s,
|
||||||
termion::cursor::Restore
|
termion::cursor::Restore
|
||||||
@ -346,6 +350,19 @@ fn start_display_thread(request_recv: Receiver<DisplayMessage>) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_help(stdout: &mut RawTerminal<io::StdoutLock>) {
|
||||||
|
write!(stdout, "{}", termion::cursor::Save).unwrap();
|
||||||
|
let help = [
|
||||||
|
"move are parsed using SAN (Nc3) or UCI (b1c3)",
|
||||||
|
"@ to toggle ascii mode",
|
||||||
|
"Ctrl-C to quit",
|
||||||
|
];
|
||||||
|
for (i, h) in help.iter().enumerate() {
|
||||||
|
write!(stdout, "{}{}", termion::cursor::Goto(3, 22 + (i as u16)), h).unwrap();
|
||||||
|
}
|
||||||
|
write!(stdout, "{}", termion::cursor::Restore).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
fn start_keyboard_input_thread(
|
fn start_keyboard_input_thread(
|
||||||
display_sender: Sender<DisplayMessage>,
|
display_sender: Sender<DisplayMessage>,
|
||||||
waiting_server_msg_sender: Sender<WaitingServerMsg>,
|
waiting_server_msg_sender: Sender<WaitingServerMsg>,
|
||||||
|
Loading…
Reference in New Issue
Block a user