Subversion Repositories shark

Rev

Rev 1090 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1090 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
1589 tullio 21
/* CVS :        $Id: scenario.c,v 1.2 2006-07-03 14:48:27 tullio Exp $ */
1090 pj 22
 
23
/*
24
 * Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.it>
25
 *
26
 * This program is free software; you can redistribute it and/or modify
27
 * it under the terms of the GNU General Public License as published by
28
 * the Free Software Foundation; either version 2 of the License, or
29
 * (at your option) any later version.
30
 *
31
 * This program is distributed in the hope that it will be useful,
32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 * GNU General Public License for more details.
35
 *
36
 * You should have received a copy of the GNU General Public License
37
 * along with this program; if not, write to the Free Software
38
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
39
 *
40
 */
41
 
42
//***************************
43
//* file:        scenario.c *
44
//* included by: bca.c      *
45
//***************************
46
 
47
void scenario_ca()
48
{   //SFONDO
49
    FAB_image_fill(image_sfondo,0,0,800,600);
50
 
51
    //FRAME_BCA
52
    FAB_frame_put(frame_bca,X0-7,Y0-7,500+7*2,500+7*2);
53
}
54
void scenario_misure()
55
{   int   x, y, cx, cy;
56
    char* str_km ="X.Xkm";
57
    char* str_m  ="XXXXm";
58
    int   h;
59
 
60
     //FRAME_MISURE orizzontale
61
    FAB_frame_put(frame_misure_oriz, X0-7, Y1+7+20-7,
62
                  500+7*2, FRAME_MISURE_ORIZ_LY+7*2);
63
    cy = frame_misure_oriz->y0 + 10;
64
    cx = frame_misure_oriz->x0 +
65
         (frame_misure_oriz->x1 - frame_misure_oriz->x0) / 2;
66
    for(x=frame_misure_oriz->x0 ;x<frame_misure_oriz->x1+1 ;x+=5)
67
        grx_line(x,cy,x+2,cy,FRAME_MISURE_LINE_COLOR);
68
    for(y=frame_misure_oriz->y0; y<cy-1; y+=5) {
69
      grx_line(frame_misure_oriz->x0,y,frame_misure_oriz->x0,y+2,FRAME_MISURE_LINE_COLOR);
70
      grx_line(cx,y,cx,y+2,FRAME_MISURE_LINE_COLOR);
71
      grx_line(frame_misure_oriz->x1,y,frame_misure_oriz->x1,y+2,FRAME_MISURE_LINE_COLOR);
72
      }
73
    sprintf(str_km,"%02.1fkm",0.0);
74
    grx_text(str_km,frame_misure_oriz->x0+10,cy+2,FRAME_MISURE_LINE_COLOR,frame_misure_oriz->color);
75
    sprintf(str_km,"%02.1fkm",BASE_L/2.0);
76
    grx_text(str_km,cx-10,cy+2,FRAME_MISURE_LINE_COLOR,frame_misure_oriz->color);
77
    sprintf(str_km,"%02.1fkm",BASE_L);
78
    grx_text(str_km,frame_misure_oriz->x1-FRAME_MISURE_ORIZ_LY,cy+2,FRAME_MISURE_LINE_COLOR,frame_misure_oriz->color);
79
 
80
   //FRAME_MISURE verticale
81
   FAB_frame_put(frame_misure_vert, X1+7+20-7, Y0-7,
82
                 FRAME_MISURE_VERT_LX+7*2, 500+7*2);
83
   cy = frame_misure_vert->y0 +
84
        (frame_misure_vert->y1 - frame_misure_vert->y0) / 2;
85
   cx = frame_misure_vert->x0 + 10;
86
   for(y=frame_misure_vert->y1; y>frame_misure_vert->y0-1; y-=5)
87
     grx_line(cx,y,cx,y-2,FRAME_MISURE_LINE_COLOR);
88
   h=0;
89
   for(y=frame_misure_vert->y1; y>frame_misure_vert->y0-1;
90
       y-=500.0*(X1-X0)/BASE_H, h+=500) {
91
     for(x=frame_misure_vert->x0; x<cx-1; x+=5)
92
        grx_line(x,y,x+2,y,FRAME_MISURE_LINE_COLOR);
93
     sprintf(str_m,"%dm",h);
94
     grx_text(str_m, cx+2, y-6,
95
              FRAME_MISURE_LINE_COLOR, frame_misure_vert->color);
96
     }
97
}
98
void scenario_radar()
99
{  FAB_ballframe_put(ballframe_radar,
100
                     frame_bca->x1+7+30, frame_bca->y1+7+30, 30);
101
   FAB_ballframe_put(ballframe_lucerossa[2],605,546,20);
102
   FAB_ballframe_put(ballframe_lucerossa[1],594,578,15);
103
   FAB_ballframe_put(ballframe_lucerossa[0],574,591,10);
104
}
105
void scenario_titolo()
106
{  int x0,y0;
107
   x0 = frame_misure_vert->x1+7+20-7;
108
   y0 = frame_bca->y0-7;
109
   FAB_frame_put(frame_titolo,x0,y0,800-x0-20+7,170);
110
   x0 = frame_titolo->x0;
111
   y0 = frame_titolo->y0;
112
   grx_text(titolo[0],x0+2,y0+10,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
113
   grx_text(titolo[1],x0+2,y0+20,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
114
   grx_text(titolo[2],x0+2,y0+30,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
115
   grx_text(titolo[3],x0+2,y0+46,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
116
   grx_text(titolo[4],x0+2,y0+66,FRAME_TITOLO_TEXT_COLOR1,FRAME_TITOLO_BACK_COLOR2);
117
   grx_text(titolo[5],x0+2,y0+81,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
118
   grx_text(titolo[6],x0+2,y0+96,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
119
   grx_text(titolo[7],x0+2,y0+116,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
120
   grx_text(titolo[8],x0+2,y0+133,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
121
   grx_text(titolo[9],x0+2,y0+141,FRAME_TITOLO_TEXT_COLOR2,FRAME_TITOLO_BACK_COLOR1);
122
}
123
void scenario_comandi()
124
{  int x0, y0;
125
   x0 = frame_misure_vert->x1+7+20-7;
126
   y0 = frame_titolo->y1+7+20-7;
127
   FAB_frame_put(frame_comandi,x0,y0,800-x0-20+7,100+7*2);
128
   x0 = frame_comandi->x0;
129
   y0 = frame_comandi->y0;
1589 tullio 130
   grx_text("      COMMANDS     \0",x0+2,y0+10,FRAME_COMANDI_TEXT_COLOR1,FRAME_COMANDI_BACK_COLOR1);
1090 pj 131
   grx_text("-------------------\0",x0+2,y0+20,FRAME_COMANDI_TEXT_COLOR2,FRAME_COMANDI_BACK_COLOR1);
1589 tullio 132
   grx_text("         exit      \0",x0+2,y0+40,FRAME_COMANDI_TEXT_COLOR2,FRAME_COMANDI_BACK_COLOR1);
133
   grx_text("[Ctrl+C]",x0+2,y0+40,FRAME_COMANDI_TEXT_COLOR3,FRAME_COMANDI_BACK_COLOR2);
134
   grx_text("        +/- plane  \0",x0+2,y0+60,FRAME_COMANDI_TEXT_COLOR2,FRAME_COMANDI_BACK_COLOR1);
1090 pj 135
   grx_text("[1/2]",x0+2,y0+60,FRAME_COMANDI_TEXT_COLOR3,FRAME_COMANDI_BACK_COLOR2);
1589 tullio 136
   grx_text("        +/- cannon \0",x0+2,y0+80,FRAME_COMANDI_TEXT_COLOR2,FRAME_COMANDI_BACK_COLOR1);
1090 pj 137
   grx_text("[3/4]",x0+2,y0+80,FRAME_COMANDI_TEXT_COLOR3,FRAME_COMANDI_BACK_COLOR2);
138
}
139
void scenario_control()
140
{  int x0,y0;
141
 
142
   x0 = frame_misure_vert->x1+7+20-7;
143
   y0 = frame_comandi->y1+7+20-7;
144
   FAB_frame_put(frame_control,x0,y0,800-x0-20+7,frame_misure_vert->y1+7-y0);
145
   x0 = frame_control->x0;
146
   y0 = frame_control->y0;
147
   grx_text("      CONTROL      \0",x0+2, y0+5,FRAME_CONTROL_TEXT_COLOR2,FRAME_CONTROL_BACK_COLOR);
148
   grx_line(x0-3, y0+15,
149
            frame_control->x1+3, y0+15,
150
            FRAME_CONTROL_TEXT_COLOR1);
151
 
152
   grx_line(x0-3, frame_control->y1-81,
153
            frame_control->x1+3, frame_control->y1-81,
154
            FRAME_CONTROL_TEXT_COLOR1);
155
}
156
void scenario()
157
{   scenario_ca();
158
    scenario_misure();
159
    scenario_radar();
160
    scenario_titolo();
161
    scenario_comandi();
162
    scenario_control();
163
}
164
 
165
void info()
166
{ int i;
167
  for(i=0; i<10; i++) kern_printf("%s\n",titolo[i]);
168
}