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

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics{bouncing_text}}
\end{DoxyImageNoCaption}


For this example we'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 \hyperlink{tutorial_ephysics_bouncing_ball}{E\+Physics -\/ Bouncing Ball}\hypertarget{tutorial_ephysics_bouncing_text_add-text}{}\section{Creating the text}\label{tutorial_ephysics_bouncing_text_add-text}


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


\begin{DoxyCodeInclude}
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *text;

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}
   text = \hyperlink{group__Evas__Object__Text_ga72224822cf1772ef16b1554f0a6205d5}{evas\_object\_text\_add}(evas\_object\_evas\_get(test\_data->win));
   \hyperlink{group__Evas__Object__Text_gabe57fc428ee4db9e9d7feb9e3a108fb3}{evas\_object\_text\_text\_set}(text, \textcolor{stringliteral}{"EPHYSICS"});
   \hyperlink{group__Evas__Object__Text_ga1813cea2c010c923d31787caec5dc857}{evas\_object\_text\_font\_set}(text, \textcolor{stringliteral}{"Sans"}, 54);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(text, 95, 56, 19, 255);
   evas\_object\_move(text, WIDTH / 4, HEIGHT / 8);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(text);

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

Note that we use \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}
   text\_body = \hyperlink{group__EPhysics__Body_gaf8f30587da7453114397d64dd9704d7f}{ephysics\_body\_box\_add}(test\_data->world);
   \hyperlink{group__EPhysics__Body_ga8821fa07fb5be9d956cc090b14223fd2}{ephysics\_body\_geometry\_set}(text\_body, x, y, -15, w * 5 / 6, 46, 30);
   \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(text\_body, 0.95);
   \hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}(text\_body, 0.1);

\end{DoxyCodeInclude}
\hypertarget{tutorial_ephysics_bouncing_text_text-binding}{}\section{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\+S\+E because in this example we don't want to set the physics body position to match evas object position.


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

\end{DoxyCodeInclude}


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