Skip to content

Instantly share code, notes, and snippets.

{"items":{"4":{"position":{"v":[-190.20947,-518.1428]},"identity":{"name":"Rectangle 0","kind":"Rectangle"},"child":null,"size":{"v":[1231.419,85.714294]},"color":{"c":{"r":0.78431374,"g":0.3882353,"b":0.78431374,"a":1.0}},"text":null,"image":null},"2":{"position":{"v":[-56.499985,-235.0]},"identity":{"name":"Image 0","kind":"Image"},"child":null,"size":{"v":[287.0,391.0]},"color":{"c":{"r":1.0,"g":1.0,"b":1.0,"a":1.0}},"text":null,"image":"iVBORw0KGgoAAAANSUhEUgAAAR8AAAGHCAYAAACJYlZjAAAb60lEQVR4nO3dXaheVX7H8e1cKMhQa5lR7ARrfQuGGTFNtYFi0tbaVohTmHjR5EKxBEy9yMlNbNEJBLRCkxtPLjQyQpyBJjdmQCNa8QW0N8ESRlJUopPMNA2ItjCMjBZHOu3+Pcd1ss46ez/P3vtZe6+11/p+oONzLDnmnPPs7/Nfa+9nn4v+r1QAwMCID4AgiA+AIIgPgCCID4AgiA+AIIgPgCCID4AgiA+AIIgPgCCID4AgiA+AIIgPgCCID4AgiA+AIIgPgCCID4AgiA+AIIgPgCCID4AgiA+AIIgPgCCID4AgiA+AIIgPvDp27vXi4AdHi/Off1x+NJw1l15ZPHD91mL7NXeVH2EMiA/mEio2dRShXTduK7ZefUf5EWJGfNDZ4ukjxcHTR8tHcbnkaxcX7205Vj5CzIgPWnvrk5PF3lNP1U47W761qdi/fmESgSG8+tGJYue//WP5aImWXo/e/GD5CDEjPmhF4Vk4eaD49MvPyo+WbLpiQ3HotocHi41r4yv3Fv/1xS8m/30
{"items":{"3":{"position":{"v":[48.71488,-221.61017]},"identity":{"name":"Image 0","kind":"Image"},"child":null,"size":{"v":[814.4297,286.77966]},"color":{"c":{"r":1.0,"g":1.0,"b":1.0,"a":1.0}},"text":null,"image":"iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAE270lEQVR4nOy9B4AlVZX/f17oHKenJyfCwDAw5CSgAqbVVcSwmLNi+puzG3Vd17gGzDnhGjC75oCCCCI5D0xgcujpnF/8f77n1n3vdU8PoDaj+Ovz7vd8v+fUrVv16tU9XVWvpydlczZnczZnDxCbK1hzNmdz9oCxuYI1Z3M2Zw8YmytYczZnc/aAsbmCNWdzNmcPGJsrWHM2Z3P2gLG5gjVnczZnDxibK1hzNmdz9oCxuYI1Z3M2Zw8YmytYczZnc/aAsbmCNWdzNmcPGJsrWHM2Z3P2gLG5gjVnczZnDxibK1hzNmdz9oCxuYI1Z3M2Zw8YmytYczZnc/aAsbmCNWdzNmcPGJsrWHM2Z3P2gLG5gjVnczZnDxibK1hzNmdz9oCxuYI1Z3M2Zw8YmytYczZnc/aAsbmCNWdzNmcPGJsrWHM2Z3P2gLG5gjVnczZnDxibK1hzNmdz9oCxuYI1Z3M2Zw8YO6gFq/y2t9lf1YoZs3aziyf+YHev32j1KeJUvTWl8nbumU+0K9dfZ3t332UdS7ttaNc+O/rUR9n2jbfYSH+vZVJ11tCdscJ4yQaHxmx122IbHdhr2bXrLFXM29YN19vCznmWypVtYDJvDY0Nli6nLdVetsm+Satn8wVLWyabtXIhb8VymQyHHyqnypZSnDb61Vk+V7BMZ71lmjI2tnfUMnUZy7KwOD5py48/g33bbIP79lqZfKpU0ihW4q3Ul+usVCraZH7MDj3uoTawY4uNDu5m/JSV0
#include <chrono>
#include <random>
#include <iostream>
std::vector<int> lotsOfNumbers(int amount, bool includeZero)
{
std::vector<int> numbers(amount);
std::mt19937 random{std::random_device()()};
std::uniform_int_distribution<int> intRange;
class Animal
{
public:
virtual void makeNoise() const
{
std::cout << "...\n";
}
virtual ~Animal() {}
};
@therocode
therocode / gist:f9e97fb0e1962e6f106a
Last active August 29, 2015 14:20
GimGui tree traversal
gim::Element element(/* some initialization*/);
//returns a pointer to the direct parent - nullptr if no parent is present
element.parent();
//returns a list of all direct child elements
element.children();
//returns a list of pointers to all direct children with
//the supplied labels
@therocode
therocode / gist:494af91092ed1f35890a
Last active August 29, 2015 14:20
GimGui adding attributes
gim::Element element({"example_element"},
{
//here follows a list of name-value pairs to initialize the attributes.
//the values can be of any type.
{"position", Vec2(23, 10)},
{"size", Vec2(64, 64)},
{"name", "Health meter"s},
{"health", 100},
}, {/*children go here*/});
@therocode
therocode / gist:da9f45040553f57986b7
Last active August 29, 2015 14:20
GimGui simple element construction
//declare the root variable that can later be used and will
//contain the children
gim::Element root({"root"}, {},
{
gim::Element({"container"}, {}, //first child element
{
gim::Element({"text"}) //grandchild
}),
gim::Element({"container"}, {}, //second child element
{