# Add GTK under Linux in Eclipse
## Install GDK
```
sudo apt-get install libgtk-3-dev
sudo apt-get install libglib2.0-dev
```
## Add GTK include paths and libraries
In "Project properties > C/C++ Build > Settings" set the followings:
- "Cross GCC Compiler > Command line pattern"
- Add ` ${gtk+-cflags}` to the end (add a space between the last command and this)
- "Cross GCC Compiler > Includes"
- /usr/include/glib-2.0
- /usr/include/gtk-3.0
- /usr/include/pango-1.0
- /usr/include/cairo
- /usr/include/gdk-pixbuf-2.0
- /usr/include/atk-1.0
- "Cross GCC Linker > Command line pattern"
- Add ` ${gtk+-libs}` to the end (add a space between the last command and this)
- "Cross GCC Linker > Libraries"
- Add `pthread`
- In "C/C++ Build > Build variables"
- Configuration: [All Configuration]
- Add
- Variable name: `gtk+-cflags`
- Type: `String`
- Value: `pkg-config --cflags gtk+-3.0`
- Variable name: `gtk+-libs`
- Type: `String`
- Value: `pkg-config --libs gtk+-3.0`
## Init GDK in LVGL
1. In `main.c` `#incude "lv_drivers/gdkdrv/gdkdrv.h"`
2. Enable the GTK driver in `lv_drv_conf.h` with `USE_GTK 1`
3. After `lv_init()` call `gdkdrv_init()`;
4. Add a display:
```c
static lv_disp_buf_t disp_buf1;
static lv_color_t buf1_1[LV_HOR_RES_MAX * LV_VER_RES_MAX];
lv_disp_buf_init(&disp_buf1, buf1_1, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX);
/*Create a display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.buffer = &disp_buf1;
disp_drv.flush_cb = gtkdrv_flush_cb;
```
5. Add mouse:
```c
lv_indev_drv_t indev_drv_mouse;
lv_indev_drv_init(&indev_drv_mouse);
indev_drv_mouse.type = LV_INDEV_TYPE_POINTER;
```
6. Akk keyboard:
```c
lv_indev_drv_t indev_drv_kb;
lv_indev_drv_init(&indev_drv_kb);
indev_drv_kb.type = LV_INDEV_TYPE_KEYPAD;
indev_drv_kb.read_cb = lv_keyboard_read_cb;
lv_indev_drv_register(&indev_drv_kb);
```
7. Configure tick in `lv_conf.h`
```c
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "lv_drivers/gtkdrv/gtkdrv.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (gtkdrv_tick_get()) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
```
8. Be sure `LV_COLOR_DEPTH` is `32` in `lv_conf.h`
## Run in a window
Build and Run to "normally" run the UI in a window
## Run in browser
With the help of `Broadway` the UI can be easily shown via a browser.
1. Open Terminal and start *Broadway* with `broadwayd :5`. Leave the terminal running.
2. Navigate to where eclipse created the binary executable (my_project/Debug) and open a terminal in that folder.
In this terminal run `GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 ./my_executable` (replace *my_executable* wih name of your executable)
3. Open a web browser and go to `http://localhost:8085/`
![LVGL with GTK/GDK Broadway backend](https://github.com/lvgl/lv_drivers/blob/master/gtkdrv/broadway.png?raw=true)
没有合适的资源?快使用搜索试试~ 我知道了~
EVUE 全称 Embedded Vue,是一套面向物联网的小程序开发框架,类似VUE的开发方式,全面兼容鸿蒙HML语法
共2000个文件
bin:1504个
js:140个
h:131个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 15 浏览量
2024-02-07
11:58:40
上传
评论
收藏 127.87MB ZIP 举报
温馨提示
华为 鸿蒙系统 开发
资源推荐
资源详情
资源评论
收起资源包目录
EVUE 全称 Embedded Vue,是一套面向物联网的小程序开发框架,类似VUE的开发方式,全面兼容鸿蒙HML语法 (2000个子文件)
libSDL2-2.0.so.0 1.23MB
libhml.a 337KB
libhml.a 263KB
astyle_c 169B
astyle_h 33B
bytecode.bin 464KB
appbar.grade.e.bin 17KB
appbar.graph.line.up.bin 17KB
appbar.vip.bin 17KB
appbar.layer.arrange.solid.sendbackward.bin 17KB
appbar.page.corner.folded.bin 17KB
appbar.corner.bin 17KB
appbar.location.circle.bin 17KB
appbar.home.bin 17KB
appbar.arrow.right.left.bin 17KB
appbar.calculator.bin 17KB
appbar.image.focus.bin 17KB
appbar.sign.caution.bin 17KB
appbar.draw.brush.bin 17KB
appbar.bug.bin 17KB
appbar.cloudirc.bin 17KB
appbar.sport.football.bin 17KB
appbar.close.bin 17KB
appbar.language.python.text.bin 17KB
appbar.inbox.out.bin 17KB
appbar.clear.bin 17KB
appbar.connection.4g.bin 17KB
appbar.timer.2.bin 17KB
appbar.scrabble.n.bin 17KB
appbar.text.size.bin 17KB
appbar.notification.bin 17KB
appbar.draw.pen.add.bin 17KB
appbar.dimension.arrow.line.width.short.bin 17KB
appbar.timer.5.bin 17KB
appbar.card.6.bin 17KB
appbar.scrabble.i.bin 17KB
appbar.layout.expand.right.variant.bin 17KB
appbar.vector.pen.add.bin 17KB
appbar.image.ants.bin 17KB
appbar.stamp.bin 17KB
appbar.stamp.empty.bin 17KB
appbar.stocking.bin 17KB
appbar.cards.diamond.bin 17KB
appbar.edit.bin 17KB
appbar.list.reorder.up.bin 17KB
appbar.opacity.bin 17KB
appbar.ribbon.bin 17KB
appbar.clock.bin 17KB
appbar.scrabble.c.bin 17KB
appbar.gauge.50.bin 17KB
appbar.folder.people.bin 17KB
appbar.dimension.arrow.line.height.bin 17KB
appbar.map.folds.bin 17KB
appbar.grade.b.plus.bin 17KB
appbar.weather.symbol.bin 17KB
appbar.office.onenote.bin 17KB
appbar.monitor.to.bin 17KB
appbar.calendar.14.bin 17KB
appbar.adobe.bridge.bin 17KB
appbar.page.edit.bin 17KB
appbar.page.copy.bin 17KB
appbar.pin.remove.bin 17KB
appbar.email.hardedge.bin 17KB
appbar.transit.hazard.bin 17KB
appbar.windowsphone.bin 17KB
appbar.tag.bin 17KB
appbar.adobe.prelude.bin 17KB
appbar.people.multiple.bin 17KB
appbar.dimension.arrow.line.height.short.bin 17KB
appbar.film.select.bin 17KB
appbar.app.remove.bin 17KB
appbar.moon.waxing.crescent.bin 17KB
appbar.group.delete.bin 17KB
appbar.sidebar.right.collapse.bin 17KB
appbar.transit.car.bin 17KB
appbar.transform.rotate.counterclockwise.bin 17KB
appbar.adobe.fireworks.bin 17KB
appbar.usb.bin 17KB
appbar.forrst.bin 17KB
appbar.facebook.heart.bin 17KB
appbar.control.rewind.bin 17KB
appbar.form.basic.bin 17KB
appbar.layout.expand.right.bin 17KB
appbar.stock.down.bin 17KB
appbar.scrabble.g.bin 17KB
appbar.handicap.out.bin 17KB
appbar.page.file.gif.tag.bin 17KB
appbar.vector.pen.convert.bin 17KB
appbar.draw.marker.reflection.bin 17KB
appbar.office.bin 17KB
appbar.dimension.arrow.line.width.bin 17KB
appbar.arrow.left.right.bin 17KB
appbar.plane.rotated.45.bin 17KB
appbar.shopping.bin 17KB
appbar.tv.remote.bin 17KB
appbar.dimension.arrow.line.width.thick.bin 17KB
appbar.thermometer.celcius.bin 17KB
appbar.timer.rewind.bin 17KB
appbar.clipboard.edit.bin 17KB
appbar.input.question.bin 17KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
博士僧小星
- 粉丝: 1935
- 资源: 5894
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- DS-00437-GD25Q32E-Rev1.0
- 口袋方舟 v1.0.4
- FloEFD 2021版案例教程-01 球阀设计
- 一款极好用的 Office/WPS/Word/Excel/PPT/PDF工具箱软件 OfficeUtils 3.2
- vue项目开发综合实践笔记
- FloEFD 2021版案例教程-03 多孔介质
- 一款极好用的 Office/WPS/Word/Excel/PPT/PDF工具箱软件 OfficeUtils 3.1
- FloEFD 2021版案例教程-02 共轭传热
- java毕业设计+扫雷(程序)
- 一款极好用的 Office/WPS/Word/Excel/PPT/PDF工具箱软件 OfficeUtils 2.8
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功