Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1664 pj 1
 
2
 
3
#ifndef __BCA_LIB_c__
4
#define __BCA_LIB_c__
5
//-------------------BEGIN---------------------------
6
 
7
// *** Librerie S.Ha.R.K ***
8
#include<kernel/kern.h>
9
#include<drivers/glib.h>
10
#include<drivers/gd.h>
11
// *** Librerie Standard C ***
12
// *** Librerie FAB ***
13
#include"fab_lib/fab_msg.h"
14
// *** Librerie BCA ***
15
#include"Illa.h"
16
 
17
 
18
 
19
void kern_alloc_images(); // richiede DISABLED_INTERUPTS
20
void kern_free_images();  // richiede DISABLED_INTERUPTS
21
void kern_load_images();  // solo in __kernel_register_levels__()
22
 
23
 
24
// *** Corpo delle funzioni in CA.h *** //
25
void kern_init_bca()
26
{
27
  FAB_clr();
28
  kern_alloc_images();
29
  kern_load_images();
30
}
31
 
32
 
33
void kern_alloc_images()
34
{
35
  int test=0;
36
 
37
  FAB_print("FAB_IMAGEs","allocazione...");
38
 
39
 
40
  image_bg = FAB_image_alloc(PLAY_AREA_WIDTH,PLAY_AREA_HEIGHT);
41
  if (image_bg==NULL) test=1;
42
 
43
  image_leaf = FAB_image_alloc(leaf_image_width,leaf_image_height);
44
  if (image_leaf==NULL) test=1;
45
 
46
  image_player = FAB_image_alloc(player_image_width,player_image_height);
47
  if (image_player==NULL) test=1;
48
 
49
  image_enemy = FAB_image_alloc(enemy_image_width,enemy_image_height);
50
  if (image_enemy==NULL) test=1;
51
 
52
  FAB_msg(test,NULL,"fatto","almeno un'immagine non allocata");
53
}
54
void kern_free_images()
55
{
56
  FAB_image_free(image_bg);
57
  FAB_image_free(image_leaf);
58
  FAB_image_free(image_player);
59
  FAB_image_free(image_enemy);
60
}
61
 
62
void kern_load_images()
63
{ int test=0;
64
 
65
  FAB_print(NULL,"caricamento dai file...");
66
 
67
 
68
  if(FAB_image_load(image_bg,"bg.raw")==-1) test=1;
69
  FAB_image_no_trasparent_set(image_bg);
70
 
71
  if(FAB_image_load(image_leaf,"leaf.raw")==-1) test=1;
72
  FAB_image_trasparent_set(image_leaf,FAB_white);
73
 
74
 if(FAB_image_load(image_player,"play.raw")==-1) test=1;
75
  FAB_image_trasparent_set(image_player,FAB_white);
76
 
77
  if(FAB_image_load(image_enemy,"snake.raw")==-1) test=1;
78
  FAB_image_trasparent_set(image_enemy,FAB_white);
79
 
80
  FAB_msg(test,NULL,"fatto","almeno un file non esiste oppure ha un formato incompatibile");
81
}
82
 
83
 
84
//----------------------END--------------------------
85
#endif