CodingWithEFL

From ArmadeusWiki
Jump to: navigation, search

Installing required libs

- Using the menuconfig of buildroot (no usable for the moment)


Init required libs

We will use evas and ecore, we need to init both. So we call <lib>_init() for both.

evas_init();
ecore_init();

You can handle error during init like any other fuctions.

Set up where you will display things

On the APF you need to use the Framebuffer to displays graphics on the lcd So you need a new Framebuffer object from Evas_ecore

ee = ecore_evas_fb_new(NULL, ANGLE, WIDTH, HEIGHT);

where ANGLE is the rotation in ° of the screen

If you are on your host Pc, with Xorg, you will need a X11_software to display things.

ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);

Then you can show it on the screen

ecore_evas_show(ee);

Get the Evas Object

And now, we get an evas object, we will manipulate it after.

evas = ecore_evas_get(ee);

Displaying things

Let's add a rectangle to the evas object.

base_rect_sec = evas_object_rectangle_add(evas);

Then we will set the size of the rectangle

evas_object_resize(base_rect_sec, WIDTH-200, HEIGHT);

And now, we set the color of the rectangle. (R,G,B,Alpha)

evas_object_color_set(base_rect_sec, 0, 0, 255, 25);

We show the rectangle

evas_object_show(base_rect_sec);

Compiling

To test on your host computer you will compile it with :

 gcc -o test test.c -levas -lecore -lecore_evas

And then

 ./test

For the APF board

 -mtune=arm920t -msoft-float

Use the gcc version of buildroot, and -L to the /usr/lib in the root dir, and -I to /usr/include too. Sometime you will nee to do that for the staging_dir too.


And you will need to link to the framebuffer engine too

 -lecore_fb

And eet too if this had not be done automaticaly.

 -leet