Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)

set(PROJECT_VER "1.7.2")
set(PROJECT_VER "1.1.6")

# Add this line to disable the specific warning
add_compile_options(-Wno-missing-field-initializers)
Expand Down
34 changes: 34 additions & 0 deletions components/anim-emoji-gif/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# GIF表情组件

# 收集所有GIF源文件
if (CONFIG_USE_ANIM_EMOJI_NERTC)
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/nertc/*.c")
elseif (CONFIG_USE_ANIM_EMOJI_OTTO)
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/otto/*.c")
elseif (CONFIG_USE_ANIM_EYE_240X240_GIF1)
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif1_240/*.c")
elseif (CONFIG_USE_ANIM_EYE_240X240_GIF2)
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif2_240/*.c")
elseif (CONFIG_USE_ANIM_EYE_160X160_GIF1)
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif1_160/*.c")
elseif (CONFIG_USE_ANIM_EYE_160X160_GIF2)
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif2_160/*.c")
endif()

# 检查是否找到GIF源文件
list(LENGTH GIF_SOURCES GIF_COUNT)
if(GIF_COUNT EQUAL 0)
message(WARNING "未找到GIF源文件,请确保src目录中包含对应资源的.c文件")
endif()
# 追加 src/ 根目录下的 .c 文件
file(GLOB EXTRA_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")

# 合并两个列表
list(APPEND GIF_SOURCES ${EXTRA_SOURCES})

# 注册组件
idf_component_register(
SRCS ${GIF_SOURCES}
INCLUDE_DIRS "include"
REQUIRES "lvgl"
)
8 changes: 8 additions & 0 deletions components/anim-emoji-gif/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## IDF Component Manager Manifest File
dependencies:
lvgl/lvgl: ">=9.0"

## Required IDF version
idf:
version: ">=5.4.0"

67 changes: 67 additions & 0 deletions components/anim-emoji-gif/include/anim_emoji_gif.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* @file anim_emoji_gif.h
* @brief GIF表情资源组件
*
* 这个头文件声明了GIF表情资源,用于在LVGL显示屏上显示动态表情。
*
* 支持的表情:
* - neutral: 静态状态/中性表情
* - sad: 悲伤表情
* - happy: 开心表情
* - surprised: 惊吓/惊讶表情
* - confused: 不学/困惑表情
* - angry: 愤怒表情
* - laughing: 大笑表情
* - funny: 搞笑表情
* - crying: 哭泣表情
* - loving: 恋爱表情
* - embarrassed: 尴尬表情
* - shocked: 震惊表情
* - thinking: 思考表情
* - winking: 眨眼表情
* - cool: 酷炫表情
* - relaxed: 放松表情
* - delicious: 美味表情
* - kissy: 飞吻表情
* - confident: 自信表情
* - sleepy: 困倦表情
* - silly: 调皮表情
*/

#pragma once

#include <libs/gif/lv_gif.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief 表情GIF声明
*
* 这些GIF资源可以直接用于LVGL的lv_gif组件
*
* 使用示例:
* ```c
* lv_obj_t* gif = lv_gif_create(parent);
* lv_image_dsc_t* happy = anim_emoji_gif_get_by_name("happy");
* lv_gif_set_src(gif, &happy); // 设置开心表情
* ```
*/

/**
* @brief 获取组件版本
* @return 版本字符串
*/
const char* anim_emoji_gif_get_version(void);

/**
* @brief 根据名称获取表情资源
* @param name 表情名称
* @return 表情资源指针,如果未找到则返回NULL
*/
const lv_image_dsc_t* anim_emoji_gif_get_by_name(const char* name);

#ifdef __cplusplus
}
#endif
143 changes: 143 additions & 0 deletions components/anim-emoji-gif/src/anim_emoji_gif_utils.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/**
* @file anim_emoji_gif_utils.c
* @brief GIF表情资源组件辅助函数实现
*/

#include <string.h>

#include "anim_emoji_gif.h"

// 表情映射表
typedef struct {
const char* name;
const lv_image_dsc_t* gif;
} emotion_map_t;

#if defined(CONFIG_USE_ANIM_EMOJI_NERTC)

#elif defined(CONFIG_USE_ANIM_EMOJI_OTTO)
// 外部声明的GIF资源
extern const lv_image_dsc_t staticstate;
extern const lv_image_dsc_t sad;
extern const lv_image_dsc_t happy;
extern const lv_image_dsc_t scare;
extern const lv_image_dsc_t buxue;
extern const lv_image_dsc_t anger;

// 表情映射表(21 个表情全部映射到 6 个目标状态)
static const emotion_map_t emotion_maps[] = {
{"neutral", &staticstate},
{"happy", &happy},
{"laughing", &happy},
{"funny", &happy},
{"sad", &sad},
{"angry", &anger},
{"crying", &sad},
{"loving", &happy},
{"embarrassed", &buxue},
{"surprised", &scare},
{"shocked", &scare},
{"thinking", &buxue},
{"winking", &happy},
{"cool", &happy},
{"relaxed", &staticstate},
{"delicious", &happy},
{"kissy", &happy},
{"confident", &happy},
{"sleepy", &staticstate},
{"silly", &happy},
{"confused", &buxue},
{NULL, NULL} // 结束标记
};
#elif defined(CONFIG_USE_ANIM_EYE_240X240_GIF1) || defined(CONFIG_USE_ANIM_EYE_160X160_GIF1)
extern const lv_image_dsc_t angry;
extern const lv_image_dsc_t confused;
extern const lv_image_dsc_t cool;
extern const lv_image_dsc_t delicious;
extern const lv_image_dsc_t happy;
extern const lv_image_dsc_t love;
extern const lv_image_dsc_t sad;
extern const lv_image_dsc_t sleepy;
extern const lv_image_dsc_t thinking;

static const emotion_map_t emotion_maps[] = {
{"neutral", &happy},
{"happy", &happy},
{"laughing", &happy},
{"funny", &happy},
{"sad", &sad},
{"angry", &angry},
{"crying", &sad},
{"loving", &love},
{"embarrassed", &confused},
{"surprised", &delicious},
{"shocked", &delicious},
{"thinking", &thinking},
{"winking", &cool},
{"cool", &cool},
{"relaxed", &happy},
{"delicious", &delicious},
{"kissy", &love},
{"confident", &confused},
{"sleepy", &sleepy},
{"silly", &delicious},
{"confused", &confused},
{NULL, NULL} /* 结束标记 */
};
#elif defined(CONFIG_USE_ANIM_EYE_240X240_GIF2) || defined(CONFIG_USE_ANIM_EYE_160X160_GIF2)
extern const lv_image_dsc_t angry;
extern const lv_image_dsc_t confused;
extern const lv_image_dsc_t happy;
extern const lv_image_dsc_t love;
extern const lv_image_dsc_t neutral;
extern const lv_image_dsc_t sleepy;
extern const lv_image_dsc_t thinking;
extern const lv_image_dsc_t winking;

static const emotion_map_t emotion_maps[] = {
{"neutral", &neutral},
{"happy", &happy},
{"laughing", &happy},
{"funny", &happy},
{"sad", &neutral},
{"angry", &angry},
{"crying", &neutral},
{"loving", &love},
{"embarrassed", &confused},
{"surprised", &confused},
{"shocked", &winking},
{"thinking", &thinking},
{"winking", &winking},
{"cool", &winking},
{"relaxed", &happy},
{"delicious", &winking},
{"kissy", &love},
{"confident", &confused},
{"sleepy", &sleepy},
{"silly", &neutral},
{"confused", &confused},
{NULL, NULL}
};
#else
static const emotion_map_t emotion_maps[] = {
{NULL, NULL} // 结束标记
};
#endif

const char* anim_emoji_gif_get_version(void) {
return "1.0.1";
}

const lv_image_dsc_t* anim_emoji_gif_get_by_name(const char* name) {
if (name == NULL) {
return NULL;
}

for (int i = 0; emotion_maps[i].name != NULL; i++) {
if (strcmp(emotion_maps[i].name, name) == 0) {
return emotion_maps[i].gif;
}
}

return NULL; // 未找到
}
33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/angry.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/confused.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/cool.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/delicious.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/happy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/love.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/sad.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/sleepy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_160/thinking.c

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/angry.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/confused.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/cool.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/delicious.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/happy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/love.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/sad.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/sleepy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif1_240/thinking.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/angry.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/confused.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/happy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/love.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/neutral.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/sleepy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/thinking.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_160/winking.c

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/angry.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/confused.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/happy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/love.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/neutral.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/sleepy.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/thinking.c

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions components/anim-emoji-gif/src/eye/gif2_240/winking.c

Large diffs are not rendered by default.

Binary file added components/anim-emoji-gif/src/otto/240/anger.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/anim-emoji-gif/src/otto/240/buxue.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/anim-emoji-gif/src/otto/240/happy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/anim-emoji-gif/src/otto/240/sad.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/anim-emoji-gif/src/otto/240/scare.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading