diff options
| author | 1992414357@qq.com <1992414357@qq.com> | 2025-05-27 07:21:37 +0800 |
|---|---|---|
| committer | 1992414357@qq.com <1992414357@qq.com> | 2025-05-27 07:21:37 +0800 |
| commit | f8336ed832fa8e1ddd2f1783bdfc23d3279d5e6a (patch) | |
| tree | 42097cd72e46736ac3a544bd3d6dc50e2327a677 /core/examples/start_client_console.rs | |
First commit
Diffstat (limited to 'core/examples/start_client_console.rs')
| -rw-r--r-- | core/examples/start_client_console.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/examples/start_client_console.rs b/core/examples/start_client_console.rs new file mode 100644 index 0000000..3d6653b --- /dev/null +++ b/core/examples/start_client_console.rs @@ -0,0 +1,24 @@ +use std::net::{IpAddr, Ipv4Addr}; +use nogamepads_core::pad_data::pad_player_info::nogamepads_player_info::PlayerInfo; +use nogamepads_core::pad_io::client::nogamepads_client::PadClient; + +const PASSWORD : &str = "password"; + +fn main() { + + // 构建玩家信息 + let mut player_info = PlayerInfo::new(); + player_info.setup_account_info("juliet", PASSWORD); + player_info.set_nickname("Juliet_Smile"); + player_info.set_customize_color_hsv(320, 0.5, 1.0); // PINK + + // 构建客户端 + let mut client = PadClient::bind_addr( + IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)) + ); + client.bind_player(player_info); // 绑定玩家 + client.enable_console(); // 启用控制台 + + // 连接至目标地址 + client.connect(); +}
\ No newline at end of file |
