\hypertarget{test_shapes_8c-example}{\section{test\+\_\+shapes.\+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__Shape_gadfcc565af1b4e898f2959292a9089e7e}{EPhysics\_Shape} *pentagon\_shape, *hexagon\_shape;
   \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *pentagon\_body, *hexagon\_body;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *pentagon, *hexagon;

   pentagon = elm\_image\_add(test\_data->win);
   elm\_image\_file\_set(
      pentagon, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"}, \textcolor{stringliteral}{"pentagon"});
   evas\_object\_move(pentagon, WIDTH / 3, HEIGHT / 2 - 80);
   evas\_object\_resize(pentagon, 70, 68);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(pentagon);
   test\_data->evas\_objs = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(test\_data->evas\_objs, pentagon);

   pentagon\_shape = \hyperlink{group__EPhysics__Shape_ga79ca252f9b15296416c3f73c75efa293}{ephysics\_shape\_new}();
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, -1, -9/33., -1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, -1, -9/33., 1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, 0, -1, -1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, 0, -1, 1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, 1, -9/33., -1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, 1, -9/33., 1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, -21/35., 1, -1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, -21/35., 1, 1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, 21/35., 1, -1);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(pentagon\_shape, 21/35., 1, 1);

   pentagon\_body = \hyperlink{group__EPhysics__Body_gabe733ecf3e04d267005118ff7291daab}{ephysics\_body\_shape\_add}(test\_data->world, pentagon\_shape);
   \hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}(pentagon\_body, pentagon, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(pentagon\_body, 1);
   test\_data->bodies = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(test\_data->bodies, pentagon\_body);

   hexagon = elm\_image\_add(test\_data->win);
   elm\_image\_file\_set(
      hexagon, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"}, \textcolor{stringliteral}{"hexagon"});
   evas\_object\_move(hexagon, WIDTH / 3 + 100, HEIGHT / 2 - 100);
   evas\_object\_resize(hexagon, 70, 60);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(hexagon);
   test\_data->evas\_objs = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(test\_data->evas\_objs, hexagon);

   hexagon\_shape = \hyperlink{group__EPhysics__Shape_ga79ca252f9b15296416c3f73c75efa293}{ephysics\_shape\_new}();
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 0, 30, -10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 0, 30, 10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 18, 0, -10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 18, 0, 10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 52, 0, -10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 52, 0, 10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 70, 30, -10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 70, 30, 10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 52, 60, -10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 52, 60, 10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 18, 60, -10);
   \hyperlink{group__EPhysics__Shape_ga2548c7a3aaf658b9be6132f60c1b3948}{ephysics\_shape\_point\_add}(hexagon\_shape, 18, 60, 10);

   hexagon\_body = \hyperlink{group__EPhysics__Body_gabe733ecf3e04d267005118ff7291daab}{ephysics\_body\_shape\_add}(test\_data->world, hexagon\_shape);
   \hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}(hexagon\_body, hexagon, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(hexagon\_body, 1);
   test\_data->bodies = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(test\_data->bodies, hexagon\_body);
   \hyperlink{group__EPhysics__Body_ga336a585598ed882a9575ed72a9f748e2}{ephysics\_body\_torque\_apply}(hexagon\_body, 0, 0, -3);

   \hyperlink{group__EPhysics__Shape_ga9d91574e5cdac7772d6c75c22c32d8a7}{ephysics\_shape\_del}(pentagon\_shape);
   \hyperlink{group__EPhysics__Shape_ga9d91574e5cdac7772d6c75c22c32d8a7}{ephysics\_shape\_del}(hexagon\_shape);
\}

\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\_shapes(\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}{"Shapes"}, \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, DEPTH);
   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_ga2a3e40784ef30f15d5d7e9f1f2a814b3}{ephysics\_body\_top\_boundary\_add}(test\_data->world);
   \hyperlink{group__EPhysics__Body_ga4ad52252b2537c6f41e14b9135847fe9}{ephysics\_body\_left\_boundary\_add}(test\_data->world);
   \hyperlink{group__EPhysics__Body_gab7e598db12a5270311c429f0ee12271c}{ephysics\_body\_right\_boundary\_add}(test\_data->world);

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