aboutsummaryrefslogtreecommitdiff
path: root/console
diff options
context:
space:
mode:
Diffstat (limited to 'console')
-rw-r--r--console/Cargo.toml4
-rw-r--r--console/src/bin/padc.rs6
-rw-r--r--console/src/gui/controller_app.rs38
-rw-r--r--console/src/gui/mod.rs1
-rw-r--r--console/src/lib.rs3
5 files changed, 48 insertions, 4 deletions
diff --git a/console/Cargo.toml b/console/Cargo.toml
index 5c6a313..58594a8 100644
--- a/console/Cargo.toml
+++ b/console/Cargo.toml
@@ -13,4 +13,6 @@ serde = { version = "1.0.219", features = ["derive"] }
serde_yaml = "0.9.34"
tokio = { version = "1.45.0", features = ["full"] }
crossterm = "0.29.0"
-log = "0.4.27" \ No newline at end of file
+log = "0.4.27"
+egui = "0.31.1"
+eframe = "0.31.1" \ No newline at end of file
diff --git a/console/src/bin/padc.rs b/console/src/bin/padc.rs
index 3323de7..3fc875a 100644
--- a/console/src/bin/padc.rs
+++ b/console/src/bin/padc.rs
@@ -1,4 +1,4 @@
-use clap::{Args, CommandFactory, Parser, Subcommand};
+use clap::{Args, ColorChoice, CommandFactory, Parser, Subcommand};
use nogamepads::string_utils::process_id_text;
use nogamepads_console::utils::{confirm, read_password, read_password_and_confirm};
use nogamepads_core::data::game::structs::{GameData, GameRuntimeDataArchive};
@@ -23,6 +23,7 @@ use tokio::signal::ctrl_c;
use tokio::time::sleep;
use nogamepads::entry_mutex;
use nogamepads::logger_utils::logger_build;
+use nogamepads_console::gui::controller_app::MyApp;
use nogamepads_core::data::controller::cli::cli_command::{process_controller_cli, ControllerCli};
use nogamepads_core::data::controller::structs::ControllerData;
use nogamepads_core::data::game::cli::cli_command::{process_game_cli, GameCli};
@@ -265,11 +266,12 @@ struct LocalControllerData {
fn main () {
let cli = Padc::parse();
+
let mut data = read();
match cli.command {
Commands::GenerateCompletion {shell} => {
- let mut cmd = Padc::command();
+ let cmd = Padc::command();
generate(shell, &mut cmd.clone(), "padc", &mut io::stdout());
}
diff --git a/console/src/gui/controller_app.rs b/console/src/gui/controller_app.rs
new file mode 100644
index 0000000..d8325b1
--- /dev/null
+++ b/console/src/gui/controller_app.rs
@@ -0,0 +1,38 @@
+pub struct MyApp {
+ show_hello: bool, // 控制是否显示 "Hello World!"
+}
+
+impl Default for MyApp {
+ fn default() -> Self {
+ Self { show_hello: false }
+ }
+}
+
+impl eframe::App for MyApp {
+ fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
+ egui::CentralPanel::default().show(ctx, |ui| {
+ // 添加一个按钮
+ if ui.button("Click me!").clicked() {
+ self.show_hello = !self.show_hello; // 切换状态
+ }
+
+ // 如果按钮被点击过,显示 "Hello World!"
+ if self.show_hello {
+ ui.label("Hello World!");
+ }
+ });
+ }
+}
+
+impl MyApp {
+ pub fn start () {
+ let options = eframe::NativeOptions::default();
+ let _ = eframe::run_native(
+ "My egui App",
+ options,
+ Box::new(|_cc| {
+ Ok(Box::<MyApp>::default())
+ }),
+ );
+ }
+} \ No newline at end of file
diff --git a/console/src/gui/mod.rs b/console/src/gui/mod.rs
new file mode 100644
index 0000000..5e7124a
--- /dev/null
+++ b/console/src/gui/mod.rs
@@ -0,0 +1 @@
+pub mod controller_app; \ No newline at end of file
diff --git a/console/src/lib.rs b/console/src/lib.rs
index fab870e..3e25a58 100644
--- a/console/src/lib.rs
+++ b/console/src/lib.rs
@@ -1 +1,2 @@
-pub mod utils; \ No newline at end of file
+pub mod utils;
+pub mod gui; \ No newline at end of file