otto_emoji_display.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <libs/gif/lv_gif.h>
  3. #include "display/lcd_display.h"
  4. #include "otto_emoji_gif.h"
  5. /**
  6. * @brief Otto机器人GIF表情显示类
  7. * 继承LcdDisplay,添加GIF表情支持
  8. */
  9. class OttoEmojiDisplay : public SpiLcdDisplay {
  10. public:
  11. /**
  12. * @brief 构造函数,参数与SpiLcdDisplay相同
  13. */
  14. OttoEmojiDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width,
  15. int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y,
  16. bool swap_xy, DisplayFonts fonts);
  17. virtual ~OttoEmojiDisplay() = default;
  18. // 重写表情设置方法
  19. virtual void SetEmotion(const char* emotion) override;
  20. // 重写聊天消息设置方法
  21. virtual void SetChatMessage(const char* role, const char* content) override;
  22. // 添加SetIcon方法声明
  23. virtual void SetIcon(const char* icon) override;
  24. private:
  25. void SetupGifContainer();
  26. lv_obj_t* emotion_gif_; ///< GIF表情组件
  27. // 表情映射
  28. struct EmotionMap {
  29. const char* name;
  30. const lv_img_dsc_t* gif;
  31. };
  32. static const EmotionMap emotion_maps_[];
  33. };