#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Elementary.h>
#include <Evas.h>
#define WIDTH (512)
#define HEIGHT (384)
#define DEPTH (100)
#define FLOOR_Y (HEIGHT - 80)
#define SH_THRESHOLD (250)
#define SH_OFFSET_X (- 16)
#define OFFSET_X (90)
#define PADDING_X_1 (16)
#define PADDING_X_2 (12)
#define PADDING_X_3 (22)
#define E_THRESHOLD (WIDTH + 560)
#define LAYER_SHADOW (10)
#define LAYER_LETTER (20)
#define CENTER(total, item) (((total) - (item)) / 2)
#define LIMIT(val, op, ref) (((val) op (ref)) ? (val) : (ref));
#define PROP_GET(pos, min, max) (((min) + ((max) - (min)) * (pos)) / (max))
static void
_update_box_cb(
void *data __UNUSED__,
EPhysics_Body *body,
void *event_info)
{
int x, y, w, h, floor_distance, alpha = 0;
floor_distance = FLOOR_Y - h;
if (y > SH_THRESHOLD)
{
int sh_w, sh_h;
double pos_x;
alpha = 255 * (y - SH_THRESHOLD) / (floor_distance - SH_THRESHOLD);
pos_x = (double) x / (WIDTH - w);
alpha = alpha * PROP_GET(pos_x, 100, 255);
FLOOR_Y - sh_h + 2);
}
alpha = (y <= 0) ? 0 : y * 255 / floor_distance;
alpha = alpha * (x - OFFSET_X + 80) / (WIDTH - OFFSET_X);
}
static void
_update_circle_cb(
void *data __UNUSED__,
EPhysics_Body *body,
void *event_info)
{
int x, y, w, h, sh_w, sh_h, alpha = 0;
const Evas_Map *map;
alpha = x * 255 / (WIDTH - w);
FLOOR_Y - sh_h + 2);
alpha = 127 + alpha / 2;
if (x > E_THRESHOLD)
}
static void
{
int w, h, sh_w, sh_h;
char buf[1024];
snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/logo_shadow-%s.png", letter);
snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/logo_letter-%s.png", letter);
snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/logo_light-%s.png", letter);
}
static void
{
}
{
_letter_body_setup_common(body, image);
return body;
}
{
_letter_body_setup_common(body, image);
return body;
}
EAPI_MAIN int
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
{
unsigned int i = 0;
int x, w, h, sh_w;
struct letter_desc {
const char *letter;
int padding;
} falling_letters[] = {
{"P", PADDING_X_1},
{"H", PADDING_X_1},
{"Y", PADDING_X_3},
{"S1", PADDING_X_2},
{"I", PADDING_X_2},
{"C", PADDING_X_3},
{"S2", 0}
};
return - 1;
30);
x = OFFSET_X;
{
_letter_add(evas, falling_letters[i].letter, &image, &light, &shadow);
x += falling_letters[i].padding + w;
letter_body = _letter_body_box_add(world, image);
}
_letter_add(evas, "E", &image, &light, &shadow);
letter_body = _letter_body_circle_add(world, image);
return 0;
}
These routines are used for EPhysics library interaction.
EAPI void ephysics_body_angular_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y, Eina_Bool enable_z)
Enable or disable body's rotation on z axis.
EAPI void ephysics_body_evas_object_set(EPhysics_Body *body, Evas_Object *evas_obj, Eina_Bool use_obj_pos)
Set an evas object to a physics body.
EAPI EPhysics_Body * ephysics_body_box_add(EPhysics_World *world)
Create a new box physics body.
#define EPHYSICS_BODY_MASS_STATIC
Mass amount used to makes a body static.
Definition: EPhysics.h:2043
EAPI void ephysics_body_evas_object_update(EPhysics_Body *body)
Update the evas object associated to the body.
EAPI void ephysics_body_restitution_set(EPhysics_Body *body, double restitution)
Set body's coefficient of restitution.
EAPI void ephysics_body_geometry_set(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d)
Set physics body geometry.
EAPI void ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y, double z)
Apply an impulse on the center of a body.
EAPI void ephysics_body_friction_set(EPhysics_Body *body, double friction)
Set body's friction.
EAPI void ephysics_body_mass_set(EPhysics_Body *body, double mass)
Set body's mass.
EAPI void ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func, const void *data)
Register a callback to a type of physics body event.
EAPI void ephysics_body_move(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord z)
Set physics body position.
EAPI EPhysics_Body * ephysics_body_cylinder_add(EPhysics_World *world)
Create a new cylinder physics body.
struct _EPhysics_Body EPhysics_Body
Body handle, represents an object on EPhysics world.
Definition: EPhysics.h:655
@ EPHYSICS_CALLBACK_BODY_UPDATE
Body being updated.
Definition: EPhysics.h:2263
EAPI EPhysics_World * ephysics_world_new(void)
Create a new physics world.
struct _EPhysics_World EPhysics_World
World handle, most basic type of EPhysics.
Definition: EPhysics.h:901
EAPI void ephysics_world_del(EPhysics_World *world)
Deletes a physics world.
EAPI void ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d)
Set dimensions of rendered area to be take on account by default updates.
EAPI int ephysics_shutdown(void)
Shutdown EPhysics.
EAPI int ephysics_init(void)
Initialize EPhysics.
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
#define EINA_FALSE
boolean value FALSE (numerical value 0)
Definition: eina_types.h:533
#define EINA_C_ARRAY_LENGTH(arr)
Macro to return the array length of a standard c array.
Definition: eina_types.h:621
Eina_Bool elm_bg_file_set(Eo *obj, const char *file, const char *group)
Sets the file (image or edje collection) to give life for the background.
Definition: efl_ui_bg.c:188
Evas_Object * elm_bg_add(Evas_Object *parent)
Adds a new background to the parent.
Definition: efl_ui_bg.c:304
#define ELM_MAIN()
macro to be used after the elm_main() function
Definition: elm_general.h:556
Eina_Bool elm_policy_set(unsigned int policy, int value)
Set a new policy's value (for a given policy group/identifier).
Definition: elm_main.c:1380
int elm_shutdown(void)
Shut down Elementary.
Definition: elm_main.c:467
void elm_run(void)
Run Elementary's main loop.
Definition: elm_main.c:1357
@ ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
quit when the application's last window is closed
Definition: elm_general.h:248
@ ELM_POLICY_QUIT
under which circumstances the application should quit automatically.
Definition: elm_general.h:227
void elm_win_title_set(Evas_Object *obj, const char *title)
Set the title of the window.
Definition: efl_ui_win.c:8641
void elm_win_resize_object_add(Eo *obj, Evas_Object *subobj)
Add subobj as a resize object of window obj.
Definition: efl_ui_win.c:8997
void elm_win_autodel_set(Eo *obj, Eina_Bool autodel)
Set the window's autodel state.
Definition: efl_ui_win.c:6194
Evas_Object * elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
Adds a window object.
Definition: efl_ui_win.c:9550
@ ELM_WIN_SPLASH
Splash window for a starting up application.
Definition: elm_win_legacy.h:77
Eo Evas
An opaque handle to an Evas canvas.
Definition: Evas_Common.h:163
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
EVAS_API void evas_object_geometry_get(const Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
Retrieves the position and (rectangular) size of the given Evas object.
Definition: evas_object_main.c:1335
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition: evas_object_main.c:2024
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition: evas_object_main.c:1171
EVAS_API void evas_object_layer_set(Evas_Object *obj, short l)
Sets the layer of its canvas that the given object will be part of.
Definition: evas_layer.c:212
EVAS_API Evas * evas_object_evas_get(const Eo *eo_obj)
Get the Evas to which this object belongs to.
Definition: evas_object_main.c:2662
EVAS_API const Evas_Map * evas_object_map_get(const Evas_Object *eo_obj)
Get current object transformation map.
Definition: evas_map.c:649
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
EVAS_API void evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Sets the hints for an object's maximum size.
Definition: evas_object_main.c:2596
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition: evas_object_main.c:1236
EVAS_API void evas_object_map_set(Evas_Object *eo_obj, const Evas_Map *map)
Set current object transformation map.
Definition: evas_map.c:532
EVAS_API void evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Sets the hints for an object's minimum size.
Definition: evas_object_main.c:2611
EVAS_API void evas_object_map_enable_set(Eo *eo_obj, Eina_Bool enabled)
Enable or disable the map that is set.
Definition: evas_map.c:516
EVAS_API void evas_object_image_size_get(const Evas_Object *obj, int *w, int *h)
Retrieves the size of the given image object.
Definition: evas_image_legacy.c:159
EVAS_API void evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
Set the source file from where an image object must fetch the real image data (it may be an Eet file,...
Definition: evas_image_legacy.c:194
EVAS_API Evas_Object * evas_object_image_filled_add(Evas *eo_e)
Creates a new image object that automatically scales its bound image to the object's area,...
Definition: evas_image_legacy.c:35