当前位置: 首页 > news >正文

BongoCat - 可爱的桌面互动猫咪

BongoCat - 桌面互动猫咪

项目描述

BongoCat是一款创新的桌面互动应用,通过Live2D技术呈现可爱的猫咪角色,能够实时响应您的鼠标、键盘操作和游戏手柄输入。基于Tauri框架构建,提供跨平台的桌面体验,让您的数字工作空间更加生动有趣。

功能特性

  • :cat_face: Live2D猫咪模型 - 支持多种可爱的猫咪Live2D模型展示
  • ⌨️ 实时输入反馈 - 猫咪会对鼠标点击、键盘敲击做出生动反应
  • 🎮 游戏手柄支持 - 完美兼容游戏手柄操作,摇杆和按键均有对应动作
  • 🖥️ 跨平台兼容 - 支持Windows、macOS和Linux三大操作系统
  • :artist_palette: 自定义界面 - 可调整窗口尺寸、透明度和穿透效果
  • 🔧 Tauri技术栈 - 基于Rust后端和Vue3前端的高性能架构

安装指南

系统要求

  • Windows 10+ / macOS 10.15+ / Linux (Ubuntu 18.04+)
  • 支持WebGL的现代浏览器内核

安装步骤

  1. 从GitHub Releases页面下载对应平台的安装包
  2. 运行安装程序并按照提示完成安装
  3. 启动应用,可爱的BongoCat就会出现在您的桌面上

开发环境搭建

# 克隆项目
git clone https://github.com/ayangweb/BongoCat.git# 安装依赖
npm install# 启动开发服务器
npm run tauri dev

使用说明

基本操作

启动应用后,BongoCat会自动出现在桌面上,它会实时响应您的输入操作:

  • 鼠标移动: 猫咪的眼睛和头部会跟随鼠标移动
  • 鼠标点击: 左右键点击会有不同的反应动作
  • 键盘输入: 敲击键盘时猫咪会做出相应的动作
  • 游戏手柄: 连接手柄后可使用摇杆和按钮与猫咪互动

偏好设置

通过系统托盘菜单或快捷键打开偏好设置窗口,可以调整:

  • 窗口尺寸缩放比例(50%-150%)
  • 窗口不透明度(25%-100%)
  • 窗口穿透模式(允许鼠标点击穿透)
  • 模型选择和个性化设置

核心代码

设备输入监听核心逻辑

// useDevice.ts - 处理鼠标键盘输入
export function useDevice() {const processMouseMove = (point: CursorPoint) => {const roundedValue = mapValues(point, Math.round)if (isEqual(lastCursorPoint.value, roundedValue)) returnlastCursorPoint.value = roundedValuereturn handleMouseMove(point)}useTauriListen<DeviceEvent>(LISTEN_KEY.DEVICE_CHANGED, ({ payload }) => {const { kind, value } = payload// 处理不同类型的输入事件switch (kind) {case 'KeyboardPress':return handlePress(getSupportedKey(value))case 'MouseMove':return processMouseMove(value)// ... 其他事件处理}})
}

游戏手柄支持实现

// useGamepad.ts - 游戏手柄控制
export function useGamepad() {useTauriListen<GamepadEvent>(LISTEN_KEY.GAMEPAD_CHANGED, ({ payload }) => {const { name, value } = payloadswitch (name) {case 'LeftStickX':sticks.left.x = valuereturn handleAxisChange('CatParamStickLX', value)case 'LeftThumb':sticks.left.pressed = value !== 0return live2d.setParameterValue('CatParamStickLeftDown', value !== 0)// ... 其他手柄事件}})
}

Live2D模型控制

// useModel.ts - 模型加载和控制
export function useModel() {async function handleLoad() {try {const { path } = modelStore.currentModelconst { width, height, ...rest } = await live2d.load(path)modelSize.value = { width, height }Object.assign(modelStore, rest)} catch (error) {message.error(String(error))}}function handleMouseMove(point: CursorPoint) {// 计算鼠标位置并更新模型参数const xRatio = (cursorPoint.x - position.x) / size.widthconst yRatio = (cursorPoint.y - position.y) / size.heightlive2d.setParameterValue('ParamMouseX', value)}
}

Rust后端设备监听

// device.rs - Rust后端输入监听
#[command]
pub async fn start_device_listening<R: Runtime>(app_handle: AppHandle<R>) -> Result<(), String> {let callback = move |event: Event| {let device_event = match event.event_type {EventType::ButtonPress(button) => DeviceEvent {kind: DeviceEventKind::MousePress,value: json!(format!("{:?}", button)),},EventType::MouseMove { x, y } => DeviceEvent {kind: DeviceEventKind::MouseMove,value: json!({ "x": x, "y": y }),},// ... 其他事件类型};app_handle.emit("device-changed", device_event).unwrap();};listen(callback).map_err(|err| format!("Failed to listen device: {:?}", err))
}

更多精彩内容 请关注我的个人公众号 公众号(办公AI智能小助手)
公众号二维码

http://www.hskmm.com/?act=detail&tid=496

相关文章:

  • qoj6279 Honeycomb
  • Vue 将api 获取的 json 数据保存到本地
  • Claude Code新手入门指南:AI编程助手完全教程
  • 0124_观察者模式(Observer)
  • 读人形机器人07零售行业
  • 你可能不需要WebSocket-服务器发送事件的简单力量
  • 2014年11月微软安全更新风险评估与技术解析
  • 洛谷P5854 【模板】笛卡尔树 题解 笛卡尔树模板题
  • [Flink] Flink 经典场景:数据流输出到多个Sink
  • 都江堰操作系统
  • [OLAP/Doris] Doris 之表设计
  • cmov用法一例
  • 20250909 之所思 - 人生如梦
  • 认识人工智能-基础认知
  • Codeforces Round 1049 (Div. 2)(A~D)
  • 苹果im虚拟机协议群发系统,苹果imessage推信软件,苹果iMessage自动群发协议–持续更新中...
  • 【ChipIntelli 系列】SDK详解4——Makefile 设置 单SDK多工程文件夹实现方法
  • Codeforces Round 1049 (Div. 2)
  • 课前问题思考1
  • huggingface
  • 安全不是一个功能-而是一个地基
  • Python基础-27 match-case 使用教程
  • 从0到1实现Transformer模型-CS336作业1
  • 准备工作之结构体[基于郝斌课程]
  • 软工课程第一次作业
  • java学习起航喽
  • 初始化树莓派(Raspberry Pi)系统并以 ssh 连接教程(只需读卡器、手机开热点,无需显示器) - tsunchi
  • 从windows 自动进入BIOS
  • 软件工程第一次作业
  • Morpheus 审计报告分享:AAVE 项目 Pool 合约地址更新导致的组合性风险