How to use Enlightenment Foundation Libraries
The Enlightenment Foundation Libraries, or EFL, is a set of open source graphical software libraries that grew out of the Enlightenment window manager project and is developed by Enlightenment.org with some sponsorship from Samsung, ProFUSION and Free.
The project's focus is to make the EFL a flexible yet powerful and easy to use set of tools to extend the capabilities of both the Enlightenment window manager and other software projects based on the EFL. The libraries were created for version 0.17 of the window manager.
The libraries are meant to be portable and optimized to be functional even on devices such as PDAs.
How to install the EFL
First thing to do is have these libraries installed :
autopoint libglib2.0-dev libltdl-dev libcurl4-openssl-dev liblua5.1-0-dev libfontconfig1-dev libx11-dev libdbus-1-dev libbz2-dev libid3tag0-dev libpng12-dev libtiff4-dev libungif4-dev libjpeg62-dev libfreetype6-dev libpam0g-dev libxcursor-dev libxml2-dev libssl-dev autoconf pkg-config libpng3-dev libxkbfile-dev libsqlite3-dev libimlib2-dev libtagc0-dev libtag1-dev libxmu-dev libxdamage-dev libxcomposite-dev libasound2-dev cmake
You can run :
sudo apt-get install autopoint libglib2.0-dev libltdl-dev libcurl4-openssl-dev liblua5.1-0-dev libfontconfig1-dev libx11-dev libdbus-1-dev libbz2-dev libid3tag0-dev libpng12-dev libtiff4-dev libungif4-dev libjpeg62-dev libfreetype6-dev libpam0g-dev libxcursor-dev libxml2-dev libssl-dev autoconf pkg-config libpng3-dev libxkbfile-dev libsqlite3-dev libimlib2-dev libtagc0-dev libtag1-dev libxmu-dev libxdamage-dev libxcomposite-dev libasound2-dev cmake
to install them if you are on Debian-based distribution.
Then clone this git repository :
git clone git://github.com/wargio/EFL-PS3.git
Once cloned, open a terminal and launch download_essential.sh :
Once finished, launch download_ps3efl.sh and then build_ps3efl.sh :
./download_ps3efl.sh && ./build_ps3efl.sh
If everything goes right, you will have the EFL installed.
if you have trouble, add this line into the build_ps3efl.sh
How to use it
to use this libs you will need to learn how to use Ecore (you can see it as "core" of the app), Evas, a canvas API.
Ecore is a clean and tiny event loop library with many modules to do lots of convenient things for a programmer, to save time and effort. It's small and lean, designed to work from embedded systems all the way up to large and powerful multi-cpu workstations. The main loop has a number of primitives to be used with its main loop. It serializes all the primitives and allows for great responsiveness without the need for threads(or any other concurrency).
(Description taken from EFL Doc)
to use this, you will need to include:
#include <Ecore.h> #include <Ecore_Evas.h> //This will include also Evas.h
then you will need to initialize the Ecore. to do that, you can just simply call this function:
then create a pointer of this Ecore_Evas type, that you will use to create object. once done, you can initialize it by giving the resolution of the screen:
uint16_t width = 1280; uint16_t height = 720; Ecore_Evas *ee_core = ecore_evas_new(NULL, 0, 0, width, height, NULL);
now it's time to generate the window (if on PC) or to initialize the RSX (if on the PS3).
ecore_evas_title_set(ee_core, "Name of the window"); ecore_evas_show(ee_core);
ok. now you have fully setup the core and you only need to set what to draw. to do that, you need to get the canvas (an Evas pointer) from the Ecore, so you will need to call this function:
Evas* canvas = ecore_evas_get(ee_core);
after that, you can use that Evas pointer, to add object like rectangles, images, text, etc (you will see how to do that on the Evas paragraph).
now it's time to start the Ecore loop; what does this means? well it will read all the object that you created and draw them on the screen.
you can stop it by calling this:
let's say that our homebrew has finished to do all the thing, now we only need to stop and free everything. to do that you need to free the Ecore_Evas pointer that we have created initially and shutdown the Ecore.
Add these flag to the makefile
PKG_CONFIG_LIBDIR="$PSL1GHT/ppu/lib/pkgconfig" PKG_CONFIG_PATH="$PS3DEV/portlibs/ppu/lib/pkgconfig" LIBS = `pkg-config ecore ecore-evas --libs` CFLAGS = `pkg-config ecore ecore-evas --cflags`
Evas is a clean display canvas API for several target display systems that can draw anti-aliased text, smooth super and sub-sampled scaled images, alpha-blend objects and much more. (Description taken from EFL Doc)
This lib has a lot of functions. i will explain how to use it. you can find a good example at the and of the page.
first at all, you need to include the lib. (if you are going to use Ecore + Evas, you will not need to include the lib, since it's already in the Evas_Ecore.h header)
you need to create a Evas pointer that point to an engine. if you use Ecore, you can get it with the ecore_evas_get() function (give a look to the Ecore tutorial above).
now you will need to create an Evas_Object pointer that you will use to setup what you will draw (an image, a text or simply a background).
Evas* canvas = ecore_evas_get(ee_core); Evas_Object *obj = NULL;
now you need to say what object it will be, for example an image.
this will create an object for image rendering.
obj = evas_object_image_add(canvas);
now you need to fill the object with the image
evas_object_image_file_set(obj, "my_image.png", NULL);
you only need now to say where to draw it, fill the image with the pixel that you want to see, resize it and draw.
int x = 0, y = 0; int img_width = 300, img_height = 300; evas_object_move(obj, x, y); // this will say where to draw evas_object_image_fill_set(obj, 0, 0, img_width, img_height); //this will set from what pixel to what pixel to draw // from the pixel (0,0) to the (img_width, img_height) pixel evas_object_resize(obj, 500, 500); // this will resize the object. the image size is 300x300px, now is 500x500px. evas_object_show(obj); //this will draw the object on the screen. you just need to call it once.
Add these flag to the makefile
PKG_CONFIG_LIBDIR="$PSL1GHT/ppu/lib/pkgconfig" PKG_CONFIG_PATH="$PS3DEV/portlibs/ppu/lib/pkgconfig" LIBS = `pkg-config ecore-evas evas --libs` CFLAGS = `pkg-config ecore-evas evas --cflags`
Example of Code
EFL Team; KaKaRoTo; Deroad/Wargio; Wikipedia;