The purpose of this example is to demonstrate the E\+Physics\+\_\+\+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 E\+Physics\+\_\+\+World and one basic E\+Physics\+\_\+\+Body.

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_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;}

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   text = \mbox{\hyperlink{group__Evas__Object__Text_ga72224822cf1772ef16b1554f0a6205d5}{evas\_object\_text\_add}}(evas\_object\_evas\_get(test\_data-\/>win));}
\DoxyCodeLine{   evas\_object\_text\_text\_set(text, \textcolor{stringliteral}{"EPHYSICS"});}
\DoxyCodeLine{   evas\_object\_text\_font\_set(text, \textcolor{stringliteral}{"Sans"}, 54);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(text, 95, 56, 19, 255);}
\DoxyCodeLine{   evas\_object\_move(text, WIDTH / 4, HEIGHT / 8);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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 E\+Physics\+\_\+\+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_gaf8f30587da7453114397d64dd9704d7f}{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 E\+I\+N\+A\+\_\+\+F\+A\+L\+SE 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}}. 