The purpose of this example is to demonstrate the E\+Physics\+\_\+\+Logo.

For this example we\textquotesingle{}ll have an E\+Physics\+\_\+\+World.

The basic concepts like -\/ initializing an E\+Physics\+\_\+\+World, render geometry, physics limiting boundaries, were already covered in \mbox{\hyperlink{tutorial_ephysics_bouncing_ball}{E\+Physics -\/ Bouncing Ball}}\hypertarget{tutorial_ephysics_logo_add-logostruct}{}\doxysection{Logo Data Struct}\label{tutorial_ephysics_logo_add-logostruct}


While in this example we\textquotesingle{}ll be working with a struct to hold some objects in our code. For clarity sake we present you the struct declaration in the following block.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keyword}{struct }letter\_desc \{}
\DoxyCodeLine{      \textcolor{keyword}{const} \textcolor{keywordtype}{char} *letter;}
\DoxyCodeLine{      \textcolor{keywordtype}{int} padding;}
\DoxyCodeLine{   \} falling\_letters[] = \{}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}P"{}}, PADDING\_X\_1\},}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}H"{}}, PADDING\_X\_1\},}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}Y"{}}, PADDING\_X\_3\},}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}S1"{}}, PADDING\_X\_2\},}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}I"{}}, PADDING\_X\_2\},}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}C"{}}, PADDING\_X\_3\},}
\DoxyCodeLine{     \{\textcolor{stringliteral}{"{}S2"{}}, 0\}}
\DoxyCodeLine{   \};}

\end{DoxyCodeInclude}
\hypertarget{tutorial_ephysics_logo_add-lett}{}\doxysection{Adding the letters}\label{tutorial_ephysics_logo_add-lett}


To add the letters we\textquotesingle{}ll use this function that creates the shadow, light and letter images.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_letter\_add(\mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *letter, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} **image, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} **light, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} **shadow)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} w, h, sh\_w, sh\_h;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} buf[1024];}
\DoxyCodeLine{}
\DoxyCodeLine{   snprintf(buf, \textcolor{keyword}{sizeof}(buf), PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"{}/logo\_shadow-\/\%s.png"{}}, letter);}
\DoxyCodeLine{   *shadow = \mbox{\hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}}(evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}}(*shadow, buf, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(*shadow, \&sh\_w, \&sh\_h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(*shadow, sh\_w, sh\_h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(*shadow, 0, 0, 0, 0);}
\DoxyCodeLine{   evas\_object\_layer\_set(*shadow, LAYER\_SHADOW);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(*shadow);}
\DoxyCodeLine{}
\DoxyCodeLine{   snprintf(buf, \textcolor{keyword}{sizeof}(buf), PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"{}/logo\_letter-\/\%s.png"{}}, letter);}
\DoxyCodeLine{   *image = \mbox{\hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}}(evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}}(*image, buf, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(*image, \&w, \&h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(*image, w, h);}
\DoxyCodeLine{   evas\_object\_layer\_set(*image, LAYER\_LETTER);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(*image);}
\DoxyCodeLine{}
\DoxyCodeLine{   snprintf(buf, \textcolor{keyword}{sizeof}(buf), PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"{}/logo\_light-\/\%s.png"{}}, letter);}
\DoxyCodeLine{   *light = \mbox{\hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}}(evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}}(*light, buf, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(*light, w, h);}
\DoxyCodeLine{   evas\_object\_layer\_set(*light, LAYER\_LETTER);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(*light);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* allow easy access to shadow and light from the letter image */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Extras_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}}(*image, \textcolor{stringliteral}{"{}shadow"{}}, *shadow);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Extras_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}}(*image, \textcolor{stringliteral}{"{}light"{}}, *light);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


In this loop we\textquotesingle{}ll use the function letter\+\_\+add using the falling\+\_\+letters declared in logo data struct.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{group__Eina__Types__Group_ga7c1b6f81660b4e30516169e9e7d3261c}{EINA\_C\_ARRAY\_LENGTH}}(falling\_letters); i++)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \_letter\_add(evas, falling\_letters[i].letter, \&image, \&light, \&shadow);}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(shadow, \&sh\_w, NULL);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(image, \&w, \&h);}

\end{DoxyCodeInclude}


Place image and light on top, above what the viewport can show, to fall later on.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(image, x, -\/h * (i + 1) -\/ 50);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(light, x, -\/h * (i + 1) -\/ 50);}

\end{DoxyCodeInclude}


Place shadow below the hit-\/line\+: F\+L\+O\+O\+R\+\_\+Y, centered at image.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(shadow, x + CENTER(w, sh\_w), FLOOR\_Y);}

\end{DoxyCodeInclude}


Here we set the letters padding and add letter body using the function below and setting its friction.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        x += falling\_letters[i].padding + w;}
\DoxyCodeLine{}
\DoxyCodeLine{        letter\_body = \_letter\_body\_box\_add(world, image);}
\DoxyCodeLine{        \mbox{\hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}}(letter\_body, 0.4);}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}


Here we call another function that will be common to the circle body as well, note that we add a callback that will be explained later. 


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_letter\_body\_box\_add(\mbox{\hyperlink{group__EPhysics__World_ga83c0d22744748525aa2dac11726c58e6}{EPhysics\_World}} *world, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *image)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body}} *body = \mbox{\hyperlink{group__EPhysics__Body_gaf8f30587da7453114397d64dd9704d7f}{ephysics\_body\_box\_add}}(world);}
\DoxyCodeLine{}
\DoxyCodeLine{   \_letter\_body\_setup\_common(body, image);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_gada176f4748a4c2fc4ba2042021ea7067}{ephysics\_body\_event\_callback\_add}}}
\DoxyCodeLine{     (body, \mbox{\hyperlink{group__EPhysics__Body_gga904d0d1462e71c1f32cb27f540b5277cacb2363cd59bc8642e74ad916c6658e0a}{EPHYSICS\_CALLBACK\_BODY\_UPDATE}}, \_update\_box\_cb, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} body;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


This function is used to create the body setting its properties. Note that we disable its angular movement (rotation) on Z axis to this letters don\textquotesingle{}t tilt or recline. 


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_letter\_body\_setup\_common(\mbox{\hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body}} *body, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *view)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}}(body, view, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_gaa0915777f634079ca6c088fda5c20e8f}{ephysics\_body\_mass\_set}}(body, 1.2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}}(body, 0.6);}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga049f9410c5d04d5b810a1755da993cc0}{ephysics\_body\_angular\_movement\_enable\_set}}(body, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}}, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}},}
\DoxyCodeLine{                                             \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


In this callback function that we added to our letter body we\textquotesingle{}ll update its light and shadow.

First we\textquotesingle{}ll update the body, get its image geometry and set the floor distance based on images height.




\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_update\_box\_cb(\textcolor{keywordtype}{void} *data \_\_UNUSED\_\_, \mbox{\hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body}} *body, \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *image = event\_info;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *shadow = \mbox{\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}}(image, \textcolor{stringliteral}{"{}shadow"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *light = \mbox{\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}}(image, \textcolor{stringliteral}{"{}light"{}});}
\DoxyCodeLine{   \textcolor{keywordtype}{int} x, y, w, h, floor\_distance, alpha = 0;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* modify the evas object according to the body */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga7209e650176e0612efb2a2cc2af0ec27}{ephysics\_body\_evas\_object\_update}}(body);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}}(image, \&x, \&y, \&w, \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{   floor\_distance = FLOOR\_Y -\/ h;}

\end{DoxyCodeInclude}


As long as the letter approaches the floor, its shadow is darker, with bigger y.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (y > SH\_THRESHOLD)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{int} sh\_w, sh\_h;}
\DoxyCodeLine{        \textcolor{keywordtype}{double} pos\_x;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(shadow, \&sh\_w, \&sh\_h);}
\DoxyCodeLine{        alpha = 255 * (y -\/ SH\_THRESHOLD) / (floor\_distance -\/ SH\_THRESHOLD);}

\end{DoxyCodeInclude}


And with bigger x -- its proportional to x / W\+I\+D\+TH, but varies from 100 to 255


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        pos\_x = (double) x / (WIDTH -\/ w);}
\DoxyCodeLine{        alpha = alpha * PROP\_GET(pos\_x, 100, 255);}

\end{DoxyCodeInclude}


Note that the box shadow is not resized, just moved. And here set also the colors.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(shadow, x + CENTER(w, sh\_w) + SH\_OFFSET\_X,}
\DoxyCodeLine{                         FLOOR\_Y -\/ sh\_h + 2);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(shadow, alpha, alpha, alpha, alpha);}

\end{DoxyCodeInclude}


As long as the letter approaches the floor, its lighter, with bigger x and y.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(light, x, y);}
\DoxyCodeLine{   alpha = (y <= 0) ? 0 : y * 255 / floor\_distance;}
\DoxyCodeLine{   alpha = alpha * (x -\/ OFFSET\_X + 80) / (WIDTH -\/ OFFSET\_X);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(light, alpha, alpha, alpha, alpha);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
\hypertarget{tutorial_ephysics_logo_add-lettere}{}\doxysection{Adding the letter E}\label{tutorial_ephysics_logo_add-lettere}
Here we\textquotesingle{}ll add the last letter, \char`\"{}\+E\char`\"{} is a circle that comes rolling on the floor.

First we use the letter\+\_\+add function, set its shadow color and get its sizes.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \_letter\_add(evas, \textcolor{stringliteral}{"{}E"{}}, \&image, \&light, \&shadow);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(shadow, 255, 255, 255, 255);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(shadow, \&sh\_w, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(image, \&w, \&h);}

\end{DoxyCodeInclude}


Place image and light above the floor and to the left of viewport, to comes rolling later on.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(image, -\/w -\/ 1, FLOOR\_Y -\/ h + 1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(light, -\/w -\/ 1, FLOOR\_Y -\/ h + 1);}

\end{DoxyCodeInclude}


Place the shadow below the hit-\/line\+: F\+L\+O\+O\+R\+\_\+Y centered at image.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(shadow, -\/w -\/ 1 + CENTER(w, sh\_w), FLOOR\_Y);}

\end{DoxyCodeInclude}


Here we create the body using body\+\_\+circle function and enable its rotation on Z axis.


\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}


Make the \char`\"{}\+E\char`\"{} logo get into the viewport by applying a horizontal force.


\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}


Here we use the letter\+\_\+body\+\_\+setup\+\_\+common to create the body and set its properties, note that we add a callback that will be explained below. 


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_letter\_body\_circle\_add(\mbox{\hyperlink{group__EPhysics__World_ga83c0d22744748525aa2dac11726c58e6}{EPhysics\_World}} *world, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *image)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body}} *body = \mbox{\hyperlink{group__EPhysics__Body_gab57e99be7fe5a5174c38b8aea55f3266}{ephysics\_body\_cylinder\_add}}(world);}
\DoxyCodeLine{}
\DoxyCodeLine{   \_letter\_body\_setup\_common(body, image);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_gada176f4748a4c2fc4ba2042021ea7067}{ephysics\_body\_event\_callback\_add}}}
\DoxyCodeLine{     (body, \mbox{\hyperlink{group__EPhysics__Body_gga904d0d1462e71c1f32cb27f540b5277cacb2363cd59bc8642e74ad916c6658e0a}{EPHYSICS\_CALLBACK\_BODY\_UPDATE}}, \_update\_circle\_cb, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} body;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


In this callback function that we added to our \char`\"{}\+E\char`\"{} letter body we\textquotesingle{}ll update its light and shadow.

First we\textquotesingle{}ll update the body and get its image geometry.




\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_update\_circle\_cb(\textcolor{keywordtype}{void} *data \_\_UNUSED\_\_, \mbox{\hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body}} *body, \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *image = event\_info;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *shadow = \mbox{\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}}(image, \textcolor{stringliteral}{"{}shadow"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *light = \mbox{\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}}(image, \textcolor{stringliteral}{"{}light"{}});}
\DoxyCodeLine{   \textcolor{keywordtype}{int} x, y, w, h, sh\_w, sh\_h, alpha = 0;}
\DoxyCodeLine{   \textcolor{keyword}{const} Evas\_Map *map;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* modify the evas object according to the body */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga7209e650176e0612efb2a2cc2af0ec27}{ephysics\_body\_evas\_object\_update}}(body);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}}(image, \&x, \&y, \&w, \&h);}

\end{DoxyCodeInclude}


As long as the letter approaches the floor, its lighter, with bigger x.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(light, x, y);}
\DoxyCodeLine{   alpha = x * 255 / (WIDTH -\/ w);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(light, alpha, alpha, alpha, alpha);}

\end{DoxyCodeInclude}


Use the same map from image to the light (rotate it).


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   map = \mbox{\hyperlink{group__Evas__Object__Group_ga0e93f49776c3ef1da93df46cfcec93c9}{evas\_object\_map\_get}}(image);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga78db7f5391fb317ac8787975c32e4266}{evas\_object\_map\_set}}(light, map);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga80bc36afa9fa3d0118d32ca4402f0fe1}{evas\_object\_map\_enable\_set}}(light, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}

\end{DoxyCodeInclude}


As long as the letter approaches the floor, its shadow is darker, with bigger y.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga6307d5c3560528d7525a6c2ed16360ed}{evas\_object\_image\_size\_get}}(shadow, \&sh\_w, \&sh\_h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(shadow, x + CENTER(w, sh\_w) + SH\_OFFSET\_X,}
\DoxyCodeLine{                    FLOOR\_Y -\/ sh\_h + 2);}
\DoxyCodeLine{   alpha = 127 + alpha / 2;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(shadow, alpha, alpha, alpha, alpha);}

\end{DoxyCodeInclude}


When the letter \char`\"{}\+E\char`\"{} passes the viewport, we send it to the begin again to collide with the other letters.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (x > E\_THRESHOLD)}
\DoxyCodeLine{     \mbox{\hyperlink{group__EPhysics__Body_gae3c32aa0cdd60ffec86fff30097e75e1}{ephysics\_body\_move}}(body, -\/w -\/ 1, y, -\/15);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


Here we finish the example. The full source code can be found at \mbox{\hyperlink{ephysics_logo_c}{ephysics\+\_\+logo.\+c}}. 