This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A small test harness for timing different sorting algorithms. | |
// Prints a graph as a .svg file to stdout. | |
// | |
// sort_analysis.exe > output.svg | |
// | |
#include <stdio.h> | |
#include <windows.h> | |
#include <assert.h> | |
#include <math.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I don't know what I'm looking at here. | |
#define _USE_MATH_DEFINES | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <math.h> | |
#define OUTPUT "hipparchus.pgm" | |
#define WIDTH 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* EDIT: | |
* For future reference, this code doesn't work right so don't use it. | |
* (but probably could be fixed with some care and attention) | |
*/ | |
// Tiny std::function workalike, to allow storing lambdas with captures. (public domain) | |
template <typename> struct fnptr; | |
template <typename Ret, typename... Args> struct fnptr<Ret(Args...)> { | |
void *obj = nullptr; | |
Ret (*wrap)(void*, Args...) = nullptr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to do a toolbar in Dear ImGui. | |
const float toolbarSize = 50; | |
void DockSpaceUI() | |
{ | |
ImGuiViewport* viewport = ImGui::GetMainViewport(); | |
ImGui::SetNextWindowPos(viewport->Pos + ImVec2(0, toolbarSize)); | |
ImGui::SetNextWindowSize(viewport->Size - ImVec2(0, toolbarSize)); | |
ImGui::SetNextWindowViewport(viewport->ID); |