window.onload = function() {
gui.domElement.id = 'gui';
gui.add(control, 'fps', 1, 60, 1).name("Iteration FPS");
gui.add(control, 'pixelSize', 1, 10, 1).name("Pixel Size");
gui.add(control, 'alternativeRule').name("Use Alternative Rule");
gui.add(control, 'showText').name("Show Text");
gui.add(control, 'showOuterRing').name("Show Outer Ring");
gui.add(control, 'showCursorRing').name("Show Cursor Ring");
gui.add(control, 'clear').name("Clear");
theShader = loadShader('vert.glsl', 'frag.glsl');
"https://cdnjs.cloudflare.com/ajax/libs/topcoat/0.8.0/font/SourceCodePro-Bold.otf"
pixelDensity(PIXEL_DENSITY);
canvas = createCanvas(1000, 1000, WEBGL);
theShader.setUniform('u_canvas', canvas);
textGraphic = createGraphics(1000, 1000, WEBGL);
textGraphic.pixelDensity(PIXEL_DENSITY);
textGraphic.background(0);
textGraphic.textSize(70);
textGraphic.textAlign(CENTER, CENTER);
textGraphic.fill("#ffffff");
textGraphic.text("# Game ", 0, -80);
textGraphic.text(" of ", 0, -10);
textGraphic.text(" Life #", 0, 60);
theShader.setUniform("u_text", textGraphic);
var y = (mouseY-500) / min(1, windowWidth / windowHeight) + 500;
theShader.setUniform("u_resolution", [width * PIXEL_DENSITY, height * PIXEL_DENSITY]);
theShader.setUniform("u_mouse", [mouseX * PIXEL_DENSITY, (height-y) * PIXEL_DENSITY]);
theShader.setUniform("u_frame", frame++);
theShader.setUniform("u_fps", control.fps);
theShader.setUniform("u_pixel_size", control.pixelSize);
theShader.setUniform("u_alternative_rule", control.alternativeRule);
theShader.setUniform("u_show_text", control.showText);
theShader.setUniform("u_show_outer_ring", control.showOuterRing);
theShader.setUniform("u_show_cursor_ring", control.showCursorRing);
rect(width * -0.5, height * -0.5, width, height);