LVGL开发 | lv_lib_100ask之lvgl数字对拼图小游戏(lv_100ask_memory_game)-接口简单使用便捷
Posted 挨踢民工biubiu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LVGL开发 | lv_lib_100ask之lvgl数字对拼图小游戏(lv_100ask_memory_game)-接口简单使用便捷相关的知识,希望对你有一定的参考价值。
前言
lv_100ask_memory_game 是一个记忆拼图数字对游戏。
单击方格用于显示数字。匹配两个数字,方格将显示从而显示图像。
lv_100ask_memory_game
lv_100ask_memory_game 特性:
- 自定义关卡
- 自定义样式
- 自定义背景图片
- more todo…
lv_100ask_memory_game
使用起来非常简单,后续自定义拓展功能也很方便,更多新功能敬请期待。
使用示例
/**********************
* STATIC VARIABLES
**********************/
static lv_obj_t * level_label;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
static void slider_event_cb(lv_event_t * e)
lv_obj_t * slider = lv_event_get_target(e);
lv_obj_t * memory_game = lv_event_get_user_data(e);
lv_100ask_memory_game_set_map(memory_game, lv_slider_get_value(slider), lv_slider_get_value(slider));
lv_label_set_text_fmt(level_label, "%d*%d", lv_100ask_memory_game_get_row(memory_game), lv_100ask_memory_game_get_row(memory_game));
void lv_100ask_memory_game_simple_test(void)
lv_obj_t * memory_game = lv_100ask_memory_game_create(lv_scr_act());
lv_obj_set_size(memory_game, 480, 480);
//lv_100ask_memory_set_map(memory_game, 2, 2);
lv_obj_set_style_text_font(memory_game, &lv_font_montserrat_30, 0);
lv_obj_center(memory_game);
lv_obj_t * slider = lv_slider_create(lv_scr_act());
lv_obj_align_to(slider, memory_game, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
lv_slider_set_range(slider, 2, 10);
lv_slider_set_value(slider, lv_100ask_memory_game_get_row(memory_game), LV_ANIM_ON);
lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, memory_game);
level_label = lv_label_create(lv_scr_act());
lv_label_set_text_fmt(level_label, "%d*%d", lv_100ask_memory_game_get_row(memory_game), lv_100ask_memory_game_get_row(memory_game));
lv_obj_align_to(level_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
仓库地址
- gitee: https://gitee.com/weidongshan/lv_lib_100ask/tree/master/src/lv_100ask_calc
- github: https://github.com/100askTeam/lv_lib_100ask/tree/master/src/lv_100ask_calc
以上是关于LVGL开发 | lv_lib_100ask之lvgl数字对拼图小游戏(lv_100ask_memory_game)-接口简单使用便捷的主要内容,如果未能解决你的问题,请参考以下文章
LVGL开发 | lv_lib_100ask之lvgl计算器(lv_100ask_calc)-接口简单使用便捷
LVGL开发 | lv_lib_100ask之lvgl计算器(lv_100ask_calc)-接口简单使用便捷
LVGL开发 | lv_lib_100ask之lvgl页面管理器(lv_100ask_page_manager)-页面管理简单方便
LVGL开发 | lv_lib_100ask之lvgl页面管理器(lv_100ask_page_manager)-页面管理简单方便
LVGL开发 | lv_lib_100ask之lvgl数字对拼图小游戏(lv_100ask_memory_game)-接口简单使用便捷
LVGL开发 | lv_lib_100ask之lvgl数字对拼图小游戏(lv_100ask_memory_game)-接口简单使用便捷