cedric patch - as per email.

SVN revision: 32650
This commit is contained in:
Carsten Haitzler 2007-11-13 06:00:33 +00:00
parent 4eb1a715eb
commit bebdbe654b
28 changed files with 82 additions and 57 deletions

View File

@ -1,3 +1,4 @@
#include <assert.h>
#include "main.h"
#include <SDL/SDL.h>
@ -16,11 +17,15 @@ engine_software_sdl_args(int argc, char **argv)
{
i++;
if (!strcmp(argv[i], "sdl")) ok = 1;
if (!strcmp(argv[i], "sdl-16")) ok = 2;
}
}
if (!ok) return 0;
if (ok == 1)
evas_output_method_set(evas, evas_render_method_lookup("software_sdl"));
else
evas_output_method_set(evas, evas_render_method_lookup("software_16_sdl"));
einfo = (Evas_Engine_Info_SDL *) evas_engine_info_get(evas);
@ -98,8 +103,14 @@ engine_software_sdl_loop(void)
else
evas_key_lock_on(evas, "Scroll_Lock");
break;
case SDLK_ESCAPE: evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL); break;
case SDLK_RETURN: evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL); break;
case SDLK_s:
case SDLK_ESCAPE:
evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
break;
case SDLK_KP_ENTER:
case SDLK_RETURN:
evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
break;
case SDLK_LEFT: evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); break;
case SDLK_RIGHT: evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); break;
case SDLK_q:

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/bar.png", NULL);
evas_object_image_file_set(o, build_path("bar.png"), NULL);
evas_object_image_border_set(o, 8, 8, 8, 8);
evas_object_show(o);
}

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/pan.png", NULL);
evas_object_image_file_set(o, build_path("pan.png"), NULL);
evas_object_color_set(o, 64, 64, 64, 255);
evas_object_image_border_set(o, 3, 3, 3, 3);
evas_object_show(o);

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
evas_object_image_smooth_scale_set(o, 0);
evas_object_show(o);
}

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
evas_object_image_smooth_scale_set(o, 0);
evas_object_show(o);
}

View File

@ -27,12 +27,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i < (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i < (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i < (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -27,12 +27,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i & 0x1)
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i & 0x1)
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i & 0x1)
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i & 0x1)
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -27,12 +27,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i > (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i > (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i > (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -30,12 +30,12 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[i] = o;
if (i > (OBNUM / 2))
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
else
{
Evas_Coord x, y;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
x = (win_w / 4) + (((rnd() & 0xff) * ((win_w / 2) - 120)) >> 8);
y = (win_h / 4) + (((rnd() & 0xff) * ((win_h / 2) - 120)) >> 8);
evas_object_move(o, x, y);

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
evas_object_image_smooth_scale_set(o, 1);
evas_object_show(o);
}

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
evas_object_image_smooth_scale_set(o, 1);
evas_object_show(o);
}

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/frame.png", NULL);
evas_object_image_file_set(o, build_path("frame.png"), NULL);
evas_object_image_border_set(o, 8, 8, 8, 8);
evas_object_show(o);
}

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/image.png", NULL);
evas_object_image_file_set(o, build_path("image.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 120, 160);
evas_object_resize(o, 120, 160);
evas_object_show(o);

View File

@ -25,7 +25,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/logo.png", NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 120, 160);
evas_object_resize(o, 120, 160);
evas_object_show(o);

View File

@ -24,14 +24,14 @@ static void _setup(void)
o = evas_object_image_add(evas);
o_images[0] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/im1.png", NULL);
evas_object_image_file_set(o, build_path("im1.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 720, 420);
evas_object_resize(o, 720, 420);
evas_object_show(o);
o = evas_object_image_add(evas);
o_images[1] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/im2.png", NULL);
evas_object_image_file_set(o, build_path("im2.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 720, 420);
evas_object_resize(o, 720, 420);
evas_object_show(o);

View File

@ -38,7 +38,7 @@ static void _setup(void)
yp = malloc(640 * 480);
up = malloc(320 * 240);
vp = malloc(320 * 240);
f = fopen(PACKAGE_DATA_DIR"/data/tp.yuv", "rb");
f = fopen(build_path("tp.yuv"), "rb");
if (f)
{
fread(yp, 640 * 480, 1, f);

View File

@ -38,7 +38,7 @@ static void _setup(void)
yp = malloc(640 * 480);
up = malloc(320 * 240);
vp = malloc(320 * 240);
f = fopen(PACKAGE_DATA_DIR"/data/tp.yuv", "rb");
f = fopen(build_path("tp.yuv"), "rb");
if (f)
{
fread(yp, 640 * 480, 1, f);

View File

@ -26,7 +26,7 @@ static void _setup(void)
{
o = evas_object_image_add(evas);
o_images[i] = o;
evas_object_image_file_set(o, PACKAGE_DATA_DIR"/data/tp.png", NULL);
evas_object_image_file_set(o, build_path("tp.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 640, 480);
evas_object_resize(o, 640, 480);
evas_object_show(o);

View File

@ -1075,9 +1075,36 @@ get_time(void)
}
#endif
const char *
build_path(const char *filename)
{
static char path[4096];
static char buffer[4096];
static int init = 0;
if (!init)
{
char *prefix;
prefix = getenv("EXPEDITE_DATA_DIR");
if (!prefix)
strcpy(path, PACKAGE_DATA_DIR"/data/");
else
snprintf(path, 4096, "%s/", prefix);
init = 1;
}
snprintf(buffer, 4096, "%s%s", path, filename);
return buffer;
}
int
engine_abort(void)
{
fprintf(stderr, "go: %i\n", go);
go = 0;
return go;
}

View File

@ -55,6 +55,7 @@ extern int win_w, win_h;
void srnd(void);
unsigned int rnd(void);
double get_time(void);
const char *build_path(const char *filename);
void engine_loop(void);
int engine_abort(void);

View File

@ -208,13 +208,11 @@ _ui_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
static void
_ui_menu_item_add(char *icon, char *text, void (*func) (void))
{
char buf[4096];
Menu_Item *mi;
mi = malloc(sizeof(Menu_Item));
snprintf(buf, 4096, "%s%s", data_dir, icon);
mi->o_icon = evas_object_image_add(evas);
evas_object_image_file_set(mi->o_icon, buf, NULL);
evas_object_image_file_set(mi->o_icon, build_path(icon), NULL);
evas_object_resize(mi->o_icon, 32, 32);
evas_object_image_fill_set(mi->o_icon, 0, 0, 32, 32);
mi->icon = strdup(icon);
@ -227,16 +225,8 @@ _ui_menu_item_add(char *icon, char *text, void (*func) (void))
static void
_ui_setup(void)
{
char buf[4096];
Evas_Object *o;
Evas_Coord x, y, w, h;
char *prefix;
prefix = getenv("EXPEDITE_DATA_DIR");
if (!prefix)
strcpy(data_dir, PACKAGE_DATA_DIR"/data/");
else
snprintf(data_dir, 4096, "%s/", prefix);
o = evas_object_rectangle_add(evas);
evas_object_move(o, 0, 0);
@ -299,8 +289,7 @@ _ui_setup(void)
o = evas_object_image_add(evas);
evas_object_move(o, (win_w - 120) / 2, ((win_h - 160) / 2));
snprintf(buf, 4096, "%s%s", data_dir, "logo.png");
evas_object_image_file_set(o, buf, NULL);
evas_object_image_file_set(o, build_path("logo.png"), NULL);
evas_object_image_fill_set(o, 0, 0, 120, 160);
evas_object_resize(o, 120, 160);
evas_object_layer_set(o, -98);
@ -317,16 +306,14 @@ _ui_setup(void)
o = evas_object_image_add(evas);
evas_object_move(o, 0, 0);
snprintf(buf, 4096, "%s%s", data_dir, "icon_sel.png");
evas_object_image_file_set(o, buf, NULL);
evas_object_image_file_set(o, build_path("icon_sel.png"), NULL);
evas_object_resize(o, 56, 56);
evas_object_image_fill_set(o, 0, 0, 56, 56);
o_menu_icon_sel = o;
o = evas_object_image_add(evas);
evas_object_move(o, 0, 0);
snprintf(buf, 4096, "%s%s", data_dir, "text_sel.png");
evas_object_image_file_set(o, buf, NULL);
evas_object_image_file_set(o, build_path("text_sel.png"), NULL);
evas_object_resize(o, 96, 32);
evas_object_image_fill_set(o, 0, 0, 96, 32);
evas_object_image_border_set(o, 8, 8, 8, 8);
@ -334,8 +321,7 @@ _ui_setup(void)
o = evas_object_image_add(evas);
evas_object_move(o, 0, 0);
snprintf(buf, 4096, "%s%s", data_dir, "icon_sel2.png");
evas_object_image_file_set(o, buf, NULL);
evas_object_image_file_set(o, build_path("icon_sel2.png"), NULL);
evas_object_resize(o, 56, 41);
evas_object_image_fill_set(o, 0, 0, 56, 41);
o_menu_icon_sel2 = o;