-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
54 lines (40 loc) · 1.47 KB
/
main.cpp
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
#include "Physics.h"
#include "Graphics.h"
// #include "Graph.h"
int main(int argc, char* args[])
{
sf::Time Elapsed_Time = sf::seconds(0.f), RecentUpdateTime = sf::seconds(0.f);
sf::Vector2u const window_size(Window_Width, Window_Height);
sf::Vector2u const graph_window_size(GraphWindowWidth, GraphWindowHeight);
sf::Vector2f const x_axis_range(Window_Width*VesselSizeCoeff_x, Window_Width*(1 - VesselSizeCoeff_x));
sf::Vector2f const y_axis_range(Window_Height*VesselSizeCoeff_y, Window_Height*(1 - VesselSizeCoeff_y));
CMolecularGas Gas(x_axis_range, y_axis_range);
CDrawer Drawer(window_size);
// CGraph Graph;
Gas.SetStartPosition(NumberOfMolecules);
Drawer.Set(Gas);
sf::Clock clock;
size_t counter = 0;
if( GraphIsActive ) {
// Graph.Create(graph_window_size);
// Graph.Set();
}
while( Elapsed_Time.asSeconds() <= MaxTime ) {
if( Elapsed_Time.asMilliseconds() - RecentUpdateTime.asMilliseconds() >= 2000 ) {
RecentUpdateTime = Elapsed_Time;
Drawer.SetCounterMode(false);
} else Drawer.SetCounterMode(true);
Gas.MakeStep(Jump_Time);
if( counter == 4 ) {
Gas.UpdateSpeed(4*Jump_Time);
counter = 0;
} else counter++;
if( Drawer.DrawCurrent(Gas) == false ) break;
if( GraphIsActive && Drawer.ShowCounterMode() == false ) {
// Graph.ShowCondition(Drawer.ShowMediumEnergy(), Drawer.ShowMediumPressure());
}
// Graph.UpdateShow();
Elapsed_Time += clock.restart();
}
return 0;
}