当前位置:网站首页>Allwinner V853 development board transplants LVGL-based 2048 games
Allwinner V853 development board transplants LVGL-based 2048 games
2022-08-10 15:33:00 【51CTO】
项目源码获取: V853 Tina_LVGL Download
LVGL 开发实战
移植基于 LVGL 的 2048 小游戏
This section will start with an already written one lvgl 小游戏 2048 Describe how it will have been written lvgl The program is ported to the development board.
这里使用的 2048 Mini-games are provided by Baiwen.com,开源地址: lv_lib_100ask
Prepare scaffolding
在这之前,Let's prepare the basics first LVGL 脚手架.可以直接从 lv_g2d_test Copy and modify it.
First we copy the source code,在 platform/thirdparty/gui/lvgl-8 源码文件夹里,把 红色箭头 所指的 lv_g2d_test The source code is copied to as a template Pointed by the yellow arrow lv_2048 文件夹里.
如下图所示,and clean up res 资源文件夹,

同样的,Make a copy of the index file,找到 openwrt/package/thirdparty/gui/lvgl-8 并把 lv_g2d_test 复制一份重命名为 lv_2048 作为我们 2048 The index used by the minigame.

Quick access to scaffolding: lv_g2d_test.file
并编辑 Makefile,修改文件名称,把 lv_g2d_test Modified here lv_2048
After the scaffolding is completed,可以 make menuconfig Check to see if it appears lv_2048 这个选项,选中它.

修改源码
The second step is to modify the source code.Edited copied before main.c 文件,把不需要的 lv_g2d_test 的部分删去.Keep the most basic parts.
Next is the connection lv_lib_100ask 与 2048 小游戏,我们先下载 lv_lib_100ask 的源码,放置到 platform/thirdparty/gui/lvgl-8/lv_2048 的 src 文件夹里.并按照 lv_lib_100ask 的说明,复制一份 lv_lib_100ask_conf_template.h 到 src 目录,并改名为 lv_lib_100ask_conf.h

编辑 lv_lib_100ask_conf.h,Enables references to the entire library,并配置启用 LV_USE_100ASK_2048 .为了简洁,Unnecessary configuration items are removed here.
再编辑 platform/thirdparty/gui/lvgl-8/lv_2048/src/lv_lib_100ask/lv_lib_100ask.h 中的版本号,修改为 (8,1,0)

之后在 main.c 里修改,对接 lv_100ask_2048_simple_test,具体如下.
(1)头文件加入 lv_lib_100ask/lv_lib_100ask.h
(2)在 main Add an interface call to the function
完整的 main.c 如下
然后就是 Makefile 修改,增加一个 lv_lib_100ask 的 SRC 引用.
顺便也把 BIN 改为 lv_2048 ,完整的 Makefile 如下
Butt touch
做了以上操作,You may find that there is no response to touch,This is because touch bound event The event number is incorrect,The default binding is event3 And look up Startup log 可知,The touch screen of the development board is docked event0

At this time, you need to modify the binding event 事件号,其配置文件在 lv_drv_conf.h 内:

这里将 event3 改为 event0 即可
Except this way of course,In addition, you can also use commands to generate soft linkstouchscreen,will be directly used touchscreen is the touch node,方便调试:
测试编译
修改好了,I hope to compile this package separately for testing without compiling the complete one SDK.可以这样做:
(1)确保已经 source build/envsetup.sh 并已经 lunch
(2)Execute commands in any folder mmo lv_2048 -B

其中 mmo 的意思是 单独编译一个 openWrt 软件包,后面的 lv_2048 是软件包名.-B Parameters come first clean 再编译,Without this parameter, it is compiled directly.
测试运行
编译打包后,use on the development board lv_2048 即可运行

边栏推荐
- Flask框架——MongoEngine使用MongoDB数据库
- Systemui status bar to add a new icon
- Mysql statement analysis, storage engine, index optimization, etc.
- SWIG tutorial "two"
- 请查收 2022华为开发者大赛备赛攻略
- Cesium快速上手4-Polylines图元使用讲解
- Scala collections
- [Semantic Segmentation] DeepLab Series
- SWIG tutorial "four" - package of go language
- Redis -- Nosql
猜你喜欢
随机推荐
TCP为什么是三次握手和四次挥手?
线上线下课程教学培训小程序开发制作功能介绍
阿里五位MySQL封神大佬耗17个月总结出53章性能优化法则
640. Solving Equations: Simple Simulation Problems
使用 ABAP 正则表达式解析 uuid 的值
基于 Azuki 系列:NFT估值分析框架“DRIC”
富爸爸穷爸爸之读书笔记
JS 从零手写实现一个bind方法
易基因|深度综述:m6A RNA甲基化在大脑发育和疾病中的表观转录调控作用
电商秒杀项目收获(二)
SYM32——RTC实时时钟程序讲解
It is reported that the original Meitu executive joined Weilai mobile phone, the top product may exceed 7,000 yuan
社区动态——恭喜海豚调度中国区用户组新晋 9 枚“社群管理员”
小程序-语音播报功能
Flask框架——MongoEngine使用MongoDB数据库
【MindSpore易点通机器人-02】设计与技术选型
[Data warehouse design] Why should enterprise data warehouses be layered?(six benefits)
推荐几款最好用的MySQL开源客户端,建议收藏!
从全球价值链视角看,京东云数智供应链对未来经济有何影响?
程序员=加班??——掌握时间才能掌握人生








