aboutsummaryrefslogtreecommitdiff
path: root/console/src
diff options
context:
space:
mode:
author1992414357@qq.com <1992414357@qq.com>2025-06-09 17:17:39 +0800
committer1992414357@qq.com <1992414357@qq.com>2025-06-09 17:17:39 +0800
commite5cbc548a7d8ba62a76421057d6b281a9277646f (patch)
tree0b82088c52c1adb1d3e8fc3d33e045f494b73706 /console/src
parent0d8761e5f907d173c40a2a44f3a1d8d8ce5a2f6e (diff)
.
Diffstat (limited to 'console/src')
-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
4 files changed, 45 insertions, 3 deletions
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