Subversion Repositories shark

Rev

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

Rev Author Line No. Line
1085 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
 
21
 
22
/**
23
 ------------
24
 CVS :        $Id: info.c,v 1.1.1.1 2002-09-02 09:37:42 pj Exp $
25
 
26
 File:        $File$
27
 Revision:    $Revision: 1.1.1.1 $
28
 Last update: $Date: 2002-09-02 09:37:42 $
29
 ------------
30
**/
31
 
32
/*
33
 * Copyright (C) 2000 Marco Dallera and Marco Fiocca
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
 *              AUTO
53
 *
54
 * Another Unuseful Track simulatOr
55
 *
56
 * Authors: Marco Dallera
57
 *          Marco Fiocca
58
 *
59
 */
60
 
61
/* ------------------- */
62
/*  Information panel  */
63
/* ------------------- */
64
 
65
#include "include/auto.h"
66
#include "include/const.h"
67
#include "include/utils.h"
68
 
69
extern sem_t grx_mutex;
70
 
71
/* ------------------------------------------------------------------ */
72
 
73
void bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name)
74
{
75
  int background = BLACK;
76
  int amp = 0;
77
  point p2;
78
 
79
  p2.x = p1.x + width;
80
  p2.y = p1.y + height;
81
 
82
  sem_wait(&grx_mutex);
83
 
84
  grx_text(name, p1.x, p1.y + height + 3, color, background);
85
  grx_rect(p1.x - 1, p1.y - 1, p2.x + 1, p2.y + 1, border);
86
 
87
  grx_box(p1.x, p1.y, p2.x, p2.y, BLACK);
88
  amp = abs(round( var * (float)(p2.x - p1.x) / max ));
89
  grx_box(p1.x, p1.y, p1.x + amp, p2.y, color);
90
 
91
  sem_post(&grx_mutex);
92
}
93
 
94
/* ------------------------------------------------------------------ */
95
 
96
void bidir_bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name)
97
{
98
  int background = BLACK;
99
  int amp = 0;
100
  point p2;
101
 
102
  p2.x = p1.x + width;
103
  p2.y = p1.y + height;
104
 
105
  sem_wait(&grx_mutex);
106
 
107
  grx_text(name, p1.x, p1.y + height + 3, color, background);
108
  grx_rect(p1.x - 1, p1.y - 1, p2.x + 1, p2.y + 1, border);
109
 
110
  grx_box(p1.x, p1.y, p2.x, p2.y, BLACK);
111
  amp = round( var * (float)((p2.x - p1.x)/2) / max );
112
  if (amp >= 0)
113
    grx_box((p1.x+p2.x)/2, p1.y, ((p1.x+p2.x)/2)+amp, p2.y, color);
114
  else
115
    grx_box((p1.x+p2.x)/2+amp, p1.y, ((p1.x+p2.x)/2), p2.y, color);
116
  grx_line((p1.x+p2.x)/2, p1.y-2, (p1.x+p2.x)/2, p2.y+2, border);
117
 
118
  sem_post(&grx_mutex);
119
}
120
 
121
/* ------------------------------------------------------------------ */
122
 
123
void cmd_display()
124
{
125
  point p1;
126
 
127
  p1.x = TRACK_X1;
128
  p1.y = TRACK_Y2+3;
129
 
130
  sem_wait(&grx_mutex);
131
  grx_rect(p1.x,   p1.y,   p1.x+CMD_WIDTH,   p1.y+CMD_HEIGHT,   BLUE);
132
  grx_rect(p1.x+1, p1.y+1, p1.x+CMD_WIDTH-1, p1.y+CMD_HEIGHT-1, CYAN);
133
  grx_rect(p1.x+2, p1.y+2, p1.x+CMD_WIDTH-2, p1.y+CMD_HEIGHT-2, LIGHTBLUE);
134
  grx_text("## Another Unuseful Track simulatOr ##",
135
           p1.x+8, p1.y+8, YELLOW, BLACK);
136
  grx_text("## -------------------------------- ##",
137
           p1.x+8, p1.y+16, YELLOW, BLACK);
138
  grx_text("Marco Dallera", p1.x+8, p1.y+24, GREEN, BLACK);
139
  grx_text("marchicchio@libero.it", p1.x+120, p1.y+24, GREEN, BLACK);
140
  grx_text("Marco Fiocca", p1.x+8, p1.y+32, GREEN, BLACK);
141
  grx_text("marqinho@tiscalinet.it", p1.x+120, p1.y+32, GREEN, BLACK);
142
 
143
  grx_text("Command keys            ", p1.x+8, p1.y+48, LIGHTBLUE, BLACK);
144
  grx_text("------------------------", p1.x+8, p1.y+56, LIGHTBLUE, BLACK);
145
  grx_text("h      create a HARD car", p1.x+8, p1.y+64, CYAN, BLACK);
146
  grx_text("s      create a SOFT car", p1.x+8, p1.y+72, CYAN, BLACK);
147
  grx_text("ENTER  exit to DOS",       p1.x+8, p1.y+80, CYAN, BLACK);
148
 
149
  sem_post(&grx_mutex);
150
 
151
}
152
 
153
/* ------------------------------------------------------------------ */
154