\hypertarget{test_slider_c_ephysics-test-h}{}\section{ephysics\+\_\+test.\+h}\label{test_slider_c_ephysics-test-h}

\begin{DoxyCodeInclude}
\textcolor{preprocessor}{#ifndef \_EPHYSICS\_PRIVATE\_H}
\textcolor{preprocessor}{#define \_EPHYSICS\_PRIVATE\_H}

\textcolor{preprocessor}{#include <\hyperlink{Edje_8h}{Edje.h}>}
\textcolor{preprocessor}{#include <Elementary.h>}
\textcolor{preprocessor}{#include <\hyperlink{Eina_8h}{Eina.h}>}
\textcolor{preprocessor}{#include <Evas.h>}

\textcolor{preprocessor}{#include "\hyperlink{EPhysics_8h}{EPhysics.h}"}

\textcolor{preprocessor}{#ifdef EPHYSICS\_LOG\_COLOR}
\textcolor{preprocessor}{#undef EPHYSICS\_LOG\_COLOR}
\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{#define EPHYSICS\_LOG\_COLOR EINA\_COLOR\_BLUE}

\textcolor{preprocessor}{#ifdef ERR}
\textcolor{preprocessor}{# undef ERR}
\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{#define ERR(...) EINA\_LOG\_DOM\_ERR(\_ephysics\_test\_log\_dom, \_\_VA\_ARGS\_\_)}

\textcolor{preprocessor}{#ifdef DBG}
\textcolor{preprocessor}{# undef DBG}
\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{#define DBG(...) EINA\_LOG\_DOM\_DBG(\_ephysics\_test\_log\_dom, \_\_VA\_ARGS\_\_)}

\textcolor{preprocessor}{#ifdef INF}
\textcolor{preprocessor}{# undef INF}
\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{#define INF(...) EINA\_LOG\_DOM\_INFO(\_ephysics\_test\_log\_dom, \_\_VA\_ARGS\_\_)}

\textcolor{preprocessor}{#ifdef WRN}
\textcolor{preprocessor}{# undef WRN}
\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{#define WRN(...) EINA\_LOG\_DOM\_WARN(\_ephysics\_test\_log\_dom, \_\_VA\_ARGS\_\_)}

\textcolor{preprocessor}{#ifdef CRI}
\textcolor{preprocessor}{# undef CRI}
\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{#define CRI(...) EINA\_LOG\_DOM\_CRIT(\_ephysics\_test\_log\_dom, \_\_VA\_ARGS\_\_)}

\textcolor{preprocessor}{#define EPHYSICS\_TEST\_THEME "ephysics\_test"}
\textcolor{preprocessor}{#define WIDTH (512)}
\textcolor{preprocessor}{#define HEIGHT (384)}
\textcolor{preprocessor}{#define DEPTH (100)}
\textcolor{preprocessor}{#define SHADOW\_ALPHA\_ID (1)}
\textcolor{preprocessor}{#define FLOOR\_Y (344)}
\textcolor{preprocessor}{#define FLOOR\_WIDTH (750)}
\textcolor{preprocessor}{#define SH\_THRESHOLD (200)}

\textcolor{preprocessor}{#ifdef \_\_cplusplus}
\textcolor{keyword}{extern} \textcolor{stringliteral}{"C"} \{
\textcolor{preprocessor}{#endif}

\textcolor{keyword}{extern} \textcolor{keywordtype}{int} \_ephysics\_test\_log\_dom;

\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Test\_Data Test\_Data;

\textcolor{keyword}{struct }\_Test\_Data \{
     \hyperlink{group__EPhysics__World_ga83c0d22744748525aa2dac11726c58e6}{EPhysics\_World} *world;
     \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *layout;
     \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *win;
     \hyperlink{struct__Eina__List}{Eina\_List} *constraints;
     \hyperlink{struct__Eina__List}{Eina\_List} *evas\_objs;
     \hyperlink{struct__Eina__List}{Eina\_List} *bodies;
     \textcolor{keywordtype}{void} *data;
\};

Test\_Data *test\_data\_new(\textcolor{keywordtype}{void});
\textcolor{keywordtype}{void} test\_data\_del(Test\_Data *test\_data);

\textcolor{keywordtype}{void} test\_clean(Test\_Data *test\_data);

\textcolor{keywordtype}{void} test\_win\_add(Test\_Data *test\_data, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *title, \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} autodel);

\textcolor{keywordtype}{void} update\_object\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *body, \textcolor{keywordtype}{void} *event\_info);

\textcolor{preprocessor}{#ifdef \_\_cplusplus}
\}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#endif}
\end{DoxyCodeInclude}
\hypertarget{test_camera_track_c_test-camera-track-c}{}\section{test\+\_\+camera\+\_\+track.\+c}\label{test_camera_track_c_test-camera-track-c}



\begin{DoxyCodeInclude}
test\_clean(Test\_Data *test\_data)
\{
   \hyperlink{group__EPhysics__Constraint_ga6cdc4a630836a63a51489b885c09c7e3}{EPhysics\_Constraint} *constraint;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *evas\_obj;
   \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *body;

   \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(test\_data->constraints, constraint)
      \hyperlink{group__EPhysics__Constraint_ga9108a722eb302109e47dd086a1db1fd4}{ephysics\_constraint\_del}(constraint);

   \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(test\_data->bodies, body)
      \hyperlink{group__EPhysics__Body_ga9f47ada6fe8ee0abb234bc4aaab7dd1c}{ephysics\_body\_del}(body);

   \hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}(test\_data->evas\_objs, evas\_obj)
      \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(evas\_obj);
\}

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}
test\_win\_add(Test\_Data *test\_data, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *title, \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} autodel)
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *win, *ly;

   win = elm\_win\_add(NULL, title, ELM\_WIN\_BASIC);
   elm\_win\_title\_set(win, title);
   elm\_win\_autodel\_set(win, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(win);
   test\_data->win = win;
   \textcolor{keywordflow}{if} (autodel)
     \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(win, 
      \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a4471afbcbb4a754b7b0bbde00fb9a277}{EVAS\_CALLBACK\_DEL},
                                    \_subwin\_del\_cb, test\_data);

   ly = elm\_layout\_add(win);
   elm\_win\_resize\_object\_add(win, ly);
   evas\_object\_size\_hint\_min\_set(ly, WIDTH, HEIGHT);
   evas\_object\_size\_hint\_max\_set(ly, WIDTH, HEIGHT);
   elm\_layout\_file\_set(ly, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"},
                       \textcolor{stringliteral}{"frame"});
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(ly);
   test\_data->layout = ly;
\}

\end{DoxyCodeInclude}



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

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

\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Track\_Data Track\_Data;

\textcolor{keyword}{struct }\_Track\_Data \{
     Test\_Data base;
     \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *body;
     \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *sp;
     \textcolor{keywordtype}{int} old\_cx;
\};

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_update\_floor(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *layout, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name, \textcolor{keywordtype}{int} delta\_x, \textcolor{keywordtype}{int} cy, 
      \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} ver)
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *floor\_obj;
   \textcolor{keywordtype}{int} x, y, fx, fy;

   floor\_obj = \hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}(layout, name);
   \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(floor\_obj, &x, &y, NULL, NULL);
   fx = x + delta\_x;
   \textcolor{keywordflow}{if} (fx < -FLOOR\_WIDTH)
     fx += 2 * FLOOR\_WIDTH;

   fy = (ver) ? FLOOR\_Y - 20 - cy + 40 : y;
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(floor\_obj, fx, fy);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_camera\_moved\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{group__EPhysics__World_ga83c0d22744748525aa2dac11726c58e6}{EPhysics\_World} *world \_\_UNUSED\_\_, \textcolor{keywordtype}{void} *event\_info)
\{
   \hyperlink{group__EPhysics__Camera_ga945948dcbf4d98beb457c77b6537116f}{EPhysics\_Camera} *camera = event\_info;
   Track\_Data *track\_data = data;
   \textcolor{keywordtype}{int} cx, cy, delta\_x = 0;
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} hor, ver;

   \hyperlink{group__Eina__File__Group_gae8924623ca601364965e3d88fb7f40fa}{DBG}(\textcolor{stringliteral}{"Camera moved"});

   \hyperlink{group__EPhysics__Camera_ga3f8d5e51ae54ac3c2a5bdc0a6fb162c6}{ephysics\_camera\_tracked\_body\_get}(camera, NULL, &hor, &ver);
   \hyperlink{group__EPhysics__Camera_ga5e549e85d0d98a878dc636b6463645d6}{ephysics\_camera\_position\_get}(camera, &cx, &cy);

   \textcolor{keywordflow}{if} (hor)
     delta\_x = track\_data->old\_cx - cx;

   \_update\_floor(track\_data->base.layout, \textcolor{stringliteral}{"floor"}, delta\_x, cy, ver);
   \_update\_floor(track\_data->base.layout, \textcolor{stringliteral}{"floor2"}, delta\_x, cy, ver);

   track\_data->old\_cx = cx;
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_track\_apply(Track\_Data *track\_data)
\{
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} hor = \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} ver = \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
   \hyperlink{group__EPhysics__Camera_ga945948dcbf4d98beb457c77b6537116f}{EPhysics\_Camera} *camera;
   \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *body;
   \textcolor{keywordtype}{int} mode;

   body = track\_data->body;
   camera = \hyperlink{group__EPhysics__World_ga97fe0c2a98a7998f29f7390cea868ff0}{ephysics\_world\_camera\_get}(track\_data->base.world);
   mode = (int) elm\_spinner\_value\_get(track\_data->sp);

   \textcolor{keywordflow}{switch} (mode)
     \{
      \textcolor{keywordflow}{case} 1:
         hor = \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
         \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} 3:
         hor = \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
      \textcolor{keywordflow}{case} 2:
         ver = \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
     \}

   \hyperlink{group__Eina__File__Group_gaa0bb6435252613b1a74175af3d60045f}{INF}(\textcolor{stringliteral}{"Tracking mode: hor = %i, ver = %i"}, hor, ver);
   \hyperlink{group__EPhysics__Camera_gabb7602830e3a9daa67d7bbe1a71a776e}{ephysics\_camera\_body\_track}(camera, body, hor, ver);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_tracking\_mode\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj \_\_UNUSED\_\_, \textcolor{keywordtype}{void} *event\_info \_\_UNUSED\_\_)
\{
   \_track\_apply(data);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_world\_populate(Track\_Data *track\_data)
\{
   \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *colors[] = \{\textcolor{stringliteral}{"blue-cube"}, \textcolor{stringliteral}{"purple-cube"}\};
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *cube, *sphere;
   \hyperlink{group__EPhysics__Body_gaf39ad724f8a2f81f9139c63263900bf1}{EPhysics\_Body} *body;
   \textcolor{keywordtype}{int} i, color, row;

   \textcolor{keywordflow}{for} (i = 0; i < 9; i++)
     \{
        color = i % 3 % 2;
        row = i / 3;

        cube = elm\_image\_add(track\_data->base.win);
        elm\_image\_file\_set(
           cube, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"},
           colors[color]);
        \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(cube, i * 70, (row + 2) * 70);
        \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(cube, 70, 70);
        \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(cube);
        track\_data->base.evas\_objs = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(
           track\_data->base.evas\_objs, cube);

        body = \hyperlink{group__EPhysics__Body_gaf8f30587da7453114397d64dd9704d7f}{ephysics\_body\_box\_add}(track\_data->base.world);
        \hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}(body, cube, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
        \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(body, 0.95);
        \hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}(body, 1);
        \hyperlink{group__EPhysics__Body_gaa0915777f634079ca6c088fda5c20e8f}{ephysics\_body\_mass\_set}(body, 0);
        track\_data->base.bodies = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(
           track\_data->base.bodies, body);
     \}

   sphere = elm\_image\_add(track\_data->base.win);
   elm\_image\_file\_set(
      sphere, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"}, \textcolor{stringliteral}{"green-ball"});
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(sphere, 0, 80);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(sphere, 54, 54);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(sphere);
   track\_data->base.evas\_objs = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(track\_data->base.evas\_objs,
                                                 sphere);

   body = \hyperlink{group__EPhysics__Body_gab26c09b5a98dabfb0323dbdb7f2a64af}{ephysics\_body\_sphere\_add}(track\_data->base.world);
   \hyperlink{group__EPhysics__Body_ga39cb9e95bbe1d097926a09365c501db3}{ephysics\_body\_evas\_object\_set}(body, sphere, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(body, 0.95);
   \hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}(body, 1);
   \hyperlink{group__EPhysics__Body_ga0ecea96f6a5a62f29e2bdeecb86db400}{ephysics\_body\_damping\_set}(body, 0.1, 0);
   \hyperlink{group__EPhysics__Body_ga9109b39047a724640f6a18c683c9eb07}{ephysics\_body\_central\_impulse\_apply}(body, 90, 0, 0);
   track\_data->body = body;
   track\_data->base.bodies = \hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}(track\_data->base.bodies, 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\_\_)
\{
   Track\_Data *track\_data = data;
   \hyperlink{group__EPhysics__Camera_ga945948dcbf4d98beb457c77b6537116f}{EPhysics\_Camera} *camera;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *floor\_obj;

   \hyperlink{group__Eina__File__Group_gae8924623ca601364965e3d88fb7f40fa}{DBG}(\textcolor{stringliteral}{"Restart pressed"});

   test\_clean((Test\_Data *)track\_data);
   \_world\_populate(track\_data);

   floor\_obj = \hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}(track\_data->base.layout, \textcolor{stringliteral}{"floor"});
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(floor\_obj, - WIDTH / 2, FLOOR\_Y - 20);
   floor\_obj = \hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}(track\_data->base.layout, \textcolor{stringliteral}{"floor2"});
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(floor\_obj, FLOOR\_WIDTH - WIDTH / 2, FLOOR\_Y - 20);

   camera = \hyperlink{group__EPhysics__World_ga97fe0c2a98a7998f29f7390cea868ff0}{ephysics\_world\_camera\_get}(track\_data->base.world);
   \hyperlink{group__EPhysics__Camera_gaed0ba3e4daecc66fca5dc399031da530}{ephysics\_camera\_position\_set}(camera, 50, 40);
   track\_data->old\_cx = 50;

   \_track\_apply(track\_data);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_win\_del(\textcolor{keywordtype}{void} *data, \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *e \_\_UNUSED\_\_, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj \_\_UNUSED\_\_, \textcolor{keywordtype}{void} *event\_info 
      \_\_UNUSED\_\_)
\{
   Track\_Data *track\_data = data;

   test\_clean((Test\_Data *)track\_data);
   \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(track\_data->base.layout);
   \hyperlink{group__EPhysics__World_ga99ebd1425f258f895c0089d6eb13def9}{ephysics\_world\_del}(track\_data->base.world);
   free(track\_data);
   \hyperlink{group__EPhysics_ga07e695074fb4d5d125b36c3a1d963f49}{ephysics\_shutdown}();
\}

\textcolor{keywordtype}{void}
test\_camera\_track(\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__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *sp, *floor\_obj;
   Track\_Data *track\_data;
   \hyperlink{group__EPhysics__World_ga83c0d22744748525aa2dac11726c58e6}{EPhysics\_World} *world;

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

   track\_data = calloc(1, \textcolor{keyword}{sizeof}(Track\_Data));
   \textcolor{keywordflow}{if} (!track\_data)
     \{
        \hyperlink{group__Eina__File__Group_ga24e93be9c5baa3aeab7021b64e290672}{ERR}(\textcolor{stringliteral}{"Failed to create test data"});
        \hyperlink{group__EPhysics_ga07e695074fb4d5d125b36c3a1d963f49}{ephysics\_shutdown}();
        \textcolor{keywordflow}{return};
     \}

   test\_win\_add((Test\_Data *) track\_data, \textcolor{stringliteral}{"Camera Track"}, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(track\_data->base.win, 
      \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a4471afbcbb4a754b7b0bbde00fb9a277}{EVAS\_CALLBACK\_DEL},
                                  \_win\_del, track\_data);

   elm\_layout\_signal\_callback\_add(track\_data->base.layout, \textcolor{stringliteral}{"restart"},
                                  \textcolor{stringliteral}{"test-theme"}, \_restart, track\_data);

   sp = elm\_spinner\_add(track\_data->base.win);
   elm\_spinner\_min\_max\_set(sp, 0, 3);
   elm\_spinner\_step\_set(sp, 1);
   elm\_spinner\_wrap\_set(sp, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   elm\_spinner\_special\_value\_add(sp, 0, \textcolor{stringliteral}{"No tracking"});
   elm\_spinner\_special\_value\_add(sp, 1, \textcolor{stringliteral}{"Horizontal tracking"});
   elm\_spinner\_special\_value\_add(sp, 2, \textcolor{stringliteral}{"Vertical tracking"});
   elm\_spinner\_special\_value\_add(sp, 3, \textcolor{stringliteral}{"Full tracking"});
   elm\_spinner\_editable\_set(sp, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE});
   elm\_object\_style\_set(sp, \textcolor{stringliteral}{"ephysics-test"});
   \hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}(sp, \textcolor{stringliteral}{"delay,changed"}, \_tracking\_mode\_cb,
                                  track\_data);
   elm\_layout\_content\_set(track\_data->base.layout, \textcolor{stringliteral}{"extra\_input"}, sp);
   track\_data->sp = sp;

   floor\_obj = elm\_image\_add(track\_data->base.win);
   elm\_image\_file\_set(
      floor\_obj, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"}, \textcolor{stringliteral}{"floor"});
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(floor\_obj, - WIDTH / 2, FLOOR\_Y - 20);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(floor\_obj, FLOOR\_WIDTH, 224);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(floor\_obj);
   \hyperlink{group__Evas__Object__Group__Extras_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}(track\_data->base.layout, \textcolor{stringliteral}{"floor"}, floor\_obj);

   floor\_obj = elm\_image\_add(track\_data->base.win);
   elm\_image\_file\_set(
      floor\_obj, PACKAGE\_DATA\_DIR \textcolor{stringliteral}{"/"} EPHYSICS\_TEST\_THEME \textcolor{stringliteral}{".edj"}, \textcolor{stringliteral}{"floor"});
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(floor\_obj, FLOOR\_WIDTH - WIDTH / 2, FLOOR\_Y - 20);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(floor\_obj, FLOOR\_WIDTH, 224);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(floor\_obj);
   \hyperlink{group__Evas__Object__Group__Extras_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}(track\_data->base.layout, \textcolor{stringliteral}{"floor2"}, floor\_obj);

   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);
   track\_data->base.world = world;
   \hyperlink{group__EPhysics__World_ga2b621ffb39920e4619fe2ec2e5508073}{ephysics\_world\_event\_callback\_add}(world,
                                     \hyperlink{group__EPhysics__World_gga0b0aff31f415be24679d4ab703674619aa5f6adbd98bc6599221d12ecfeb1cbc6}{EPHYSICS\_CALLBACK\_WORLD\_CAMERA\_MOVED}
      ,
                                     \_camera\_moved\_cb, track\_data);

   boundary = \hyperlink{group__EPhysics__Body_gaf8f30587da7453114397d64dd9704d7f}{ephysics\_body\_box\_add}(track\_data->base.world);
   \hyperlink{group__EPhysics__Body_gaa0915777f634079ca6c088fda5c20e8f}{ephysics\_body\_mass\_set}(boundary, 0);
   \hyperlink{group__EPhysics__Body_ga8821fa07fb5be9d956cc090b14223fd2}{ephysics\_body\_geometry\_set}(boundary, 0, FLOOR\_Y, -15, WIDTH * 4, 10, 30);
   \hyperlink{group__EPhysics__Body_ga731c9a6443f7c4294fce23fc1287b778}{ephysics\_body\_restitution\_set}(boundary, 0.65);
   \hyperlink{group__EPhysics__Body_ga986d45060bf6ba1689a56889a2bcabce}{ephysics\_body\_friction\_set}(boundary, 4);

   track\_data->old\_cx = 50;
   \_world\_populate(track\_data);
\}
\end{DoxyCodeInclude}
 