Exemple #1
0
 static public int SetHue(string[] input)
 {
     if (input.Count() == 3)
     {
         if (!PixelGridUI.FormOpen && !EditorUI.PixelGrid.IsBusy)
         {
             EditorUI.PixelGrid.RunWorkerAsync();
             while (!PixelGridUI.FormOpen)
             {
                 Thread.Sleep(0);
             }
         }
         int X = Functions.ParseArgumentToValue(input[0]);
         int Y = Functions.ParseArgumentToValue(input[1]);
         int H = Functions.ParseArgumentToValue(input[2]);
         if (X >= 0 && X <= PixelGridUI.GridSize - 1 && Y >= 0 && Y <= PixelGridUI.GridSize - 1)
         {
             while (H >= 360)
             {
                 H -= 360;
             }
             while (H < 0)
             {
                 H += 360;
             }
             PixelGridUI.SetPixelHSV(X, Y, H, 100, 100);
         }
     }
     else
     {
         ToManyArguments();
         return(ReturnCodes["General Error"]);
     }
     return(1);
 }
Exemple #2
0
 static public int SetPixel(string[] input)
 {
     if (input.Count() == 3)
     {
         if (!PixelGridUI.FormOpen && !EditorUI.PixelGrid.IsBusy)
         {
             EditorUI.PixelGrid.RunWorkerAsync();
             while (!PixelGridUI.FormOpen)
             {
                 Thread.Sleep(0);
             }
         }
         int X   = Functions.ParseArgumentToValue(input[0]);
         int Y   = Functions.ParseArgumentToValue(input[1]);
         int VAL = Functions.ParseArgumentToValue(input[2]);
         if (X >= 0 && X <= PixelGridUI.GridSize - 1 && Y >= 0 && Y <= PixelGridUI.GridSize - 1)
         {
             if (VAL <= 0)
             {
                 PixelGridUI.SetPixelBW(X, Y, 0);
             }
             else
             {
                 PixelGridUI.SetPixelBW(X, Y, 1);
             }
         }
     }
     else
     {
         ToManyArguments();
         return(ReturnCodes["General Error"]);
     }
     return(1);
 }
Exemple #3
0
        public void ResetProgram()
        {
            int test = new int();

            AttemptStop();
            ErrorTextBox.Clear();
            OutputTextBox.Clear();
            Interpret.Reset();
            Settings.CanReset = false;
            SetRunToRun();
            SetOptionsToOptions();
            EnableEdit();
            PixelGridUI.NewGrid();
        }
Exemple #4
0
 static public int ClearPixel(string[] input)
 {
     if (input.Count() == 0)
     {
         if (!PixelGridUI.FormOpen)
         {
             EditorUI.PixelGrid.RunWorkerAsync();
         }
         PixelGridUI.NewGrid();
     }
     else
     {
         ToManyArguments();
         return(ReturnCodes["General Error"]);
     }
     return(1);
 }
Exemple #5
0
 static public int SetHSV(string[] input)
 {
     if (input.Count() == 5)
     {
         if (!PixelGridUI.FormOpen && !EditorUI.PixelGrid.IsBusy)
         {
             EditorUI.PixelGrid.RunWorkerAsync();
             while (!PixelGridUI.FormOpen)
             {
                 Thread.Sleep(0);
             }
         }
         int X = Functions.ParseArgumentToValue(input[0]);
         int Y = Functions.ParseArgumentToValue(input[1]);
         int H = Functions.ParseArgumentToValue(input[2]);
         int S = Functions.ParseArgumentToValue(input[3]);
         int V = Functions.ParseArgumentToValue(input[4]);
         if (X >= 0 && X <= PixelGridUI.GridSize - 1 && Y >= 0 && Y <= PixelGridUI.GridSize - 1)
         {
             while (H >= 360)
             {
                 H -= 360;
             }
             while (H < 0)
             {
                 H += 360;
             }
             if (S <= 100 && S >= 0 && V <= 100 && V >= 0)
             {
                 PixelGridUI.SetPixelHSV(X, Y, H, S, V);
             }
             else
             {
                 Output.ErrorMSG = "Line " + (Simulation.CurrentLine + 1) + ": Out of bounds of Color Space";
                 Functions.ErrorPrint(Output.ErrorMSG);
                 Break.ErrorBreak = true;
             }
         }
     }
     else
     {
         ToManyArguments();
         return(ReturnCodes["General Error"]);
     }
     return(1);
 }
Exemple #6
0
 static public int SetRGB(string[] input)
 {
     if (input.Count() == 5)
     {
         if (!PixelGridUI.FormOpen && !EditorUI.PixelGrid.IsBusy)
         {
             EditorUI.PixelGrid.RunWorkerAsync();
             while (!PixelGridUI.FormOpen)
             {
                 Thread.Sleep(0);
             }
         }
         int X = Functions.ParseArgumentToValue(input[0]);
         int Y = Functions.ParseArgumentToValue(input[1]);
         int R = Functions.ParseArgumentToValue(input[2]);
         int G = Functions.ParseArgumentToValue(input[3]);
         int B = Functions.ParseArgumentToValue(input[4]);
         if (X >= 0 && X <= PixelGridUI.GridSize - 1 && Y >= 0 && Y <= PixelGridUI.GridSize - 1)
         {
             if (R <= 255 && R >= 0 &&
                 G <= 255 && G >= 0 &&
                 B <= 255 && B >= 0)
             {
                 PixelGridUI.SetPixelRGB(X, Y, R, G, B);
             }
             else
             {
                 Output.ErrorMSG = "Line " + (Simulation.CurrentLine + 1) + ": Out of bounds of Color Space";
                 Functions.ErrorPrint(Output.ErrorMSG);
                 Break.ErrorBreak = true;
             }
         }
     }
     else
     {
         ToManyArguments();
         return(ReturnCodes["General Error"]);
     }
     return(1);
 }
Exemple #7
0
 private void PixelGridWait(object sender, DoWorkEventArgs e)
 {
     PixelGridUI.InitPixelGrid();
 }