Blame |
Last modification |
View Log
| RSS feed
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
/**
------------
CVS : $Id: eli.h,v 1.1.1.1 2002-09-02 09:37:45 pj Exp $
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:45 $
------------
This file is similar to the configuration of Hartik 3.3.1
**/
/*
* Copyright (C) 2000 ALLEN-DESTRO and Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/***************************************/
/* Corso di Informatica Industriale */
/* Libreria con le funzioni di disegno */
/* Creata da ALLEN-DESTRO */
/***************************************/
//########################################
// Librerie standard del linguaggio C
//#######################################
#include <math.h>
#include <stdlib.h>
#include <string.h>
//########################################
// Librerie Hartik
//########################################
#include <kernel/kern.h>
#include <drivers/glib.h>
#include <drivers/keyb.h>
#include <ll/i386/cons.h>
#include <semaphore.h>
//########################################
// Definizione delle costanti del programma
//########################################
#define PER_DISEGNA 100000
#define PER_MOLLA 100000
#define PER_KILL 200000
#define G 10
#define DIM_EL 12
#define DIM_PESO 10
#define COL_EL YELLOW
#define X0min 4 // Ascissa minima della finestra grafica
#define Y0min 4 // Ordinata minima della finestra grafica
#define X0max 796 // Ascissa massima della finestra grafica
#define Y0max 596 // Ordinata massima della finestra grafica
#define TERRA 400 // Ordinata della pista di atteraggio
#define COL_SFONDO 0 // Colore di sfondo della finestra grafica
#define COL_TESTO 7 // Colore del testo della finestra grafica
#define COL_CORNICE RED // Colore cornici della finestra grafica
#define DELTA_COL 32
// Valore di pigreco
#define PIGRECO 3.14159
#define ELICOTTERO_S(x,y,dim,col,sfo) grx_disc(x,y,dim,col); \
grx_box(x-dim,y,x+dim,y+dim,sfo); \
grx_line(x-dim*2,y-dim,x+dim*2,y-dim,col); \
grx_box(x-dim,y,x+(dim*2),y+(dim/3),col); \
grx_line(x-dim,y+dim/2,x+2*dim,y+dim/2,col); \
grx_circle(x+dim*2,y,dim/2,col); \
grx_box(x-dim/10,y,x+dim/10,y+dim/2,col)
#define ELICOTTERO_D(x,y,dim,col,sfo) grx_disc(x,y,dim,col); \
grx_box(x-dim,y,x+dim,y+dim,sfo); \
grx_line(x-dim*2,y-dim,x+dim*2,y-dim,col); \
grx_box(x-(dim*2),y,x+dim,y+(dim/3),col); \
grx_line(x-2*dim,y+dim/2,x+dim,y+dim/2,col); \
grx_circle(x-dim*2,y,dim/2,col); \
grx_box(x-dim/10,y,x+dim/10,y+dim/2,col)
#define PESO(x,y,dim,col) grx_box(x-dim,y,x+dim,y+2*dim,col)
#define MOLLA(x,y1,y2,col) { \
int w; \
for (w=y1;w<y2;w=w+2) grx_line(x-3,w,x+3,w,col); \
}
#define RUSPA_S(x,y,col,colvet) grx_box(x,y-20,x+2,y,col); \
grx_line(x,y-10,x+5,y-10,col); \
grx_box(x+5,y-30,x+20,y-5,col); \
grx_box(x+5,y-10,x+40,y-5,col); \
grx_disc(x+10,y-5,5,col); \
grx_disc(x+30,y-5,5,col); \
grx_box(x+5,y-25,x+12,y-15,colvet)
#define RUSPA_D(x,y,col,colvet) grx_box(x-2,y-20,x,y,col); \
grx_line(x-5,y-10,x,y-10,col); \
grx_box(x-20,y-30,x-5,y-5,col); \
grx_box(x-40,y-10,x-5,y-5,col); \
grx_disc(x-10,y-5,5,col); \
grx_disc(x-30,y-5,5,col); \
grx_box(x-12,y-25,x-5,y-15,colvet)
#define ESPLOSIONE(x,y) grx_box(x-2,y-2,x+1,y+1,RED+1); \
grx_box(x-5,y-5,x-4,y-3,RED+1); \
grx_box(x-6,y-2,x-4,y,RED+1); \
grx_box(x+3,y+4,x+4,y+7,RED+1); \
grx_box(x+5,y-6,x+8,y-4,RED+1); \
grx_box(x-10,y+10,x-8,y+8,RED+1); \
grx_box(x-1,y-10,x+1,y-8,RED+1); \
grx_box(x-13,y-1,x-10,y+1,RED+1); \
grx_box(x+8,y-7,x+10,y-5,RED+1); \
grx_box(x,y+6,x-1,y+8,RED+1); \
grx_box(x-DIM_PESO-1,y-1,x-DIM_PESO+1,y+1,RED+1); \
grx_box(x-DIM_PESO-1,y+2*DIM_PESO-1,x-DIM_PESO+1,y+2*DIM_PESO+1,RED+1); \
grx_box(x+DIM_PESO-1,y-1,x+DIM_PESO+1,y+1,RED+1); \
grx_box(x+DIM_PESO-1,y+2*DIM_PESO-1,x+DIM_PESO+1,y+2*DIM_PESO+1,RED+1); \
grx_box(x-1,y+DIM_PESO-1,x+1,y+DIM_PESO+1,RED+1); \
grx_box(x+4,y+DIM_PESO-1,x+6,y+DIM_PESO+1,RED+1); \
//#define PULISCI(x,y) grx_box(x-14,y-11,x+DIM_PESO+2,y+2*DIM_PESO+2,COL_SFONDO)
#define PULISCI(x,y,d) grx_disc(x,y,d,COL_SFONDO)
/*********************************************************************/
/* */
/* Funzione per disegnare gli elementi statici */
/* */
/*********************************************************************/
extern char tastiera;
extern long double Forza_x,Forza_y,Velocita_x,Velocita_y,Acc_x,Acc_y,Massa;
// Definizione del semaforo per l'utilizzo della modalità grafica
extern sem_t mutex;
TASK disegna_stato(int i);