Пример #1
0
        public static void Main()
        {
            bool loop = true;

            while (loop)
            {
                Console.Write("P#: ");
                int    input    = 0;
                string inputStr = Console.ReadLine();

                try
                {
                    input = Int32.Parse(inputStr);

                    if (input >= 0 && input <= 4)
                    {
                        PongB x = new PongB(input);
                        Tyson.LAUNCH(x.Load, x.Logic, x.Render, CMD, 1, 1, false, Color.Black, "Pong", 60);
                        loop = false;
                    }
                }
                catch { }
                Console.WriteLine("Invalid Input! Try again...");
            }
        }
Пример #2
0
        void drawPauseSymbol(double x, double y, double size, Color c)
        {
            double q = size / 4, j = size / 2;

            Tyson.RenderBox(x - j, y, q, size, c);
            Tyson.RenderBox(x + j, y, q, size, c);
        }
Пример #3
0
 static void cmdhandle(string arg)
 {
     if (arg == "lol")
     {
         Tyson.ADD_CMD_LINE("wow ok");
     }
 }
Пример #4
0
 public void updateview2()
 {
     if (Delaunay.Checked && dlay.Count > 0)
     {
         Delaunay.PerformClick();
     }
     if (Tyson.Checked && dlay.Count > 0)
     {
         Tyson.PerformClick();
     }
 }
Пример #5
0
 public void draw(bool debug)
 {
     if (debug)
     {
         Tyson.RenderBox(x, y, width, aiOffset * 2, Color.Green);
     }
     Tyson.RenderBox(x, y, width, height - 20, hue);
     if (debug)
     {
         Tyson.RenderBox(x, aiRNDoffset, 5, 5, Color.Orange);
     }
 }
Пример #6
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (MouseOnMap)
            {
                MouseOnMap = false;
                switch (MouseCommand)
                {
                case MOUSECOMMAND.Select:
                    for (int i = 0; i < document.layers.Count; i++)
                    {
                        document.layers[i].ClearSelection();
                    }
                    if (e.X == MouseStartX && e.Y == MouseStartY)
                    {
                        for (int i = 0; i < document.layers.Count; i++)
                        {
                            GISFeature feature = document.layers[i].SelectByClick(new Point(e.X, e.Y), view);
                            if (feature != null)
                            {
                                feature.Selected = true;
                            }
                        }
                    }
                    else
                    {
                        GISExtent extent = view.RectToExtent(new Rectangle(
                                                                 Math.Min(e.X, MouseStartX),
                                                                 Math.Min(e.Y, MouseStartY),
                                                                 Math.Abs(e.X - MouseStartX),
                                                                 Math.Abs(e.Y - MouseStartY)));
                        for (int i = 0; i < document.layers.Count; i++)
                        {
                            List <GISFeature> features = document.layers[i].SelectByExtent(extent);
                            for (int j = 0; j < features.Count; j++)
                            {
                                features[j].Selected = true;
                            }
                        }
                    }
                    updateview();

                    if (layerDialog != null)
                    {
                        layerDialog.UpdateSelection();
                    }
                    break;

                case MOUSECOMMAND.ZoomIn:
                    if (e.X == MouseStartX && e.Y == MouseStartY)
                    {
                        GISVertex MouseLocation = view.ToMapVertex(new Point(e.X, e.Y));
                        double    ZoomInfactor  = 0.8;
                        double    newwidth      = view.CurrentMapExtent.Width * ZoomInfactor;
                        double    newheight     = view.CurrentMapExtent.Height * ZoomInfactor;
                        double    newminx       = MouseLocation.x - (MouseLocation.x - view.CurrentMapExtent.MinX) * ZoomInfactor;
                        double    newminy       = MouseLocation.y - (MouseLocation.y - view.CurrentMapExtent.MinY) * ZoomInfactor;
                        view.CurrentMapExtent.SetValue(new GISVertex(newminx, newminy), new GISVertex(newminx + newwidth, newminy + newheight));
                    }
                    else
                    {
                        view.CurrentMapExtent = view.RectToExtent(new Rectangle(
                                                                      Math.Min(e.X, MouseStartX),
                                                                      Math.Min(e.Y, MouseStartY),
                                                                      Math.Abs(e.X - MouseStartX),
                                                                      Math.Abs(e.Y - MouseStartY)));
                    }
                    if (Delaunay.Checked || Tyson.Checked)
                    {
                        updateview2();
                    }
                    else
                    {
                        updateview();
                    }
                    break;

                case MOUSECOMMAND.ZoomOut:
                    if (e.X == MouseStartX && e.Y == MouseStartY)
                    {
                        GISVertex MouseLocation = view.ToMapVertex(new Point(e.X, e.Y));
                        double    ZoomOutfactor = 0.8;
                        double    newwidth      = view.CurrentMapExtent.Width / ZoomOutfactor;
                        double    newheight     = view.CurrentMapExtent.Height / ZoomOutfactor;
                        double    newminx       = MouseLocation.x - (MouseLocation.x - view.CurrentMapExtent.MinX) / ZoomOutfactor;
                        double    newminy       = MouseLocation.y - (MouseLocation.y - view.CurrentMapExtent.MinY) / ZoomOutfactor;
                        view.CurrentMapExtent.SetValue(new GISVertex(newminx, newminy), new GISVertex(newminx + newwidth, newminy + newheight));
                    }
                    else
                    {
                        GISExtent extent = view.RectToExtent(new Rectangle(
                                                                 Math.Min(e.X, MouseStartX),
                                                                 Math.Min(e.Y, MouseStartY),
                                                                 Math.Abs(e.X - MouseStartX),
                                                                 Math.Abs(e.Y - MouseStartY)));
                        double newwidth  = view.CurrentMapExtent.Width * view.CurrentMapExtent.Width / extent.Width;
                        double newheight = view.CurrentMapExtent.Height * view.CurrentMapExtent.Height / extent.Height;
                        double newminx   = extent.MinX - (extent.MinX - view.CurrentMapExtent.MinX) * newwidth / view.CurrentMapExtent.Width;
                        double newminy   = extent.MinY - (extent.MinY - view.CurrentMapExtent.MinY) * newheight / view.CurrentMapExtent.Height;
                        view.CurrentMapExtent.SetValue(new GISVertex(newminx, newminy), new GISVertex(newminx + newwidth, newminy + newheight));
                    }
                    if (Delaunay.Checked || Tyson.Checked)
                    {
                        updateview2();
                    }
                    else
                    {
                        updateview();
                    }
                    break;

                case MOUSECOMMAND.Pan:
                    GISVertex C1 = view.CurrentMapExtent.MapCenter;
                    GISVertex M1 = view.ToMapVertex(new Point(MouseStartX, MouseStartY));
                    GISVertex M2 = view.ToMapVertex(new Point(e.X, e.Y));
                    GISVertex C2 = new GISVertex(C1.x - (M2.x - M1.x), C1.y - (M2.y - M1.y));
                    view.CurrentMapExtent.SetMapCenter(C2);
                    updateview();
                    if (Delaunay.Checked && dlay.Count > 0)
                    {
                        Delaunay.PerformClick();
                    }
                    if (Tyson.Checked && dlay.Count > 0)
                    {
                        Tyson.PerformClick();
                    }
                    break;

                case MOUSECOMMAND.Dis:
                    GISVertex v1  = view.ToMapVertex(new Point(MouseStartX, MouseStartY));
                    GISVertex v2  = view.ToMapVertex(new Point(e.X, e.Y));
                    double    dis = Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y));
                    MessageBox.Show(dis.ToString());
                    break;
                }
            }
        }
Пример #7
0
 public static void Main()
 {
     Tyson.LAUNCH(load, logic, render, false);
 }
Пример #8
0
 static void render()
 {
     Tyson.RenderCircle(0, 0, a, a, hue);
 }
Пример #9
0
 public void draw()
 {
     Tyson.RenderBox(x, y, size, size, hue);
 }