From 49192dbb98e0ab1f2a66b4786fac86d63f69be64 Mon Sep 17 00:00:00 2001 From: "1992414357@qq.com" <1992414357@qq.com> Date: Mon, 9 Jun 2025 01:44:36 +0800 Subject: 重构所有部分 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/data/game/cli/cli_command.rs | 35 +++++++++++++++++++++++++++++++++++ core/src/data/game/cli/mod.rs | 1 + 2 files changed, 36 insertions(+) create mode 100644 core/src/data/game/cli/cli_command.rs create mode 100644 core/src/data/game/cli/mod.rs (limited to 'core/src/data/game/cli') diff --git a/core/src/data/game/cli/cli_command.rs b/core/src/data/game/cli/cli_command.rs new file mode 100644 index 0000000..1d79515 --- /dev/null +++ b/core/src/data/game/cli/cli_command.rs @@ -0,0 +1,35 @@ +use std::sync::{Arc, Mutex}; +use clap::{Parser, Subcommand}; +use nogamepads::entry_mutex; +use crate::data::game::runtime::structs::GameRuntime; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +pub struct GameCli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand, Debug)] +enum Commands { + + #[command(about = "Clean the screen")] + Clear, + + #[command(about = "Close the game")] + Close +} + +pub fn process_game_cli(runtime: Arc>, cmd: GameCli) { + match cmd.command { + Commands::Clear => { + + } + + Commands::Close => { + entry_mutex!(runtime, |guard| { + guard.close_game(); + }) + } + } +} \ No newline at end of file diff --git a/core/src/data/game/cli/mod.rs b/core/src/data/game/cli/mod.rs new file mode 100644 index 0000000..043f7b8 --- /dev/null +++ b/core/src/data/game/cli/mod.rs @@ -0,0 +1 @@ +pub mod cli_command; \ No newline at end of file -- cgit