Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed



#ifndef __BCA_LIB_c__
#define __BCA_LIB_c__
//-------------------BEGIN---------------------------

// *** Librerie S.Ha.R.K ***
#include<kernel/kern.h>
#include<drivers/glib.h>
#include<drivers/gd.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"fab_lib/fab_msg.h"
// *** Librerie BCA ***
#include"Illa.h"



void kern_alloc_images(); // richiede DISABLED_INTERUPTS
void kern_free_images();  // richiede DISABLED_INTERUPTS
void kern_load_images();  // solo in __kernel_register_levels__()


// *** Corpo delle funzioni in CA.h *** //
void kern_init_bca()
{
  FAB_clr();
  kern_alloc_images();
  kern_load_images();
}


void kern_alloc_images()
{
  int test=0;

  FAB_print("FAB_IMAGEs","allocazione...");


  image_bg = FAB_image_alloc(PLAY_AREA_WIDTH,PLAY_AREA_HEIGHT);
  if (image_bg==NULL) test=1;

  image_leaf = FAB_image_alloc(leaf_image_width,leaf_image_height);
  if (image_leaf==NULL) test=1;

  image_player = FAB_image_alloc(player_image_width,player_image_height);
  if (image_player==NULL) test=1;

  image_enemy = FAB_image_alloc(enemy_image_width,enemy_image_height);
  if (image_enemy==NULL) test=1;

  FAB_msg(test,NULL,"fatto","almeno un'immagine non allocata");
}
void kern_free_images()
{
  FAB_image_free(image_bg);
  FAB_image_free(image_leaf);
  FAB_image_free(image_player);
  FAB_image_free(image_enemy);
}

void kern_load_images()
{ int test=0;

  FAB_print(NULL,"caricamento dai file...");


  if(FAB_image_load(image_bg,"bg.raw")==-1) test=1;
  FAB_image_no_trasparent_set(image_bg);

  if(FAB_image_load(image_leaf,"leaf.raw")==-1) test=1;
  FAB_image_trasparent_set(image_leaf,FAB_white);

 if(FAB_image_load(image_player,"play.raw")==-1) test=1;
  FAB_image_trasparent_set(image_player,FAB_white);

  if(FAB_image_load(image_enemy,"snake.raw")==-1) test=1;
  FAB_image_trasparent_set(image_enemy,FAB_white);

  FAB_msg(test,NULL,"fatto","almeno un file non esiste oppure ha un formato incompatibile");
}


//----------------------END--------------------------
#endif