Beispiel #1
0
        static void Main(string[] args)
        {
            GraphicsWindow.KeyDown += GraphicsWindow_KeyDown;
            Turtle.PenUp();
            // Turtle.Speed = 9;
            GraphicsWindow.Height     = 800;
            GraphicsWindow.Width      = 600;
            GraphicsWindow.BrushColor = "White";
            var playzone = Shapes.AddRectangle(800, 600);

            GraphicsWindow.BrushColor = "Purple";
            var food      = Shapes.AddRectangle(20, 20);
            int score     = 0;
            var scoreText = Shapes.AddText(score);

            Shapes.Zoom(scoreText, 5, 5);
            Shapes.Move(scoreText, 900, 50);

            Random r     = new Random();
            int    foodX = r.Next(0, 800);
            int    foodY = r.Next(0, 600);

            //int foodX = 100;
            //int foodY = 200;
            Shapes.Move(food, foodX, foodY);
            while (true)
            {
                Turtle.Move(10);
                if (Turtle.X.GreaterThan(foodX) && Turtle.X.LessThan(foodX + 20) && Turtle.Y.GreaterThan(foodY) && Turtle.Y.LessThan(foodY + 20))
                {
                    //foodX = foodX + 25; // перемещение еды согласно заданию
                    foodX = r.Next(0, 780); // случайное появление еды
                    foodY = r.Next(0, 580);
                    Shapes.Move(food, foodX, foodY);
                    score++;
                    Shapes.SetText(scoreText, score);
                }
                if (Turtle.X.GreaterThan(800))
                {
                    Turtle.X = 0;
                }
                if (Turtle.X.LessThan(0))
                {
                    Turtle.X = 800;
                }
                if (Turtle.Y.GreaterThan(600))
                {
                    Turtle.Y = 0;
                }
                if (Turtle.Y.LessThan(0))
                {
                    Turtle.Y = 600;
                }
            }
        }
Beispiel #2
0
        public static void MainMenu()
        {
            int StackReference = Stack.Add("UI.MainMenu()");

            LDGraphicsWindow.ExitButtonMode(GraphicsWindow.Title, "Enabled");
            GraphicsWindow.CanResize = true;

            LDGraphicsWindow.State = 2;
            GraphicsWindow.Title   = GlobalStatic.Title + " ";

            Primitive Sorts = $"1={Language.Localization["Table"]};2={Language.Localization["View"]};3={Language.Localization["Index"]};4={Language.Localization["Master Table"]};";

            if (Engines.CurrentDatabase != null && Engines.CurrentDatabase != null)
            {
                Engines.GetSchema(Engines.CurrentDatabase);
            }
            GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize + 8;
            int UIx = GlobalStatic.Listview_Width - 380;

            string Menu = LDControls.AddMenu(Desktop.Width * 1.5, 30, MenuList, IconList, null);

            Shapes.Move(Shapes.AddText(Language.Localization["Sort"] + ":"), UIx, 1);

            int TextWidth = LDText.GetHeight(Language.Localization["Sort"] + ":");

            GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize;

            try
            {
                GlobalStatic.ComboBox["Table"] = LDControls.AddComboBox(Engines.Tables.ToPrimitiveArray(), 100, 100);
            }
            catch (Exception ex)
            {
                Events.LogMessage(ex.ToString(), "System");
            }

            GlobalStatic.ComboBox["Sorts"]    = LDControls.AddComboBox(Sorts, 100, 100);
            GlobalStatic.ComboBox["Database"] = LDControls.AddComboBox(Engines.DB_ShortName.ToPrimitiveArray(), 100, 100);
            Controls.Move(GlobalStatic.ComboBox["Database"], UIx + TextWidth + 35, 5);
            Controls.Move(GlobalStatic.ComboBox["Sorts"], UIx + TextWidth + 150, 5);
            Controls.Move(GlobalStatic.ComboBox["Table"], UIx + TextWidth + 260, 5);

            //Virtual Call to Handler
            Events.MC(Language.Localization["View"]);

            Title();

            Controls.ButtonClicked         += Events.BC;
            LDControls.MenuClicked         += Events.MC;
            LDControls.ComboBoxItemChanged += Events.CB;
            LDControls.ContextMenuClicked  += Events.MI;

            Stack.Exit(StackReference);
        }
Beispiel #3
0
            public static void Display(Google_Charts.Chart chart)
            {
                int StackPointer = Stack.Add("UI.Charts.Display()");

                Charts.chart = chart;
                ClearWindow();
                GraphicsWindow.Title = "Charts";

                LDGraphicsWindow.CancelClose = true;
                LDGraphicsWindow.ExitOnClose = false;
                LDGraphicsWindow.Closing    += Events.Closing;
                LDGraphicsWindow.ExitButtonMode(GraphicsWindow.Title, "Disabled");

                XColumns.Clear();
                YColumns.Clear();
                Schema = Export.GenerateSchemaListFromLastQuery();

                //UI Stuff
                GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize + 12;

                GraphicsWindow.DrawText(5, 10, string.Format("Min Columns {0}", chart.MinColumns));
                GraphicsWindow.DrawText(5, 30, string.Format("Max Columns {0}", chart.MaxColumns));

                Inequality = Shapes.AddText("Equation");
                Shapes.Move(Inequality, 400, 5);

                GraphicsWindow.DrawText(5, 70, "X:");
                GraphicsWindow.DrawText(300 + 100, 70, "Columns:");
                GraphicsWindow.DrawText(600 + 200, 70, "Y:");

                GraphicsWindow.DrawText(5, 450, "Title");
                GraphicsWindow.DrawText(5, 500, "SubTitle");
                GraphicsWindow.DrawText(5, 550, "X axis");
                GraphicsWindow.DrawText(5, 600, "Y axis");

                GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize;

                XListBox      = LDControls.AddListBox("", 300, 300);
                SchemaListBox = LDControls.AddListBox(Schema.ToPrimitiveArray(), 300, 300);
                YListBox      = LDControls.AddListBox("", 300, 300);

                DataView = LDControls.AddDataView(300, 300, "1=Column;2=Type;");
                LDControls.DataViewSetColumnComboBox(DataView, 2, "1=Text;2=Number;");

                if (Desktop.Width < 1500)
                {
                    LDScrollBars.Add(1920, 0);
                }

                Controls.Move(XListBox, 5, 100);
                Controls.Move(SchemaListBox, 300 + 100, 100);
                Controls.Move(YListBox, 600 + 200, 100);
                Controls.Move(DataView, 1200, 100);

                Left1  = Controls.AddButton("<", 325, 200);
                Right1 = Controls.AddButton(">", 325, 250);

                Left2  = Controls.AddButton("<", 725, 200);
                Right2 = Controls.AddButton(">", 725, 250);

                GenerateChartButton = Controls.AddButton("Generate Chart", 300, 500);
                Controls.Move(GenerateChartButton, 800, 550);
                Controls.SetSize(GenerateChartButton, 100, 30);

                //TODO Add TextBoxes for Title,SubTitle,X axis caption, and y axis caption
                TitleTB        = Controls.AddTextBox(130, 450);
                SubTitleTB     = Controls.AddTextBox(130, 500);
                XaxisCaptionTB = Controls.AddTextBox(130, 550);
                YaxisCaptionTB = Controls.AddTextBox(130, 600);

                Controls.SetSize(TitleTB, 200, 30);
                Controls.SetSize(SubTitleTB, 200, 30);
                Controls.SetSize(XaxisCaptionTB, 200, 30);
                Controls.SetSize(YaxisCaptionTB, 200, 30);

                Escape = Controls.AddButton("Esc", 50, 500);
                Controls.Move(Escape, 800, 500);
                Controls.SetSize(Escape, 100, 30);

                //TODO Add Region options for GeoCharts
                //TODO Allow users to specify data type (Number,string,eventually Datetime etc).
                //Otherwise attempt to grab that data from the db?
                Controls.SetSize(Left1, 50, 30);
                Controls.SetSize(Right1, 50, 30);
                Controls.SetSize(Left2, 50, 30);
                Controls.SetSize(Right2, 50, 30);

                //Event Handler Unhooking
                Controls.ButtonClicked -= Events.BC;
                //Event Handler Hooking
                Controls.ButtonClicked += Handler;
                AutoHide();
                Stack.Exit(StackPointer);
            }