コード例 #1
0
ファイル: wizard.c プロジェクト: dmalves/cage
/* Destroying a wizard means destroying each and every
 * created resource in the **create\_wizard** function.
 * If we fail to do so, we will introduce a memory leak
 * to the game.
 */
static void destroy_wizard(struct wizard* wizard)
{
    if (wizard != NULL) {
        destroy_animation(wizard->walk_right);
        destroy_animation(wizard->spell);
        destroy_animation(wizard->stand);
        destroy_image(wizard->sprite->image);
        destroy_sprite(wizard->sprite);
        free(wizard);
    }
}
コード例 #2
0
ファイル: wizard.c プロジェクト: dmalves/cage
static void cleanup_title(struct game_title* title)
{
    destroy_sprite(title->sprite);
    destroy_animation(title->bling);
    destroy_image(title->spot);
    destroy_image(title->mask);
}
コード例 #3
0
ファイル: wizard.c プロジェクト: dmalves/cage
static int prepare_tree(struct tree* tree)
{
    tree->sprite = create_sprite(create_image("res/tree.png"), 32, 32);
    if (tree->sprite == NULL) goto cleanup_sprite;
    tree->windblow = create_animation();
    if (tree->windblow == NULL) goto cleanup_animation;
    add_frame(tree->windblow, 0, 1 * SECOND, NULL);
    add_frame(tree->windblow, 1, 1 * SECOND, NULL);
    tree->windblow->loop_from = 0;
    tree->windblow->loop_to = 1;
    return 0;

cleanup_animation:
    destroy_animation(tree->windblow);
cleanup_sprite:
    destroy_sprite(tree->sprite);
error:
    ERROR("Unable to prepare tree");
    return -1;
}
コード例 #4
0
ファイル: wizard.c プロジェクト: dmalves/cage
static void cleanup_tree(struct tree* tree)
{
    destroy_sprite(tree->sprite);
    destroy_animation(tree->windblow);
}
コード例 #5
0
ファイル: screen.c プロジェクト: dhanunjaya/termship
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);

}