#ifdef HAVE_CONFIG_H
# include "config.h"
#else
# define EINA_UNUSED
#endif
#ifndef PACKAGE_DATA_DIR
#define PACKAGE_DATA_DIR "."
#endif
#include <Ecore.h>
#define WIDTH 480
#define HEIGHT 320
static const char commands[] = \
"commands are:\n"
"\tDown - move part down\n"
"\tUp - move part up\n"
"\tLeft - move part left\n"
"\tRight - move part right\n"
"\tPrior - move part up-left\n"
"\tNext - move part down-right\n"
"\tInsert - increase focal\n"
"\tSuppr - decrease focal\n"
"\tEsc - exit\n"
"\th - print help\n";
struct _App {
int x, y;
int focal;
};
static void
{
}
static void
_on_canvas_resize(Ecore_Evas *ee)
{
int w, h;
}
static void
_part_move(struct _App *app, int dx, int dy)
{
char emission[64];
if (app->animating)
return;
app->x += dx;
app->y += dy;
if (app->x > 1)
app->x = 1;
if (app->x < 0)
app->x = 0;
if (app->y > 1)
app->y = 1;
if (app->y < 0)
app->y = 0;
snprintf(emission, sizeof(emission), "move,%d,%d", app->x, app->y);
}
static void
{
struct _App *app = data;
if (!strcmp(ev->
key,
"h"))
{
printf(commands);
return;
}
else if (!strcmp(ev->
key,
"Down"))
{
_part_move(app, 0, 1);
}
else if (!strcmp(ev->
key,
"Up"))
{
_part_move(app, 0, -1);
}
else if (!strcmp(ev->
key,
"Left"))
{
_part_move(app, -1, 0);
}
else if (!strcmp(ev->
key,
"Right"))
{
_part_move(app, 1, 0);
}
else if (!strcmp(ev->
key,
"Prior"))
{
_part_move(app, -1, -1);
}
else if (!strcmp(ev->
key,
"Next"))
{
_part_move(app, 1, 1);
}
else if (!strcmp(ev->
key,
"KP_Add"))
{
app->focal += 5;
}
else if (!strcmp(ev->
key,
"KP_Subtract"))
{
app->focal -= 5;
if (app->focal < 5)
app->focal = 5;
}
else if (!strcmp(ev->
key,
"Escape"))
else
{
printf(
"unhandled key: %s\n", ev->
key);
printf(commands);
}
}
static void
{
struct _App *app = data;
}
int
{
const char *edje_file = PACKAGE_DATA_DIR"/perspective.edj";
struct _App app;
Ecore_Evas *ee;
return EXIT_FAILURE;
goto shutdown_ecore_evas;
app.x = 0;
app.y = 0;
app.focal = 50;
if (!ee) goto shutdown_edje;
printf(commands);
return EXIT_SUCCESS;
shutdown_edje:
shutdown_ecore_evas:
return EXIT_FAILURE;
}