-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cuda
More file actions
58 lines (45 loc) · 1.56 KB
/
Copy pathmain.cuda
File metadata and controls
58 lines (45 loc) · 1.56 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
#include "ct_start_menu.h"
#include <iostream>
/* C++ namespace components (composition pieces) */
namespace CTSTARTMENU {
struct QuickEdit {
float range = 500.0f;
float direction_of_fire = 90.0f;
float wind_speed = 5.0f;
float wind_direction = 180.0f;
};
struct Environment {
float temperature = 20.0f;
float pressure = 1010.0f;
float latitude = 34.0f;
};
struct Profile {
float muzzle_velocity = 820.0f;
float zero_range = 100.0f;
};
} // namespace AppliedBallistics
int main(void)
{
/* Base C system */
AppliedBallisticsSystem abs;
init_applied_ballistics(&abs);
/* C++ composed objects */
AppliedBallistics::QuickEdit qe;
AppliedBallistics::Environment env;
AppliedBallistics::Profile profile;
/* Compose (copy into C struct, NOT inheritance) */
abs.quick_edit.range = qe.range;
abs.quick_edit.direction_of_fire = qe.direction_of_fire;
abs.quick_edit.wind_speed = qe.wind_speed;
abs.quick_edit.wind_direction = qe.wind_direction;
abs.environment.temperature = env.temperature;
abs.environment.pressure = env.pressure;
abs.environment.latitude = env.latitude;
abs.profile.gun.muzzle_velocity = profile.muzzle_velocity;
abs.profile.gun.zero_range = profile.zero_range;
/* Demo output */
std::cout << "Range: " << abs.quick_edit.range << "\n";
std::cout << "Temp: " << abs.environment.temperature << "\n";
std::cout << "Muzzle Velocity: " << abs.profile.gun.muzzle_velocity << "\n";
return 0;
}