\hypertarget{test_bouncing_text_8c-example}{\section{test\+\_\+bouncing\+\_\+text.\+c}
}

\begin{DoxyCodeInclude}
\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{# include <config.h>}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#include "ephysics\_test.h"}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_world\_populate(Test\_Data *test\_data)
\{
   \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *text\_body;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *text;
   \textcolor{keywordtype}{int} x, y, w;

   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);
   \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(text, &x, &y, &w, NULL);
   test\_data->evas\_objs = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(test\_data->evas\_objs, text);

   text\_body = \hyperlink{group__EPhysics__Body_gaf8f30587da7453114397d64dd9704d7f}{ephysics\_body\_box\_add}(test\_data->world);
   \hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}(text\_body, text, 
      \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
   \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);
   test\_data->bodies = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(test\_data->bodies, text\_body);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_restart(\textcolor{keywordtype}{void} *data, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj \_\_UNUSED\_\_, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *emission \_\_UNUSED\_\_, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *
      source \_\_UNUSED\_\_)
\{
   Test\_Data *test\_data = data;

   \hyperlink{group__Eina__File__Group_gae8924623ca601364965e3d88fb7f40fa}{DBG}(\textcolor{stringliteral}{"Restart pressed"});
   test\_clean(test\_data);
   \_world\_populate(test\_data);
\}

\textcolor{keywordtype}{void}
test\_bouncing\_text(\textcolor{keywordtype}{void} *data \_\_UNUSED\_\_, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj \_\_UNUSED\_\_, \textcolor{keywordtype}{void} *event\_info 
      \_\_UNUSED\_\_)
\{
   \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *boundary;
   \hyperlink{group__EPhysics__World_ga83c0d22744748525aa2dac11726c58e6}{EPhysics\_World} *world;
   Test\_Data *test\_data;

   \textcolor{keywordflow}{if} (!\hyperlink{group__EPhysics_gaca8fc170d73b3f688349cc4dbaf219fd}{ephysics\_init}())
     \textcolor{keywordflow}{return};

   test\_data = test\_data\_new();
   test\_win\_add(test\_data, \textcolor{stringliteral}{"Bouncing Text"}, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   elm\_object\_signal\_emit(test\_data->layout, \textcolor{stringliteral}{"borders,show"}, \textcolor{stringliteral}{"ephysics\_test"});
   elm\_layout\_signal\_callback\_add(test\_data->layout, \textcolor{stringliteral}{"restart"}, \textcolor{stringliteral}{"test-theme"},
                                  \_restart, test\_data);

   world = \hyperlink{group__EPhysics__World_ga108e2d7df8c81321b8d5bde8497f0d45}{ephysics\_world\_new}();
   \hyperlink{group__EPhysics__World_gaabf8abaf9c41b0c1e5daa4acf3df0356}{ephysics\_world\_render\_geometry\_set}(world, 50, 40, -50,
                                      WIDTH - 100, FLOOR\_Y - 40, 100);
   test\_data->world = world;

   boundary = \hyperlink{group__EPhysics__Body_gac5fc5a1817ac81e2f1fcdcd8908614f2}{ephysics\_body\_bottom\_boundary\_add}(test\_data->world);
   \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(boundary, 0.65);
   \hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}(boundary, 2);

   \_world\_populate(test\_data);
\}
\end{DoxyCodeInclude}
 