Exemplo n.º 1
0
 Mesh make_button_body_mesh()
 {
     if (Shape.Type == HUDShapeType.Disc)
     {
         return(MeshGenerators.CreateTrivialDisc(Shape.Radius, Shape.Slices));
     }
     else if (Shape.Type == HUDShapeType.Rectangle)
     {
         return(MeshGenerators.CreateTrivialRect(Shape.Width, Shape.Height,
                                                 Shape.UseUVSubRegion == true ?
                                                 MeshGenerators.UVRegionType.CenteredUVRectangle : MeshGenerators.UVRegionType.FullUVSquare));
     }
     else
     {
         throw new Exception("[HUDButton::make_button_body_mesh] unknown shape type!");
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a fMesh of the shape/dimensions specified by Shape
 /// </summary>
 public static fMesh MakeBackgroundMesh(HUDShape Shape)
 {
     if (Shape.Type == HUDShapeType.Disc)
     {
         return(MeshGenerators.CreateTrivialDisc(Shape.Radius, Shape.Slices));
     }
     else if (Shape.Type == HUDShapeType.Rectangle)
     {
         return(MeshGenerators.CreateTrivialRect(Shape.Width, Shape.Height,
                                                 Shape.UseUVSubRegion == true ?
                                                 MeshGenerators.UVRegionType.CenteredUVRectangle : MeshGenerators.UVRegionType.FullUVSquare));
     }
     else if (Shape.Type == HUDShapeType.RoundRect)
     {
         return(MeshGenerators.CreateRoundRect(Shape.Width, Shape.Height, Shape.Radius, Shape.Slices,
                                               Shape.UseUVSubRegion == true ?
                                               MeshGenerators.UVRegionType.CenteredUVRectangle : MeshGenerators.UVRegionType.FullUVSquare,
                                               Shape.RoundRectSharpCorners));
     }
     else
     {
         throw new Exception("HUDUtil.MakeBackgroundMesh: unknown shape type!");
     }
 }
Exemplo n.º 3
0
        // creates a button in the desired geometry shape
        public void Create()
        {
            entry = new GameObject(UniqueNames.GetNext("HUDTextEntry"));
            Mesh mesh = MeshGenerators.CreateTrivialRect(Width, Height, MeshGenerators.UVRegionType.FullUVSquare);

            backgroundMaterial       = MaterialUtil.CreateFlatMaterialF(BackgroundColor);
            activeBackgroundMaterial = MaterialUtil.CreateFlatMaterialF(ActiveBackgroundColor);
            bgMesh = AppendMeshGO("background", mesh, backgroundMaterial, entry);
            bgMesh.transform.Rotate(Vector3.right, -90.0f); // ??

            BoxPosition horzAlign = BoxPosition.CenterLeft;

            if (AlignmentHorz == HorizontalAlignment.Center)
            {
                horzAlign = BoxPosition.Center;
            }
            else if (AlignmentHorz == HorizontalAlignment.Right)
            {
                horzAlign = BoxPosition.CenterRight;
            }

            textMesh = GameObjectFactory.CreateTextMeshGO(
                "text", Text, TextColor, TextHeight, horzAlign, SceneGraphConfig.TextLabelZOffset);

            Vector2f toPos = BoxModel.GetBoxPosition(this, horzAlign);

            BoxModel.Translate(textMesh, Vector2f.Zero, toPos);

            AppendNewGO(textMesh, entry, false);

            cursor = GameObjectFactory.CreateRectangleGO("cursor", Height * 0.1f, Height * 0.8f, Colorf.VideoBlack, false);
            BoxModel.Translate(cursor, Vector2f.Zero, this.Bounds2D.CenterLeft, -Height * 0.1f);
            cursor.RotateD(Vector3f.AxisX, -90.0f);
            AppendNewGO(cursor, entry, false);
            cursor.SetVisible(false);
        }
Exemplo n.º 4
0
 fMesh make_background_mesh()
 {
     return(new fMesh(
                MeshGenerators.CreateTrivialRect(Width, Height, MeshGenerators.UVRegionType.FullUVSquare)));
 }