Skip to content

Commit

Permalink
Fix a few bugs with star generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ConniBug committed Jan 26, 2023
1 parent 56fc656 commit ebe6991
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions includes/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <string>

struct Globals {
bool show_demo_window = true;
bool show_another_window = true;
bool show_demo_window = false;
bool show_another_window = false;

std::string* active_log_file = new std::string("initial");
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int, char**)

glfwMakeContextCurrent(window);

glfwSwapInterval(1); // Enable vsync
// glfwSwapInterval(1); // Enable vsync

// Setup Dear ImGui context
IMGUI_CHECKVERSION();
Expand Down
13 changes: 7 additions & 6 deletions windows/window_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
int bgStarPos[1000][2];
int bgStarVel[1000][2];

static float vel_range = 6.65f;
static float vel_range = 50.65f;

void InitStars() {
std::random_device rd;
Expand All @@ -31,13 +31,14 @@ void InitStars() {
std::uniform_int_distribution<> dis_x(0, ImGui::GetMainViewport()->Size.x);
std::uniform_int_distribution<> dis_y(0, ImGui::GetMainViewport()->Size.y);

std::normal_distribution<float> dis_v(-vel_range, vel_range + 50);
std::normal_distribution<float> dis_v(-vel_range / 2, vel_range * 2);
for (int i = 0; i < 1000; i++) {
bgStarVel[i][0] = dis_x(gen);
bgStarVel[i][1] = dis_y(gen);
// bgStarVel[i][0] = dis_v(gen);
// bgStarVel[i][1] = dis_v(gen);

bgStarPos[i][0] = dis_x(gen);
bgStarPos[i][1] = dis_y(gen);

bgStarVel[i][0] = dis_v(gen);
bgStarVel[i][1] = dis_v(gen);
}
Expand All @@ -52,7 +53,7 @@ void DrawDots()
ImDrawList* draw_list = ImGui::GetBackgroundDrawList();

for (int i = 0; i < 1000; i++) {
std::random_device rd;
static std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis_alpha(100, 150);

Expand Down Expand Up @@ -100,7 +101,7 @@ void init() {
printf("Done initializing.\n");
}
void new_frame(GLFWwindow* window) {
ImGui::ShowDemoWindow(&globals->show_demo_window);
// ImGui::ShowDemoWindow(&globals->show_demo_window);
if(globals->show_another_window)
ImGui::ShowStyleEditor();

Expand Down

0 comments on commit ebe6991

Please sign in to comment.