structural changes + a repo of a bunch of patterns to choose from

This commit is contained in:
MitchellHansen
2017-04-08 21:20:09 -07:00
parent efc9c34ebe
commit 66ca187f45
1552 changed files with 87287 additions and 25 deletions

34
include/Decoder.h Normal file
View File

@@ -0,0 +1,34 @@
#pragma once
#include <iostream>
#include <experimental/filesystem>
#include <vector>
#include <SFML/Graphics.hpp>
struct pattern_info {
std::string title;
std::string author;
std::string comments;
sf::Vector2i dimensions;
char *pattern;
};
class Decoder {
public:
Decoder();
~Decoder();
pattern_info decodePattern(std::string pattern);
std::vector<std::string> getPatternList();
private:
std::vector<std::string> pattern_list;
};

View File

@@ -11,11 +11,50 @@
#include <iterator>
#include <list>
#include <algorithm>
#include "imgui/imgui.h"
const double PI = 3.141592653589793238463;
const float PI_F = 3.14159265358979f;
struct fps_counter {
public:
fps_counter() {};
void frame(double delta_time) {
// Apply 100 units of smoothing
if (frame_count == 100) {
frame_count = 0;
fps_average = 0;
}
frame_count++;
fps_average += (delta_time - fps_average) / frame_count;
}
void draw() {
if (arr_pos == 200)
arr_pos = 0;
fps_array[arr_pos] = static_cast<float>(1.0 / fps_average);
arr_pos++;
ImGui::Begin("Performance");
ImGui::PlotLines("FPS", fps_array, 200, 0, std::to_string(1.0 / fps_average).c_str(), 0.0f, 150.0f, ImVec2(200, 80));
ImGui::End();
}
private:
float fps_array[200]{ 60 };
int arr_pos = 0;
int frame_count = 0;
double fps_average = 0;
};
inline sf::Vector3f SphereToCart(sf::Vector2f i) {
auto r = sf::Vector3f(