Subversion Repositories shark

Rev

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

Rev Author Line No. Line
1655 giacomo 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
 *   (see the web pages for full authors list)
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/**
20
 ------------
21
 CVS :        $Id: eli.h,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
22
 
23
 File:        $File$
24
 Revision:    $Revision: 1.1.1.1 $
25
 Last update: $Date: 2004-05-24 18:03:47 $
26
 ------------
27
 
28
 This file is similar to the configuration of Hartik 3.3.1
29
 
30
**/
31
 
32
/*
33
 * Copyright (C) 2000 ALLEN-DESTRO and Paolo Gai
34
 *
35
 * This program is free software; you can redistribute it and/or modify
36
 * it under the terms of the GNU General Public License as published by
37
 * the Free Software Foundation; either version 2 of the License, or
38
 * (at your option) any later version.
39
 *
40
 * This program is distributed in the hope that it will be useful,
41
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43
 * GNU General Public License for more details.
44
 *
45
 * You should have received a copy of the GNU General Public License
46
 * along with this program; if not, write to the Free Software
47
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
48
 *
49
 */
50
 
51
 
52
/***************************************/
53
/*  Corso di Informatica Industriale    */
54
/*  Libreria con le funzioni di disegno */
55
/*      Creata da ALLEN-DESTRO         */
56
/***************************************/
57
 
58
//########################################
59
//    Librerie standard del linguaggio C 
60
//#######################################
61
#include        <math.h>
62
#include        <stdlib.h>
63
#include        <string.h>
64
 
65
//########################################
66
//           Librerie Hartik          
67
//########################################
68
#include        <kernel/kern.h>
69
#include        <drivers/glib.h>
70
#include        <drivers/keyb.h>
71
#include        <ll/i386/cons.h>
72
#include        <semaphore.h>
73
 
74
//########################################
75
// Definizione delle costanti del programma 
76
//########################################
77
 
78
#define PER_DISEGNA 100000
79
#define PER_MOLLA   100000
80
#define PER_KILL    200000
81
#define G           10
82
#define DIM_EL      12
83
#define DIM_PESO    10
84
#define COL_EL      YELLOW
85
 
86
 
87
#define         X0min           4    // Ascissa minima della finestra grafica                    
88
#define         Y0min           4    // Ordinata minima della finestra grafica                   
89
#define         X0max           796  // Ascissa massima della finestra grafica                   
90
#define         Y0max           596  // Ordinata massima della finestra grafica                  
91
#define         TERRA           400  // Ordinata della pista di atteraggio                       
92
#define         COL_SFONDO      0    // Colore di sfondo della finestra grafica
93
#define         COL_TESTO       7    // Colore del testo della finestra grafica
94
#define         COL_CORNICE     RED    // Colore cornici della finestra grafica
95
#define         DELTA_COL       32
96
 
97
 
98
// Valore di pigreco
99
#define         PIGRECO         3.14159
100
 
101
#define         ELICOTTERO_S(x,y,dim,col,sfo)   grx_disc(x,y,dim,col); \
102
            grx_box(x-dim,y,x+dim,y+dim,sfo); \
103
            grx_line(x-dim*2,y-dim,x+dim*2,y-dim,col); \
104
            grx_box(x-dim,y,x+(dim*2),y+(dim/3),col);  \
105
            grx_line(x-dim,y+dim/2,x+2*dim,y+dim/2,col); \
106
            grx_circle(x+dim*2,y,dim/2,col); \
107
            grx_box(x-dim/10,y,x+dim/10,y+dim/2,col)
108
 
109
#define         ELICOTTERO_D(x,y,dim,col,sfo)   grx_disc(x,y,dim,col); \
110
            grx_box(x-dim,y,x+dim,y+dim,sfo); \
111
            grx_line(x-dim*2,y-dim,x+dim*2,y-dim,col); \
112
            grx_box(x-(dim*2),y,x+dim,y+(dim/3),col);  \
113
            grx_line(x-2*dim,y+dim/2,x+dim,y+dim/2,col); \
114
            grx_circle(x-dim*2,y,dim/2,col); \
115
            grx_box(x-dim/10,y,x+dim/10,y+dim/2,col)
116
 
117
#define        PESO(x,y,dim,col)    grx_box(x-dim,y,x+dim,y+2*dim,col)
118
 
119
#define        MOLLA(x,y1,y2,col)       {  \
120
            int w;                     \
121
            for (w=y1;w<y2;w=w+2) grx_line(x-3,w,x+3,w,col); \
122
                     }                 
123
 
124
#define        RUSPA_S(x,y,col,colvet)   grx_box(x,y-20,x+2,y,col);  \
125
                                grx_line(x,y-10,x+5,y-10,col); \
126
                                grx_box(x+5,y-30,x+20,y-5,col);  \
127
                                grx_box(x+5,y-10,x+40,y-5,col);  \
128
                                grx_disc(x+10,y-5,5,col); \
129
                                grx_disc(x+30,y-5,5,col); \
130
                                grx_box(x+5,y-25,x+12,y-15,colvet)
131
 
132
#define        RUSPA_D(x,y,col,colvet)   grx_box(x-2,y-20,x,y,col);  \
133
                                grx_line(x-5,y-10,x,y-10,col); \
134
                                grx_box(x-20,y-30,x-5,y-5,col);  \
135
                                grx_box(x-40,y-10,x-5,y-5,col);  \
136
                                grx_disc(x-10,y-5,5,col); \
137
                                grx_disc(x-30,y-5,5,col); \
138
                                grx_box(x-12,y-25,x-5,y-15,colvet)
139
 
140
#define       ESPLOSIONE(x,y) grx_box(x-2,y-2,x+1,y+1,RED+1); \
141
                              grx_box(x-5,y-5,x-4,y-3,RED+1); \
142
                              grx_box(x-6,y-2,x-4,y,RED+1);   \
143
                              grx_box(x+3,y+4,x+4,y+7,RED+1); \
144
                              grx_box(x+5,y-6,x+8,y-4,RED+1); \
145
                              grx_box(x-10,y+10,x-8,y+8,RED+1);   \
146
                              grx_box(x-1,y-10,x+1,y-8,RED+1);   \
147
                              grx_box(x-13,y-1,x-10,y+1,RED+1);   \
148
                              grx_box(x+8,y-7,x+10,y-5,RED+1);   \
149
                              grx_box(x,y+6,x-1,y+8,RED+1); \
150
                              grx_box(x-DIM_PESO-1,y-1,x-DIM_PESO+1,y+1,RED+1); \
151
                              grx_box(x-DIM_PESO-1,y+2*DIM_PESO-1,x-DIM_PESO+1,y+2*DIM_PESO+1,RED+1); \
152
                              grx_box(x+DIM_PESO-1,y-1,x+DIM_PESO+1,y+1,RED+1); \
153
                              grx_box(x+DIM_PESO-1,y+2*DIM_PESO-1,x+DIM_PESO+1,y+2*DIM_PESO+1,RED+1); \
154
                              grx_box(x-1,y+DIM_PESO-1,x+1,y+DIM_PESO+1,RED+1); \
155
                              grx_box(x+4,y+DIM_PESO-1,x+6,y+DIM_PESO+1,RED+1); \
156
 
157
//#define         PULISCI(x,y)  grx_box(x-14,y-11,x+DIM_PESO+2,y+2*DIM_PESO+2,COL_SFONDO)
158
#define         PULISCI(x,y,d)  grx_disc(x,y,d,COL_SFONDO)
159
 
160
/*********************************************************************/
161
/*                                                                   */
162
/*    Funzione per disegnare gli elementi statici                    */
163
/*                                                                   */
164
/*********************************************************************/
165
extern char tastiera;
166
extern long double Forza_x,Forza_y,Velocita_x,Velocita_y,Acc_x,Acc_y,Massa;
167
// Definizione del semaforo per l'utilizzo della modalità grafica
168
extern sem_t             mutex;
169
 
170
TASK disegna_stato(int i);
171
 
172
 
173