int main(int argc, char **argv) { int i; struct stat st; #ifdef HAVE_REALPATH char rpath[PATH_MAX], rpath2[PATH_MAX]; #endif setlocale(LC_NUMERIC, "C"); ecore_app_no_system_modules(); if (!eina_init()) return -1; _edje_cc_log_dom = eina_log_domain_register ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR); if (_edje_cc_log_dom < 0) { EINA_LOG_ERR("Enable to create a log domain."); exit(-1); } if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN)) eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN); progname = ecore_file_file_get(argv[0]); eina_log_print_cb_set(_edje_cc_log_cb, NULL); tmp_dir = getenv("TMPDIR"); img_dirs = eina_list_append(img_dirs, "."); /* add defines to epp so edc files can detect edje_cc version */ defines = eina_list_append(defines, mem_strdup("-DEDJE_VERSION_12=12")); for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-h")) { main_help(); exit(0); } else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version"))) { printf("Version: %s\n", PACKAGE_VERSION); exit(0); } else if (!strcmp(argv[i], "-v")) { eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO); } else if (!strcmp(argv[i], "-no-lossy")) { no_lossy = 1; } else if (!strcmp(argv[i], "-no-comp")) { no_comp = 1; } else if (!strcmp(argv[i], "-no-raw")) { no_raw = 1; } else if (!strcmp(argv[i], "-no-etc1")) { no_etc1 = 1; } else if (!strcmp(argv[i], "-no-etc2")) { no_etc2 = 1; } else if (!strcmp(argv[i], "-no-save")) { no_save = 1; } else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1))) { i++; img_dirs = eina_list_append(img_dirs, argv[i]); } else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1))) { i++; fnt_dirs = eina_list_append(fnt_dirs, argv[i]); } else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1))) { i++; snd_dirs = eina_list_append(snd_dirs, argv[i]); } else if ((!strcmp(argv[i], "-md") || !strcmp(argv[i], "--mo_dir")) && (i < (argc - 1))) { i++; mo_dirs = eina_list_append(mo_dirs, argv[i]); } else if ((!strcmp(argv[i], "-vd") || !strcmp(argv[i], "--vibration_dir")) && (i < (argc - 1))) { i++; vibration_dirs = eina_list_append(vibration_dirs, argv[i]); } else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1))) { i++; data_dirs = eina_list_append(data_dirs, argv[i]); } else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1))) { i++; if (!tmp_dir) tmp_dir = argv[i]; } else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1))) { i++; if (!license) license = argv[i]; else licenses = eina_list_append(licenses, argv[i]); } else if ((!strcmp(argv[i], "-a") || !strcmp(argv[i], "--authors")) && (i < (argc - 1))) { i++; if (!authors) authors = argv[i]; } else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1))) { i++; min_quality = atoi(argv[i]); if (min_quality < 0) min_quality = 0; if (min_quality > 100) min_quality = 100; } else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1))) { i++; max_quality = atoi(argv[i]); if (max_quality < 0) max_quality = 0; if (max_quality > 100) max_quality = 100; } else if (!strcmp(argv[i], "-fastcomp")) { compress_mode = EET_COMPRESSION_SUPERFAST; } else if (!strcmp(argv[i], "-fastdecomp")) { compress_mode = EET_COMPRESSION_VERYFAST; } else if (!strcmp(argv[i], "-threads")) { threads = 1; } else if (!strcmp(argv[i], "-nothreads")) { threads = 0; } else if (!strncmp(argv[i], "-D", 2)) { defines = eina_list_append(defines, mem_strdup(argv[i])); } else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1))) { i++; file_out = argv[i]; } else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1))) { i++; watchfile = argv[i]; unlink(watchfile); } else if (!strcmp(argv[i], "-annotate")) { annotate = 1; } else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1))) { i++; depfile = argv[i]; unlink(depfile); } else if (!file_in) file_in = argv[i]; else if (!file_out) file_out = argv[i]; } if (!file_in) { ERR("no input file specified."); main_help(); exit(-1); } pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */ main, /* an optional symbol to check path of */ "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */ "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */ "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */ PACKAGE_BIN_DIR, /* package bin dir @ compile time */ PACKAGE_LIB_DIR, /* package lib dir @ compile time */ PACKAGE_DATA_DIR, /* package data dir @ compile time */ PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */ ); /* check whether file_in exists */ #ifdef HAVE_REALPATH if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode)) #else if (stat(file_in, &st) || !S_ISREG(st.st_mode)) #endif { ERR("file not found: %s.", file_in); main_help(); exit(-1); } if (!file_out) { char *suffix; if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0)) { file_out = strdup(file_in); if (file_out) { suffix = strstr(file_out,".edc"); strcpy(suffix,".edj"); } } } if (!file_out) { ERR("no output file specified."); main_help(); exit(-1); } #ifdef HAVE_REALPATH if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2)) #else if (!strcmp (file_in, file_out)) #endif { ERR("input file equals output file."); main_help(); exit(-1); } using_file(file_in, 'E'); if (annotate) using_file(file_out, 'O'); if (!edje_init()) exit(-1); edje_file = mem_alloc(SZ(Edje_File)); edje_file->compiler = strdup("edje_cc"); edje_file->version = EDJE_FILE_VERSION; edje_file->minor = EDJE_FILE_MINOR; edje_file->feature_ver = 1; /* increment this every time we add a field * or feature to the edje file format that * does not load nicely as a NULL or 0 value * and needs a special fallback initialization */ edje_file->base_scale = FROM_INT(1); source_edd(); source_fetch(); data_setup(); compile(); reorder_parts(); data_process_scripts(); data_process_lookups(); data_process_script_lookups(); data_write(); eina_prefix_free(pfx); pfx = NULL; edje_shutdown(); eina_log_domain_unregister(_edje_cc_log_dom); eina_shutdown(); return 0; }
int main() { window_setup(); data_setup(); SDL_Event event; while(1) { start_time = SDL_GetTicks(); if (SDL_PollEvent(&event)) { handle_event(&event); } /* //Set up screen and background display for (int x = 0; x < SCREEN_WIDTH / SPRITE_SIZE; x++) { for (int y = 0; y < SCREEN_HEIGHT / SPRITE_SIZE; y++) { rcGrass.x = x * SPRITE_SIZE; rcGrass.y = y * SPRITE_SIZE; SDL_BlitSurface(grass, &rcSrc_Grass, screen, &rcGrass); } } */ SDL_BlitSurface(grass, &rcSrc_Grass, screen, &rcGrass); //Handle character movement int i = 0; for (i = 0; i<2; i++){ npc_move(&demo[i]); animate(&demo[i]); move(&demo[i]); rcSprite.x = demo[i].move.position[0]; rcSprite.y = demo[i].move.position[1]; switch(demo[i].move.direction) { case SDLK_UP: rcSrc_Sprite.y = demo[i].up[demo[i].cur_frame]; break; case SDLK_DOWN: rcSrc_Sprite.y = demo[i].down[demo[i].cur_frame]; break; case SDLK_LEFT: rcSrc_Sprite.y = demo[i].left[demo[i].cur_frame]; break; case SDLK_RIGHT: rcSrc_Sprite.y = demo[i].right[demo[i].cur_frame]; break; } SDL_BlitSurface(sprite, &rcSrc_Sprite, screen, &rcSprite); }/* animate(&demo1); animate(&demo2); move(&demo1); move(&demo2); rcSprite.x = demo1.move.position[0]; rcSprite.y = demo1.move.position[1]; switch(demo1.move.direction) { case SDLK_UP: rcSrc_Sprite.y = demo1.up[demo1.cur_frame]; break; case SDLK_DOWN: rcSrc_Sprite.y = demo1.down[demo1.cur_frame]; break; case SDLK_LEFT: rcSrc_Sprite.y = demo1.left[demo1.cur_frame]; break; case SDLK_RIGHT: rcSrc_Sprite.y = demo1.right[demo1.cur_frame]; break; } */ SDL_UpdateRect(screen, 0, 0, 0, 0); endtime = SDL_GetTicks()-start_time; if (1000/FPS > endtime) SDL_Delay((1000/FPS)-endtime); } }