// Generated by BUCKLESCRIPT VERSION 1.8.1, PLEASE EDIT WITH CARE
'use strict';

var Terrain      = require("./terrain.js");
var Js_option    = require("bs-platform/lib/js/js_option.js");
var Canvas2dRe   = require("bs-webapi/lib/js/src/canvas/canvas2dRe.js");
var DocumentRe   = require("bs-webapi/lib/js/src/dom/nodes/documentRe.js");
var Pervasives   = require("bs-platform/lib/js/pervasives.js");
var Js_primitive = require("bs-platform/lib/js/js_primitive.js");

var width = window.innerWidth;

var height = window.innerHeight;

var canvas = document.createElement("canvas");

var ctx = canvas.getContext("2d");

Js_option.map((function (doc) {
        doc.appendChild(canvas);
        return /* () */0;
      }), Js_option.andThen((function (doc) {
            return Js_primitive.null_to_opt(doc.body);
          }), DocumentRe.asHtmlDocument(document)));

canvas.setAttribute("height", Pervasives.string_of_int(height));

canvas.setAttribute("width", Pervasives.string_of_int(width));

function drawBackground(context, color, width, height) {
  Canvas2dRe.setFillStyle(context, /* String */0, color);
  context.fillRect(0, 0, width, height);
  return /* () */0;
}

drawBackground(ctx, "#000000", width, height);

var t1 = Terrain.create(1);

var t2 = Terrain.refine(t1, 5.0);

var t3 = Terrain.refine(t2, 5.0);

var t4 = Terrain.refine(t3, 5.0);

var t5 = Terrain.refine(t4, 5.0);

var t6 = Terrain.refine(t5, 5.0);

var t7 = Terrain.refine(t6, 1.0);

var t8 = Terrain.refine(t7, 1.0);

var t9 = Terrain.refine(t8, 5.0);

Terrain.draw(t9, ctx, width, height);

exports.width          = width;
exports.height         = height;
exports.canvas         = canvas;
exports.ctx            = ctx;
exports.drawBackground = drawBackground;
exports.t1             = t1;
exports.t2             = t2;
exports.t3             = t3;
exports.t4             = t4;
exports.t5             = t5;
exports.t6             = t6;
exports.t7             = t7;
exports.t8             = t8;
exports.t9             = t9;
/* width Not a pure module */
