Deleted GIF decoder files (app_gifdec.c/h) and blink emotion asset. Added swipe_gesture.c/h for new gesture handling. Updated CMakeLists and emotion_manager to reflect these changes. Added Geist font asset.
66 lines
2.0 KiB
C
66 lines
2.0 KiB
C
#include "emotion_manager.h"
|
|
#include "esp_log.h"
|
|
#include "lvgl.h"
|
|
#include <stdio.h>
|
|
|
|
static const char *TAG = "EMOTION_MANAGER";
|
|
|
|
static lv_obj_t *emotion_screen_obj = NULL;
|
|
static lv_obj_t *emotion_label = NULL;
|
|
|
|
static const char *emotion_names[EMOTION_COUNT] = {
|
|
[EMOTION_BLINK] = "Heya!",
|
|
[EMOTION_SMILE] = "SMILE",
|
|
[EMOTION_SAD] = "SAD",
|
|
};
|
|
|
|
extern const lv_font_t Geist;
|
|
|
|
void emotion_manager_init(lv_obj_t *parent) {
|
|
if (emotion_screen_obj)
|
|
return;
|
|
|
|
ESP_LOGI(TAG, "Initializing Text-Based Emotion Manager");
|
|
|
|
/* Create a container object to act as the main screen */
|
|
emotion_screen_obj = lv_obj_create(parent);
|
|
lv_obj_set_size(emotion_screen_obj, LV_PCT(100), LV_PCT(100));
|
|
lv_obj_center(emotion_screen_obj);
|
|
|
|
/* Set background to Cream/Off-White (#FAF8F4) */
|
|
lv_obj_set_style_bg_color(emotion_screen_obj, lv_color_hex(0xFAF8F4), 0);
|
|
lv_obj_set_style_bg_opa(emotion_screen_obj, LV_OPA_COVER, 0);
|
|
lv_obj_set_style_border_width(emotion_screen_obj, 0, 0);
|
|
lv_obj_set_scrollbar_mode(emotion_screen_obj, LV_SCROLLBAR_MODE_OFF);
|
|
|
|
/* Allow touch events to pass through to the parent (which handles swipe
|
|
* gestures) */
|
|
lv_obj_clear_flag(emotion_screen_obj, LV_OBJ_FLAG_CLICKABLE);
|
|
|
|
/* Create the label */
|
|
emotion_label = lv_label_create(emotion_screen_obj);
|
|
/* Use the custom Geist 48 font */
|
|
lv_obj_set_style_text_font(emotion_label, &Geist, 0);
|
|
/* Use 1x native size (removed zoom) */
|
|
lv_obj_center(emotion_label);
|
|
/* Text color Dark Gray (#2B2B2B) */
|
|
lv_obj_set_style_text_color(emotion_label, lv_color_hex(0x2B2B2B), 0);
|
|
|
|
/* Initialize with default emotion */
|
|
emotion_manager_set(EMOTION_BLINK);
|
|
}
|
|
|
|
void emotion_manager_set(emotion_t emotion) {
|
|
if (emotion >= EMOTION_COUNT || !emotion_label)
|
|
return;
|
|
|
|
ESP_LOGI(TAG, "Setting emotion to %s", emotion_names[emotion]);
|
|
|
|
lv_label_set_text(emotion_label, emotion_names[emotion]);
|
|
lv_obj_center(emotion_label); /* Re-center after text change */
|
|
}
|
|
|
|
void emotion_manager_update(void) {
|
|
/* No periodic updates needed for static text */
|
|
}
|