-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitFormDisplayPtoTot.cpp
More file actions
164 lines (131 loc) · 4.42 KB
/
UnitFormDisplayPtoTot.cpp
File metadata and controls
164 lines (131 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//---------------------------------------------------------------------------
#include <vcl.h>
#include <stdio.h>
#pragma hdrstop
#include "UnitFormDisplayPtoTot.h"
#include "UnitDatos.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFormDisplayPtoTot *FormDisplayPtoTot;
int minut=0, sec=0;
//---------------------------------------------------------------------------
__fastcall TFormDisplayPtoTot::TFormDisplayPtoTot(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void ResetCrono(void)
{
minut = 0;
sec = 0;
FormDisplayPtoTot->LabelCrono->Caption = "00:00";
}
void __fastcall TFormDisplayPtoTot::FormShow(TObject *Sender)
{
if (Screen->MonitorCount>1)
{
int MonitorTop = Screen->Monitors[1]->Top;
int MonitorLeft = Screen->Monitors[1]->Left;
int MonitorWidth = Screen->Monitors[1]->Width;
int MonitorHeight = MonitorTop + Screen->Monitors[1]->Height;
//MonitorWidth = MonitorLeft + Screen->Monitors[1]->Width; // Will be about zero if the 2nd monitor is to the left of the default monitor
//ShowMessage(MonitorTop);
//ShowMessage(MonitorLeft);
//ShowMessage(MonitorWidth);
//ShowMessage(MonitorHeight);
FormDisplayPtoTot->Top = MonitorTop;
FormDisplayPtoTot->Left = MonitorLeft;
FormDisplayPtoTot->Width = MonitorWidth;
FormDisplayPtoTot->Height = MonitorHeight;
}
/* AJUSTE A LA PANTALLA ->NO FUNCIONA
TListColumn *ListCol;
ListView->Columns->Clear();
ListCol = ListView->Columns->Add();
ListCol->Caption = "PUESTO";
ShowMessage(80/1040*ListView->Width);
ListCol->Width = (int)(80/1040*ListView->Width);
ListCol = ListView->Columns->Add();
ListCol->Caption = "EQUIPO";
ListCol->Width = (int)340/1040*ListView->Width;
ListCol = ListView->Columns->Add();
ListCol->Caption = "VELOCISTAS";
ListCol->Width = (int)110/1040*ListView->Width;
ListCol = ListView->Columns->Add();
ListCol->Caption = "LABERINTO";
ListCol->Width = (int)110/1040*ListView->Width;
ListCol = ListView->Columns->Add();
ListCol->Caption = "SUMO";
ListCol->Width = (int)110/1040*ListView->Width;
ListCol = ListView->Columns->Add();
ListCol->Caption = "FURBOL";
ListCol->Width = (int)80/1040*ListView->Width;
ListCol = ListView->Columns->Add();
ListCol->Caption = "TOTAL";
ListCol->Width = (int)90/1040*ListView->Width;*/
}
//---------------------------------------------------------------------------
void __fastcall TFormDisplayPtoTot::TimerCronoTimer(TObject *Sender)
{
if(sec == 59){
sec=0;
minut++;
}else{
sec++;
}
char tira[10];
sprintf(tira, "%.2d:%.2d", minut, sec);
LabelCrono->Caption = tira;
}
//---------------------------------------------------------------------------
void __fastcall TFormDisplayPtoTot::TimerActTimer(TObject *Sender)
{
ListView->Clear();
TListItem *ListIt;
int i, j, temp_id;
double temp_val;
char tira[20];
static int vector_eq_id_orden[20];
static double vector_eq_val_orden[20];
for(i=0; i<num_equipos; i++) //Rellena el vector con los datos de equipo
{
vector_eq_id_orden[i] = i;
vector_eq_val_orden[i] = equipo[i].puntos_total;
}
//OrdenarEquipos();
for (i=1; i<num_equipos; i++)
{
for (j=0 ; j<num_equipos - i; j++)
{
if (vector_eq_val_orden[j] > vector_eq_val_orden[j+1])
{
temp_id = vector_eq_id_orden[j];
vector_eq_id_orden[j] = vector_eq_id_orden[j+1];
vector_eq_id_orden[j+1] = temp_id;
temp_val = vector_eq_val_orden[j];
vector_eq_val_orden[j] = vector_eq_val_orden[j+1];
vector_eq_val_orden[j+1] = temp_val;
}
}
}
for (i=num_equipos-1; i >= 0; i--)
{
ListIt = ListView->Items->Add();
ListIt->Caption = num_equipos-i;
ListIt->SubItems->Add(equipo[vector_eq_id_orden[i]].nombre);
sprintf(tira, "%.3f", equipo[vector_eq_id_orden[i]].vel_puntos);
ListIt->SubItems->Add(tira);
sprintf(tira, "%.3f", equipo[vector_eq_id_orden[i]].sel_puntos);
ListIt->SubItems->Add(tira);
sprintf(tira, "%.3f", equipo[vector_eq_id_orden[i]].lab_puntos);
ListIt->SubItems->Add(tira);
sprintf(tira, "%.3f", equipo[vector_eq_id_orden[i]].sum_puntos);
ListIt->SubItems->Add(tira);
sprintf(tira, "%.3f", equipo[vector_eq_id_orden[i]].fut_puntos);
ListIt->SubItems->Add(tira);
sprintf(tira, "%.3f", equipo[vector_eq_id_orden[i]].puntos_total);
ListIt->SubItems->Add(tira);
}
}
//---------------------------------------------------------------------------