-
Notifications
You must be signed in to change notification settings - Fork 0
/
hF2classPix1init.h
96 lines (80 loc) · 1.79 KB
/
hF2classPix1init.h
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
#pragma once
Pix Pix::init(par r0, par v0, double m, double q, bool selfcolor, ALLEGRO_COLOR scolor, double R)
{
this->setup(r0, v0, m, q, selfcolor, scolor, R);
return *this;
}
Pix Pix::init(istate initialstate)
{
this->setup(initialstate);
return *this;
}
void Pix::setR(double R)
{
(R >= 0.0) ? this->R = R : this->R = 1;
}
void Pix::setup(par r0, par v0, double m, double q, bool selfcolor, ALLEGRO_COLOR scolor, double R)
{
this->setdefaults(r0, v0, m, q, selfcolor, scolor, R);
}
void Pix::setup(istate initialstate)
{
this->setdefaults(initialstate);
}
void Pix::getid()
{
this->id = getrandom();
}
void Pix::setid(double id)
{
this->id = id;
}
Pix::Pix()
{
this->setnull();
}
void Pix::setnull()
{
this->setid(0);
this->initialized = false;
this->active = false;
this->contacted = false;
this->setcolor(_white);
this->setR(0);
this->r = par(0, 0);
this->r0 = par(0, 0);
this->v = par(0, 0);
this->v0 = par(0, 0);
this->m = 0;
this->q = 0;
this->dr = par(0, 0);
}
void Pix::setdefaults(par r0, par v0, double m, double q, bool selfcolor, ALLEGRO_COLOR scolor, double R)
{
// Getting id only first-time
this->setR(R);
this->initialized = true;
this->active = true;
this->contacted = false;
this->m = m;
this->q = q;
this->selfcolor = selfcolor;
this->scolor = scolor;
this->r0 = r0;
this->v0 = v0;
this->compute_r();
}
void Pix::setdefaults(istate initialstate)
{
this->setR(initialstate.R);
this->initialized = true;
this->active = true;
this->contacted = false;
this->m = initialstate.m;
this->q = initialstate.q;
this->selfcolor = initialstate.selfcolor;
this->scolor = initialstate.scolor;
this->r0 = initialstate.r0;
this->v0 = initialstate.v0;
this->compute_r();
}