示例#1
0
 private void UpdateDescriptors()
 {
     verticesCountTextBox.Text = "N vertices: " + userInput.Count.ToString();
     colorLabel.Text           = PolygonColor.ToString();
 }
示例#2
0
        void DrawPolygon(short polygon_index, PolygonColor color)
        {
            Polygon             polygon = Level.Polygons[polygon_index];
            List <Drawer.Point> points  = new List <Drawer.Point>();

            for (int i = 0; i < polygon.VertexCount; ++i)
            {
                points.Add(Transform.ToScreenPoint(Level.Endpoints[polygon.EndpointIndexes[i]]));
            }
            if (Mode == DrawMode.FloorHeight)
            {
                drawer.FillPolygon(PaintColors[polygon.FloorHeight], points);
            }
            else if (Mode == DrawMode.CeilingHeight)
            {
                drawer.FillPolygon(PaintColors[polygon.CeilingHeight], points);
            }
            else if (Mode == DrawMode.PolygonType)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.Type], points);
            }
            else if (Mode == DrawMode.FloorLight)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.FloorLight], points);
            }
            else if (Mode == DrawMode.CeilingLight)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.CeilingLight], points);
            }
            else if (Mode == DrawMode.MediaLight)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.MediaLight], points);
            }
            else if (Mode == DrawMode.Media)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.MediaIndex], points);
            }
            else if (Mode == DrawMode.AmbientSound)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.AmbientSound], points);
            }
            else if (Mode == DrawMode.RandomSound)
            {
                drawer.FillPolygon(PaintColors[(short)polygon.RandomSound], points);
            }
            else if (Mode == DrawMode.FloorTexture)
            {
                drawer.TexturePolygon(polygon.FloorTexture, points);
            }
            else if (Mode == DrawMode.CeilingTexture)
            {
                drawer.TexturePolygon(polygon.CeilingTexture, points);
            }
            else
            {
                if (color == PolygonColor.Selected)
                {
                    drawer.FillPolygon(selectedPolygonColor, points);
                }
                else if (color == PolygonColor.Destination)
                {
                    drawer.FillPolygon(destinationPolygonColor, points);
                }
                else if (polygon.Concave)
                {
                    drawer.FillPolygon(invalidPolygonColor, points);
                }
                else
                {
                    drawer.FillPolygon(polygonColor, points);
                }
            }

            if (Mode == DrawMode.Draw && polygon.Type == PolygonType.Platform)
            {
                Drawer.Point center = Transform.ToScreenPoint(Level.PolygonCenter(polygon));
                Layout       layout = new Pango.Layout(this.PangoContext);
                layout.SetMarkup(String.Format("{0}", polygon_index));
                int width, height;
                layout.GetPixelSize(out width, out height);
                this.GdkWindow.DrawLayout(this.Style.TextGC(Gtk.StateType.Normal), (int)center.X - width / 2, (int)center.Y - height / 2, layout);
            }
        }