/** * Creates a speed belt on the map. * * @param[in,out] world A pointer to the world structure. * @param[in] type The tile type. * @param[in] xPos The tile xpos. * @param[in] yPos The tile ypos. * @param[in] level The level that the tile is on. * * @designer * @author */ unsigned int create_stile(World * world, int type, int xPos, int yPos, int level) { if(type != 1 && type != 2) { return -1; } unsigned int speed_tile = create_entity(world, COMPONENT_RENDER_PLAYER | COMPONENT_POSITION | COMPONENT_ANIMATION | COMPONENT_COLLISION | COMPONENT_STILE); int x = xPos / TILE_WIDTH; int y = yPos / TILE_HEIGHT; world->position[speed_tile].x = (x * TILE_WIDTH) + (TILE_WIDTH / 2); world->position[speed_tile].y = (y * TILE_HEIGHT) + (TILE_HEIGHT / 2); world->position[speed_tile].level = level; world->position[speed_tile].width = TILE_WIDTH; world->position[speed_tile].height = TILE_HEIGHT; world->renderPlayer[speed_tile].width = TILE_WIDTH; world->renderPlayer[speed_tile].height = TILE_HEIGHT; world->collision[speed_tile].id = 0; world->collision[speed_tile].timer = 0; world->collision[speed_tile].timerMax = 0; world->collision[speed_tile].active = true; world->collision[speed_tile].radius = 0; switch(type) { case TILE_BELT_RIGHT: world->tile[speed_tile].type = TILE_BELT_RIGHT; world->collision[speed_tile].type = COLLISION_BELTRIGHT; load_animation("assets/Graphics/objects/tiles/speed_right/speed_right_animation.txt", world, speed_tile); play_animation(world, speed_tile, (char*)"speed_right"); break; case TILE_BELT_LEFT: world->tile[speed_tile].type = TILE_BELT_RIGHT; world->collision[speed_tile].type = COLLISION_BELTLEFT; load_animation("assets/Graphics/objects/tiles/speed_left/speed_left_animation.txt", world, speed_tile); play_animation(world, speed_tile, (char*)"speed_left"); break; } world->tile[speed_tile].start_time = SDL_GetTicks(); return speed_tile; }
static void* bling_title(void* data, float elapsed_ms, float progress) { struct level_data* ldata = data; UNUSED(elapsed_ms); draw_sprite(ldata->title.sprite, 20, 10); if (progress < 0.1) play_animation(ldata->title.sprite, ldata->title.bling); animate_sprite(ldata->title.sprite, elapsed_ms); return NULL; }
static struct wizard* create_wizard(void) { struct wizard* wizard = calloc(1, sizeof(*wizard)); if (wizard == NULL) goto error; wizard->sprite = create_sprite(create_image("res/wizard.png"), 32, 32); if (wizard->sprite == NULL) goto error; wizard->walk_right = create_animation(); if (wizard->walk_right == NULL) goto error; add_frame(wizard->walk_right, 4, 200, &PREP_SPEED); add_frame(wizard->walk_right, 0, 200, &NORMAL_SPEED); /* <------+ */ add_frame(wizard->walk_right, 1, 200, &NORMAL_SPEED); /* | */ add_frame(wizard->walk_right, 2, 200, &NORMAL_SPEED); /* | */ add_frame(wizard->walk_right, 3, 200, &NORMAL_SPEED); /* <--+ | */ add_frame(wizard->walk_right, 4, 200, &BRAKE_SPEED); /* | | */ wizard->walk_right->loop_from = 1; /* --------------------------|---+ */ wizard->walk_right->loop_to = 4; /* --------------------------+ */ wizard->walk_left = create_animation(); if (wizard->walk_left == NULL) goto error; add_frame(wizard->walk_left, 15, 200, &PREP_SPEED_L); add_frame(wizard->walk_left, 11, 200, &NORMAL_SPEED_L); /* <------+ */ add_frame(wizard->walk_left, 10, 200, &NORMAL_SPEED_L); /* | */ add_frame(wizard->walk_left, 9, 200, &NORMAL_SPEED_L); /* | */ add_frame(wizard->walk_left, 8, 200, &NORMAL_SPEED_L); /* <--+ | */ add_frame(wizard->walk_left, 15, 200, &BRAKE_SPEED_L); /* | | */ wizard->walk_left->loop_from = 1; /* -----------------------------|---+ */ wizard->walk_left->loop_to = 4; /* -----------------------------+ */ wizard->stand = create_animation(); if (wizard->stand == NULL) goto error; add_frame(wizard->stand, 5, 100, &NO_SPEED); /* <---+ */ wizard->stand->mode = FREEZE_LAST_FRAME; /* ------------+ */ wizard->spell = create_animation(); if (wizard->spell == NULL) goto error; add_frame(wizard->spell, 5, 200, &NO_SPEED); add_frame(wizard->spell, 6, 200, &NO_SPEED); add_frame(wizard->spell, 7, 100, &NO_SPEED); /* <--+ */ add_frame(wizard->spell, 6, 200, &NO_SPEED); /* | */ wizard->spell->loop_from = 2; /* ----------------------+ */ wizard->spell->loop_to = 2; /* ----------------------+ */ play_animation(wizard->sprite, wizard->stand); wizard->pos.x = 0; wizard->pos.y = BASE_Y; return wizard; error: destroy_wizard(wizard); ERROR("Unable to create wizard"); return NULL; }
KeyFrameAnimationState::KeyFrameAnimationState(std::weak_ptr<KeyFrameAnimated> animatable, AnimationUpdatedCallback refresh_animation_state): animatable_(animatable), refresh_animation_state_(refresh_animation_state) { auto anim = animatable_.lock(); on_animation_added_ = anim->signal_animation_added().connect( [this](KeyFrameAnimated* animatable, const std::string& name) { if(animatable->animation_count() == 1) { play_animation(name); } } ); }
/** * リスタート時の処理 * */ void Girl::restart() { ActiveObject::restart(); set_angular_factor( 0 ); set_friction( 0 ); mode_ = MODE_STAND; play_animation( "Stand", true, true ); flicker_base_location_ = get_start_location(); }
void play_boom(char *msg) { static Animation *boom = NULL; if (boom == NULL) boom = create_animation("boom.txt"); char *subtitle = (char *) malloc((sizeof(char)) * (strlen(msg) + strlen(" (Press any key)")) + 1 ); KINDLY_DIE_IF_NULL(subtitle); strcpy(subtitle, msg); strcat(subtitle, " (Press any key)"); play_animation(boom, subtitle, true, true); free(subtitle); }
/* The wizard is controlled using the keyboard (for now). * **animate\_wizard()** sets the wizard animation * based on the player keypresses and the animation user-data * as it was set up in the **create\_wizard()** function. * * We use the user-data value as a speed constant. This * was setup as part of the animation. */ static void animate_wizard(struct wizard* wizard, float elapsed_ms) { const void* px; struct animation* active_anim; active_anim = key_down(KB_SPACE) ? wizard->spell : key_down(KB_RIGHT) ? wizard->walk_right : key_down(KB_LEFT) ? wizard->walk_left : wizard->stand; play_animation(wizard->sprite, active_anim); if ((px = animate_sprite(wizard->sprite, elapsed_ms)) != NULL) { wizard->speed = *((const float*)px); } wizard->pos.x += wizard->speed; }
bool upload(ad_http_t *http, char *name, char **body, size_t *size) { if (http->request.bodyin > MAX_UPLOAD_LENGTH) { return false; } char *path = animation_path(name); FILE *file = fopen(path, "wb"); if (file == NULL) { return false; } printf("Upload animation %s (sized %zu)...\n", path, http->request.bodyin); char data[http->request.bodyin]; evbuffer_copyout(http->request.inbuf, data, http->request.bodyin); fwrite(data, 1, http->request.bodyin, file); fclose(file); return play_animation(http, name, body, size); }
/* **level\_data** is created and populated with * level specific entities. Some entities require further * initialization, such as the timeline. * A timeline allows creating a sequence of events * on a, well.. time line. Each event has a start time, * duration and callback function the will get called * each time the timeline is updated and if the event * is active. * We use a timeline to animate the title, creating 3 * events: (1) slide the title into the screen (2) * make the title "bling" and (3) slide the title out * of the screen. * Using the SECOND and SECONDS constant is for * the sake of readability only. */ static struct level_data* create_level_data(void) { struct level_data* ldata = calloc(1, sizeof(*ldata)); if (ldata == NULL) goto error; ldata->wizard = create_wizard(); if (ldata->wizard == NULL) goto cleanup_level_data; if (prepare_title(&ldata->title) != 0) goto cleanup_level_data; if (prepare_tree(&ldata->tree) != 0) goto cleanup_level_data; ldata->grass_tile = create_image("res/grass_tile.png"); if (ldata->grass_tile == NULL) goto cleanup_level_data; ldata->earth_tile = create_image("res/earth_tile.png"); if (ldata->earth_tile == NULL) goto cleanup_level_data; play_animation(ldata->tree.sprite, ldata->tree.windblow); ldata->timeline = create_timeline(); if (ldata->timeline == NULL) goto cleanup_level_data; append_event(ldata->timeline, 0, 1 * SECOND, before_title_in); append_event(ldata->timeline, 0, 1 * SECOND, slide_title_in); append_event(ldata->timeline, 0, 4 * SECONDS, bling_title); append_event(ldata->timeline, 0, 1 * SECOND, slide_title_out); ldata->font = create_font("res/font.png", 32, 4); if (ldata->font == NULL) goto cleanup_level_data; ldata->music = create_sound("res/wizard.ogg"); play_sound(ldata->music, -1); return ldata; cleanup_level_data: destroy_level_data(ldata); error: ERROR("Unable to create level data"); return NULL; }
static void wallpaper_check_click(struct yutani_msg_window_mouse_event * evt) { if (evt->command == YUTANI_MOUSE_EVENT_CLICK) { if (evt->new_x > ICON_X && evt->new_x < ICON_X + ICON_WIDTH) { uint32_t i = 0; while (1) { if (!applications[i].icon) { break; } if ((evt->new_y > ICON_TOP_Y + ICON_SPACING_Y * i) && (evt->new_y < ICON_TOP_Y + ICON_SPACING_Y + ICON_SPACING_Y * i)) { launch_application(applications[i].appname); play_animation(i); } ++i; } /* Within the icon range */ } } else if (evt->command == YUTANI_MOUSE_EVENT_MOVE || evt->command == YUTANI_MOUSE_EVENT_ENTER) { if (evt->new_x > 0 && evt->new_x < ICON_X + ICON_WIDTH + EXTRA_WIDTH) { uint32_t i = 0; while (1) { if (!applications[i].icon) { set_focused(-1); break; } if ((evt->new_y > ICON_TOP_Y + ICON_SPACING_Y * i) && (evt->new_y < ICON_TOP_Y + ICON_SPACING_Y + ICON_SPACING_Y * i)) { set_focused(i); break; } ++i; } /* Within the icon range */ } else { set_focused(-1); } } else if (evt->command == YUTANI_MOUSE_EVENT_LEAVE) { set_focused(-1); } }
/** * Checks if a hacker is in the vicinity of an objective and if the action key is pressed. * If so, the capture objective data is sent to the server. * * @param[in,out] world A pointer to the world structure. * @param[in] entity The player entity number. * * @designer * @author */ bool capture_objective(World* world, unsigned int entity) { if (world->collision[entity].type == COLLISION_HACKER && world->command[entity].commands[C_ACTION]) { unsigned int* collision_list = NULL; unsigned int num_collisions; bool captured = false; if (spacebar_collision(world, entity, &collision_list, &num_collisions)) { unsigned int i; for (i = 0; i < num_collisions; i++) { if (world->collision[collision_list[i]].type == COLLISION_TARGET && world->objective[collision_list[i]].status == 1) { printf("You captured an objective[%u] %u! You is the best!\n", collision_list[i], world->objective[collision_list[i]].objectiveID); world->objective[collision_list[i]].status = 2; captured = true; play_animation(world, collision_list[i], "captured"); } } cleanup_spacebar_collision(&collision_list); } if (captured) { send_objectives(world, send_router_fd[WRITE]); } } return false; }
int map_init(World* world, const char *file_map, const char *file_tiles) { FILE *fp_map; FILE *fp_tiles; int width, height; int x, y, i; int **collision_map; int **map; char *entity_type = (char*)malloc(sizeof(char) * 128); int entity_count; SDL_Surface **tiles; int *collision; int num_tiles; int pos = 0; char *tile_filename = (char*)malloc(sizeof(char) * 128); SDL_Rect tile_rect; if (map_surface != 0) { SDL_FreeSurface(map_surface); } //load tiles if ((fp_tiles = fopen(file_tiles, "r")) == 0) { printf("Error opening tile set %s\n", file_tiles); return -1; } if (fscanf(fp_tiles, "%d", &num_tiles) != 1) { printf("Cannot find tile number\n"); return -1; } if ((tiles = (SDL_Surface**)malloc(sizeof(SDL_Surface*) * num_tiles)) == 0) { printf("Error mallocing tile surfaces\n"); return -1; } if ((collision = (int*)malloc(sizeof(int) * num_tiles)) == 0) { printf("Error mallocing tile surfaces\n"); return -1; } for(i = 0; i < num_tiles; i++) { if (fscanf(fp_tiles, "%d", &pos) != 1) { printf("Error reading tile map index.\n"); return -1; } if (pos >= num_tiles) { printf("Trying to write to tiles outside of memory\n"); return -1; } if (fscanf(fp_tiles, "%s", (char*)tile_filename) != 1) { printf("Error reading tile map filename.\n"); return -1; } if (fscanf(fp_tiles, "%d", &collision[pos]) != 1){ printf("Error reading tile map collision.\n"); return -1; } tiles[pos] = IMG_Load(tile_filename); if (tiles[pos] == NULL) { printf("Error loading tile: %s\n", tile_filename); return -1; } } fclose(fp_tiles); //LOAD MAP if ((fp_map = fopen(file_map, "r")) == 0) { printf("Error opening map %s\n", file_map); return -1; } if (fscanf(fp_map, "%d %d %d", &level, &width, &height) != 3) { return -1; } if ((map = (int**)malloc(sizeof(int*) * width)) == NULL) { printf("malloc failed\n"); } if ((collision_map = (int**)malloc(sizeof(int*) * width)) == NULL) { printf("malloc failed\n"); } for (i = 0; i < width; i++) { if ((map[i] = (int*)malloc(sizeof(int) * height)) == NULL) { printf("malloc failed\n"); } if ((collision_map[i] = (int*)malloc(sizeof(int) * height)) == NULL) { printf("malloc failed\n"); } } printf("Map load size %d %d\n", width, height); for(y = 0; y < height; y++) { for(x = 0; x < width; x++) { if (fscanf(fp_map, "%d", &map[x][y]) != 1) { printf("Expected more map.\n"); return -1; } if (map[x][y] >= num_tiles) { printf("Using tile %u that is bigger than %d\n", map[x][y], num_tiles); } collision_map[x][y] = collision[map[x][y]]; } } if (fscanf(fp_map, "%d", &entity_count) == 1) { for(i = 0; i < entity_count; i++) { if (fscanf(fp_map, "%s", (char*)entity_type) != 1) { printf("Entity type error: %s\n", file_map); return -1; } //printf("Found entity: %s\n", entity_type); if (strcmp(entity_type, "stair") == 0 || strcmp(entity_type, "stairs") == 0) { //stairs //stair x y targetX targetY 2 int x, y, floor; float targetX, targetY; char dir; if (fscanf(fp_map, "%d %d %f %f %d %c", &x, &y, &targetX, &targetY, &floor, &dir) != 6) { printf("Error loading stair\n"); return -1; } switch (dir) { // make the hitboxes for the stairs case 'l': create_stair(world, floor, targetX * TILE_WIDTH + TILE_WIDTH / 2, targetY * TILE_HEIGHT + TILE_HEIGHT / 2, x * TILE_WIDTH + TILE_WIDTH / 2 - 5, y * TILE_HEIGHT + TILE_HEIGHT / 2, 4, 4, level); create_block(world, x * TILE_WIDTH + 7, y * TILE_HEIGHT + TILE_HEIGHT / 2, 10, TILE_HEIGHT - 4, floor); break; case 'r': create_stair(world, floor, targetX * TILE_WIDTH + TILE_WIDTH / 2, targetY * TILE_HEIGHT + TILE_HEIGHT / 2, x * TILE_WIDTH + TILE_WIDTH / 2 + 5, y * TILE_HEIGHT + TILE_HEIGHT / 2, 4, 4, level); create_block(world, x * TILE_WIDTH + TILE_WIDTH - 7, y * TILE_HEIGHT + TILE_HEIGHT / 2, 10, TILE_HEIGHT - 4, floor); break; case 'u': create_stair(world, floor, targetX * TILE_WIDTH + TILE_WIDTH / 2, targetY * TILE_HEIGHT + TILE_HEIGHT / 2, x * TILE_WIDTH + TILE_WIDTH / 2, y * TILE_HEIGHT + TILE_HEIGHT / 2 - 5, 4, 4, level); create_block(world, x * TILE_WIDTH + TILE_WIDTH / 2, y * TILE_HEIGHT + 7, TILE_WIDTH - 4, 10, floor); break; case 'd': create_stair(world, floor, targetX * TILE_WIDTH + TILE_WIDTH / 2, targetY * TILE_HEIGHT + TILE_HEIGHT / 2, x * TILE_WIDTH + TILE_WIDTH / 2, y * TILE_HEIGHT + TILE_HEIGHT / 2 + 5, 4, 4, level); create_block(world, x * TILE_WIDTH + TILE_WIDTH / 2, y * TILE_HEIGHT + TILE_HEIGHT - 7, TILE_WIDTH - 4, 10, floor); break; } } else if (strcmp(entity_type, "object") == 0) { //animated objects unsigned int entity; float x, y; int w, h; char *animation_name = (char*)malloc(sizeof(char) * 64); char *animation_filename = (char*)malloc(sizeof(char) * 64); if (fscanf(fp_map, "%f %f %d %d %s %s", &x, &y, &w, &h, animation_filename, animation_name) != 6) { printf("Error loading object!\n"); return -1; } entity = create_entity(world, COMPONENT_RENDER_PLAYER | COMPONENT_POSITION | COMPONENT_ANIMATION | COMPONENT_COLLISION); //printf("Loading object %d (%f, %f) [%s] %s\n", entity, x, y, animation_name, animation_filename); world->position[entity].x = x * TILE_WIDTH + TILE_WIDTH / 2; world->position[entity].y = y * TILE_HEIGHT + TILE_HEIGHT / 2; world->position[entity].width = w; world->position[entity].height = h; world->renderPlayer[entity].width = w; world->renderPlayer[entity].height = h; world->collision[entity].id = 0; world->collision[entity].type = COLLISION_SOLID; world->collision[entity].timer = 0; world->collision[entity].timerMax = 0; world->collision[entity].active = true; world->collision[entity].radius = 0; load_animation(animation_filename, world, entity); play_animation(world, entity, animation_name); free(animation_name); free(animation_filename); } else if (strcmp(entity_type, "sound") == 0) { int sound_id; if (fscanf(fp_map, "%d", &sound_id) != 1) { printf("Error loading sound!\n"); return -1; } play_music(sound_id); //printf("Playing sound %d\n", sound_id); } else if (strcmp(entity_type, "objective") == 0) { float x, y; int w, h; unsigned int id, entity = -1; char *animation_filename = (char*)malloc(sizeof(char) * 64); if (fscanf(fp_map, "%f %f %d %d %u %s", &x, &y, &w, &h, &id, animation_filename) != 6) { printf("Error loading objective!\n"); return -1; } entity = create_objective(world, x * TILE_WIDTH + TILE_WIDTH / 2, y * TILE_HEIGHT + TILE_HEIGHT / 2, w, h, id, level); if (entity >= MAX_ENTITIES) { printf("exceeded max entities.\n"); return -1; } world->mask[entity] |= COMPONENT_ANIMATION | COMPONENT_RENDER_PLAYER; world->renderPlayer[entity].width = w; world->renderPlayer[entity].height = h; load_animation(animation_filename, world, entity); play_animation(world, entity, "not_captured"); //printf("Loaded objective: %u\n", entity); free(animation_filename); } else if (strcmp(entity_type, "powerup") == 0) { float x, y; int w, h, type; unsigned int entity = -1; char *animation_filename = (char*)malloc(sizeof(char) * 128); if (fscanf(fp_map, "%f %f %d %d %d %s", &x, &y, &w, &h, &type, animation_filename) != 6) { printf("Error loading powerup!\n"); return -1; } entity = create_powerup(world, x * TILE_WIDTH + TILE_WIDTH / 2, y * TILE_HEIGHT + TILE_HEIGHT / 2, w, h, type, level); if (entity >= MAX_ENTITIES) { printf("exceeded max entities.\n"); return -1; } world->mask[entity] |= COMPONENT_ANIMATION | COMPONENT_RENDER_PLAYER; world->renderPlayer[entity].width = w; world->renderPlayer[entity].height = h; load_animation(animation_filename, world, entity); play_animation(world, entity, "bounce"); free(animation_filename); } else if (strcmp(entity_type, "chair") == 0) { //animated objects unsigned int entity; float x, y; int w, h; char *animation_name = (char*)malloc(sizeof(char) * 64); char *animation_filename = (char*)malloc(sizeof(char) * 64); if (fscanf(fp_map, "%f %f %d %d %s %s", &x, &y, &w, &h, animation_filename, animation_name) != 6) { printf("Error loading chair!\n"); return -1; } entity = create_entity(world, COMPONENT_RENDER_PLAYER | COMPONENT_POSITION | COMPONENT_ANIMATION); //printf("Loading object %d (%f, %f) [%s] %s\n", entity, x, y, animation_name, animation_filename); world->position[entity].x = x * TILE_WIDTH; world->position[entity].y = y * TILE_HEIGHT; world->position[entity].width = w; world->position[entity].height = h; world->renderPlayer[entity].width = w; world->renderPlayer[entity].height = h; load_animation(animation_filename, world, entity); play_animation(world, entity, animation_name); free(animation_name); free(animation_filename); } else { printf("Did not deal with the entity type: %s\n", entity_type); break; } } } fclose(fp_map); //cleanup_map(); map_surface = SDL_CreateRGBSurface(0, width * TILE_WIDTH, height * TILE_HEIGHT, 32, 0, 0, 0, 0); if (map_surface == 0) { printf("error making map surface.\n"); return -1; } SDL_FillRect(map_surface, NULL, 0xFF0000); tile_rect.w = TILE_WIDTH; tile_rect.h = TILE_HEIGHT; for(y = 0; y < height; y++) { for(x = 0; x < width; x++) { tile_rect.x = x * TILE_WIDTH; tile_rect.y = y * TILE_HEIGHT; SDL_BlitSurface(tiles[map[x][y]], NULL, map_surface, &tile_rect); } } for(i = 0; i < num_tiles; i++) { SDL_FreeSurface(tiles[i]); } map_rect.x = 0; map_rect.y = 0; w = map_rect.w = width * TILE_WIDTH; h = map_rect.h = height * TILE_HEIGHT; create_level(world, collision_map, width, height, TILE_WIDTH, level); for (i = 0; i < width; i++) { free(map[i]); free(collision_map[i]); } free(map); free(collision_map); free(tiles); free(collision); free(entity_type); free(tile_filename); return 0; }
void KeyFrameAnimationState::play_first_animation() { play_animation(animatable_.lock()->first_animation_); }
void title_screen() { char *picture[] = { " # # ( )", " ___#_#___|__", " _ |____________| _", " _=====| | | | | |==== _", " =====| |.---------------------------. | |====", " <--------------------' . . . . . . . . '--------------/", " \\ /", " \\_______________________________________________WWS_________/", " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", NULL }; print_picture(stdscr, picture); /* int numsquiggles = 8; */ /* int numreps = 2; */ /* int framespeed = 60000; */ /* do a little "animation" */ /* for (int i=0; i<numreps; ++i) { */ /* /\* pushing out *\/ */ /* for (int j=0; j<numsquiggles; ++j) { */ /* char msg[100]; */ /* int s=0; */ /* for (int k=0; k<j+1; ++k) { */ /* msg[s++] = '~'; */ /* } */ /* msg[s++]=' '; */ /* msg[s++]='t'; */ /* msg[s++]='e'; */ /* msg[s++]='r'; */ /* msg[s++]='m'; */ /* msg[s++]='s'; */ /* msg[s++]='h'; */ /* msg[s++]='i'; */ /* msg[s++]='p'; */ /* msg[s++]=' '; */ /* for (int k=0; k<j+1; ++k) { */ /* msg[s++] = '~'; */ /* } */ /* msg[s++] = '\0'; */ /* show_message_box(msg); */ /* usleep(framespeed); */ /* } */ /* /\* pulling in *\/ */ /* for (int j=numsquiggles; j>0; --j) { */ /* char msg[100]; */ /* int s=0; */ /* for (int k=0; k<j+1; ++k) { */ /* msg[s++] = '~'; */ /* } */ /* msg[s++]=' '; */ /* msg[s++]='t'; */ /* msg[s++]='e'; */ /* msg[s++]='r'; */ /* msg[s++]='m'; */ /* msg[s++]='s'; */ /* msg[s++]='h'; */ /* msg[s++]='i'; */ /* msg[s++]='p'; */ /* msg[s++]=' '; */ /* for (int k=0; k<j+1; ++k) { */ /* msg[s++] = '~'; */ /* } */ /* msg[s++] = '\0'; */ /* show_message_box(msg); */ /* usleep(framespeed); */ /* } */ /* } */ /* Test an animation: */ /* Animation *anim1 = create_animation("test1.txt"); */ /* play_animation(anim1, true); */ /* Animation *underwater_explosion = create_animation("underwater_explosion.txt"); */ /* play_animation(underwater_explosion, true); */ /* destroy_animation(underwater_explosion); */ Animation *montage = create_animation("opener.txt"); play_animation(montage, "Welcome to termship! (Press any key)", true, true); destroy_animation(montage); }
void play_animation(const char* name, struct Vec3 position) { AnimationType animation_type = get_animation_type(name); play_animation(animation_type, position); }