New paste Repaste Download
#include <chrono>
#include <iostream>
#include <random>
#include <stdio.h>
#include <string.h>
#include <thread>
using namespace std;
// ^ Idk which ones are needed for this function, anyways
int loading_spinner() {
  std::random_device rd;
  std::mt19937 gen(rd());
  std::uniform_int_distribution<> dist(100, 300);
  const char spinchars[] = {'|', '/', '-', '\\'};
  const char *frames[] = {
      "[=           ]", "[==          ]", "[===         ]", "[====        ]",
      "[=====       ]", "[======      ]", "[=======     ]", "[========    ]",
      "[=========   ]", "[==========  ]", "[==========  ]", "[=========== ]",
      "[============]",
  };
  int i = 0;
  bool spinner{true};
  bool bar{false};
  int num_of_frames_bar = sizeof(frames) / sizeof(frames[0]);
  while (spinner) {
    if (i == 15) {
      spinner = false;
      bar = true;
      i = 0;
    }
    std::cout << "\r" << spinchars[i % 4] << std::flush;
    std::this_thread::sleep_for(std::chrono::milliseconds(100));
    i++;
  }
  i = 0;
  while (bar && i < num_of_frames_bar) {
    int random_number = dist(gen);
    std::cout << "\r" << frames[i % num_of_frames_bar] << std::flush;
    std::this_thread::sleep_for(std::chrono::milliseconds(random_number));
    i++;
  }
  printf(
      "\nYou have seen a PoC for animations coded by NoJamesHere. Goodbye.\n");
  return 0;
}
Filename: None. Size: 1kb. View raw, , hex, or download this file.

This paste expires on 2025-09-18 11:41:04.123935. Pasted through web.