Esempio n. 1
0
        public static void Main()
        {
            if (WorkerSpawn.CheckIsWorker())
            {
                return;
            }
            var meta = Document.CreateElement <HTMLMetaElement>("meta");

            meta.Name    = "viewport";
            meta.Content = "width=device-width, initial-scale=1";
            Document.Head.AppendChild(meta);
            displayHost = Document.CreateElement <HTMLDivElement>("div");
            displayHost.Style.Height  = "100%";
            displayHost.Style.Width   = "100vw";
            displayHost.Style.Display = Display.TableRow;
            display    = new LoopDisplay(displayHost);
            typePicker = Document.CreateElement <HTMLSelectElement>("select");
            typePicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            typePicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            typePicker.Options[0].Text = "Square";
            typePicker.Options[1].Text = "Hexagon3";
            typePicker.SelectedIndex   = 0;
            Document.Body.AppendChild(typePicker);
            Document.Body.AppendChild(Document.CreateTextNode("Size:"));
            sizeInput             = Document.CreateElement <HTMLInputElement>("input");
            sizeInput.Placeholder = "10x10";
            sizeInput.Type        = InputType.Text;
            Document.Body.AppendChild(sizeInput);
            difficultyPicker = Document.CreateElement <HTMLSelectElement>("select");
            difficultyPicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            difficultyPicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            difficultyPicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            difficultyPicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            difficultyPicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            difficultyPicker.Add(Document.CreateElement <HTMLOptionElement>("option"));
            difficultyPicker.Options[0].Text = "Trivial";
            difficultyPicker.Options[1].Text = "Easy";
            difficultyPicker.Options[2].Text = "Easyish";
            difficultyPicker.Options[3].Text = "Moderate";
            difficultyPicker.Options[4].Text = "Maybe Harder";
            difficultyPicker.Options[5].Text = "Unlimited";
            difficultyPicker.SelectedIndex   = 1;
            Document.Body.AppendChild(difficultyPicker);
            generateButton             = Document.CreateElement <HTMLButtonElement>("button");
            generateButton.TextContent = "Generate";
            generateButton.OnClick     = OnClick;
            Document.Body.AppendChild(generateButton);
            timer = Document.CreateTextNode("0:00");
            Document.Body.AppendChild(timer);
            Document.Body.AppendChild(Document.CreateElement <HTMLBRElement>("br"));
            var undoButton = Document.CreateElement <HTMLButtonElement>("button");

            undoButton.TextContent = "Undo";
            undoButton.OnClick     = e => display.Undo();
            Document.Body.AppendChild(undoButton);
            var redoButton = Document.CreateElement <HTMLButtonElement>("button");

            redoButton.TextContent = "Redo";
            redoButton.OnClick     = e => display.Redo();
            Document.Body.AppendChild(redoButton);
            Document.Body.AppendChild(Document.CreateElement <HTMLBRElement>("br"));
            var fixButton = Document.CreateElement <HTMLButtonElement>("button");

            fixButton.TextContent = "Fix";
            fixButton.OnClick     = e => display.Fix();
            Document.Body.AppendChild(fixButton);
            var unfixButton = Document.CreateElement <HTMLButtonElement>("button");

            unfixButton.TextContent = "Unfix";
            unfixButton.OnClick     = e => display.Unfix();
            Document.Body.AppendChild(unfixButton);
            var revertButton = Document.CreateElement <HTMLButtonElement>("button");

            revertButton.TextContent = "Revert";
            revertButton.OnClick     = e => display.RevertToFix();
            Document.Body.AppendChild(revertButton);



            Document.Body.AppendChild(displayHost);
            Document.Body.Style.Height             = "100vh";
            Document.Body.Style.Width              = "100vw";
            Document.Body.Style.Margin             = "0";
            Document.Body.Style.Padding            = "0";
            Document.Body.Style.Display            = Display.Table;
            Document.DocumentElement.Style.Height  = "100vh";
            Document.DocumentElement.Style.Width   = "100vw";
            Document.DocumentElement.Style.Margin  = "0";
            Document.DocumentElement.Style.Padding = "0";
            display.Mesh = new Mesh(4, 4, MeshType.Hexagonal3);
            //display.Mesh.Generate();
            display.Mesh         = display.Mesh;
            Window.OnResize      = App_Resize;
            Window.OnKeyDown     = display.OnKeyDown;
            Document.Body.OnLoad = App_Resize;
            Window.SetTimeout(App_Tick, 100);
        }
Esempio n. 2
0
 public FixAction(LoopDisplay display, bool fix)
 {
     this.display = display;
     this.fix     = fix;
 }