4985fee7c2
2. 简单封装了LVGL渲染类,已经封装好了gif渲染功能 3. 修复了硬件厂商提供的驱动的Bug 4. 初步定义了宠物基类的抽象信息
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
//
|
|
// Created by misaki on 2025/9/8.
|
|
//
|
|
|
|
#pragma once
|
|
#include <string>
|
|
#include <memory>
|
|
#include <unordered_map>
|
|
|
|
// 资源句柄,防止裸指针到处飞
|
|
template<class T>
|
|
using Handle = std::shared_ptr<T>; /// 宠物句柄
|
|
|
|
// 前向声明
|
|
class IPet; /// 宠物接口
|
|
using IPetPtr = Handle<IPet>; /// 宠物句柄
|
|
|
|
// 事件类型
|
|
enum class Emotion {
|
|
Feed, /// 喂食
|
|
Happy, /// 高兴
|
|
Angry, /// 生气
|
|
Upset /// 沮丧
|
|
};
|
|
|
|
// 成长阶段
|
|
enum class Stage {
|
|
Baby, /// 幼年
|
|
Teen, /// 青年
|
|
Adult /// 成长
|
|
};
|
|
|
|
// 数值封装
|
|
struct Vitals {
|
|
int hp = 100; // 0-100 /// 生命值
|
|
int intimacy = 0; // 0-100 /// 亲密度
|
|
};
|
|
|
|
// 身份设定
|
|
struct Persona {
|
|
std::string systemPrompt; /// 系统提示
|
|
std::string greet; /// 默认欢迎语
|
|
// …可扩展
|
|
};
|
|
|
|
// 动物元数据(只读)
|
|
struct AnimalManifest {
|
|
std::string id; // "snow_leopard" /// ID
|
|
std::string displayName; /// 显示名称
|
|
Persona persona; /// 身份设定
|
|
std::unordered_map<Stage, std::string> modelPath; /// 阶段→模型
|
|
std::unordered_map<Emotion, std::string> audioPath; /// 阶段→音频
|
|
std::string version; /// 版本
|
|
}; |