internal PlayerEffectSpaceSceneGraph(PlayerHandSceneGraph parent, PlayerEffectSpaceModel model)
            : base()
        {
            m_parent = parent;
            m_model = model;

            RootNode = new GroupNode(parent.RootNode, Transform.Identity, "EffectSpace");
            // TODO: this should really use the starting drag location as its translation, and the rest of this too
            RootNode.LocalTransform = Transform.Identity;

            // We preallocate our big circle.
            m_boundingCircleNode = new SpriteNode(RootNode, "bounding circle", parent.Content.HollowCircle);
            m_boundingCircleNode.LocalTransform = new Transform(
                Vector2.Zero, new Vector2(MagicNumbers.EffectSpaceBoundingCircleMultiple * (1 / MagicNumbers.EffectSpaceBoundingCircleSize)));
            m_boundingCircleNode.Color = new Color(0, 0, 0, 0);
            m_boundingCircleNode.Origin = new Vector2(0.5f);
            m_boundingCircleNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored);

            m_effectKnobLineNode = new LineNode(RootNode, "effect line");
            m_effectKnobLineNode.Color = new Color(0, 0, 0, 0);
            m_effectKnobLineNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored);

            m_effectKnobNode = new SpriteNode(RootNode, "effect knob", parent.Content.FilledCircle);
            m_effectKnobNode.Origin = new Vector2(0.5f);
            m_effectKnobNode.LocalTransform = new Transform(Vector2.Zero, new Vector2(MagicNumbers.EffectSpaceKnobMultiple));
            m_effectKnobNode.Color = new Color(0, 0, 0, 0);
            m_effectKnobNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored);
        }
Example #2
0
 public RectangleNode(AParentSceneNode parent, string label)
     : base(parent, Transform.Identity, label)
 {
     m_top = new LineNode(this, label + " top line");
     m_left = new LineNode(this, label + " left line");
     m_right = new LineNode(this, label + " right line");
     m_bottom = new LineNode(this, label + " bottom line");
 }
Example #3
0
        public SliderNode(
            AParentSceneNode parent,
            Transform localTransform,
            // what parameter does this slider drag?
            Parameter parameter,
            // at what angle is the slider oriented?
            float rotation,
            // how long is the slider in screen space?
            int screenLength,
            // how far is the slider's origin from the transform's translation, in screen space?
            int originScreenOffset,
            // what is the slider's label?
            string label)
            : base(parent, localTransform, label)
        {
            m_parameter = parameter;
            m_rotation = rotation;
            m_screenLength = screenLength;
            m_originScreenOffset = originScreenOffset;

            // calculate the endpoints
            m_zeroEnd = ValueToLocal(0);
            m_oneEnd = ValueToLocal(1);

            double absRotation = Math.IEEERemainder(rotation, Math.PI * 2);
            if (absRotation < 0) {
                absRotation += Math.PI * 2;
            }

            m_label = new TextNode(this, label + "_text");

            bool overPi = absRotation > Math.PI;

            m_label.Alignment = overPi ? Alignment.TopLeft : Alignment.TopRight;
            m_label.Text.Append(label);
            m_label.LocalTransform = new Transform(m_oneEnd, new Vector2(0.7f));
            // seems the line rotation and label rotation go in opposite directions, feh!
            m_label.Rotation = -rotation + (float)(Math.PI / 2) + (overPi ? (float)Math.PI : 0);

            m_fullLine = new LineNode(this, "fullLine");
            m_fullLine.SetEndpoints(m_zeroEnd, m_oneEnd);

            m_sliderLine = new LineNode(this, "sliderLine");
            m_sliderLine.LocalTransform = new Transform(Vector2.Zero, new Vector2(3f)); // 3-pixel wide line

            Value = m_parameter[0];
        }