The purpose of this example is to demonstrate the EPhysics\+\_\+\+Body binding to a text (Evas\+\_\+\+Object)

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{bouncing_text}}
\end{DoxyImageNoCaption}


For this example we\textquotesingle{}ll have an EPhysics\+\_\+\+World and one basic EPhysics\+\_\+\+Body.

The basic concepts like -\/ initializing an EPhysics\+\_\+\+World, render geometry, physics limiting boundaries, were already covered in \mbox{\hyperlink{tutorial_ephysics_bouncing_ball}{EPhysics -\/ Bouncing Ball}}\hypertarget{tutorial_ephysics_bouncing_text_add-text}{}\doxysection{Creating the text}\label{tutorial_ephysics_bouncing_text_add-text}


Create a basic evas\+\_\+object\+\_\+text.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *text;}
\DoxyCodeLine{   text = \mbox{\hyperlink{group__Evas__Object__Text__Group_gae4d422b8ccfeadf3e24c5349a78e530a}{evas\_object\_text\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(test\_data-\/>win));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Text__Group_ga1c9f3b5f76d5c2f020320d84a8197492}{evas\_object\_text\_text\_set}}(text, \textcolor{stringliteral}{"{}EPHYSICS"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Text__Group_gac5dd3bf469c8df9c4fe36d08c066f122}{evas\_object\_text\_font\_set}}(text, \textcolor{stringliteral}{"{}Sans"{}}, 54);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(text, 95, 56, 19, 255);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(text, WIDTH / 4, HEIGHT / 8);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(text);}

\end{DoxyCodeInclude}
 \hypertarget{tutorial_ephysics_bouncing_text_add-textbody}{}\doxysection{Creating the body}\label{tutorial_ephysics_bouncing_text_add-textbody}
Create a simple EPhysics\+\_\+\+Body.

Note that we use \mbox{\hyperlink{group__EPhysics__Body_ga8821fa07fb5be9d956cc090b14223fd2}{ephysics\+\_\+body\+\_\+geometry\+\_\+set()}} to define its size because the evas\+\_\+object has a different size that we want to represent physically. The text may have accent or letters like j and g.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   text\_body = \mbox{\hyperlink{group__EPhysics__Body_ga6381538c9002ea30171c0a64100350f5}{ephysics\_body\_box\_add}}(test\_data-\/>world);}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga8821fa07fb5be9d956cc090b14223fd2}{ephysics\_body\_geometry\_set}}(text\_body, x, y, -\/15, w * 5 / 6, 46, 30);}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}}(text\_body, 0.95);}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}}(text\_body, 0.1);}

\end{DoxyCodeInclude}
 \hypertarget{tutorial_ephysics_bouncing_text_text-binding}{}\doxysection{Binding}\label{tutorial_ephysics_bouncing_text_text-binding}


After creating the body and the text, now we need to bind them.

We set the last parameter as EINA\+\_\+\+FALSE because in this example we don\textquotesingle{}t want to set the physics body position to match evas object position.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}}(text\_body, text, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}

\end{DoxyCodeInclude}
 Here we finish the example. The full source code can be found at \mbox{\hyperlink{test_bouncing_text_c}{test\+\_\+bouncing\+\_\+text.\+c}}. 