-
Notifications
You must be signed in to change notification settings - Fork 0
/
Solar_System.cpp
37 lines (31 loc) · 1.08 KB
/
Solar_System.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
#pragma once
#include <SFML/Graphics.hpp>
#include <random>
#include "Solar_System.h"
#include "Planet.h"
using namespace sf;
Solar_System::Solar_System()
{
std::random_device dev;
std::mt19937 rng(dev());
std::uniform_int_distribution<std::mt19937::result_type> random(100, 550);
std::uniform_int_distribution<std::mt19937::result_type> random1(0, 20);
std::uniform_int_distribution<std::mt19937::result_type> randoms(0, 5000);
std::uniform_int_distribution<std::mt19937::result_type> random1s(0, 620);
stars.resize(500);
stars.setPrimitiveType(Points);
for (int i = 0; i < 500; i++) {
stars[i].position = Vector2f(randoms(rng), random1s(rng));
}
for (int i = 0; i < 5; i++) {
Planet planet;
planet.out_view.setPosition((i + 1) * 102, random(rng));
planet.out_view.setRadius(random1(rng) + 15);
planet.out_view.setFillColor(Color(random1(rng) * 10, random1(rng) * 5, random1(rng) * 11));
planet.out_view.setOutlineThickness(random1(rng));
planet.out_view.setOutlineColor(Color(i * 50, random1(rng) * 3, 100));
planets.push_back(planet);
}
}
Solar_System::~Solar_System() {
}