コード例 #1
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");
 }
コード例 #2
0
ファイル: SliderNode.cs プロジェクト: RobJellinghaus/Holofunk
        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];
        }
コード例 #3
0
        public TextSpriteNode(
            AParentSceneNode parent,
            Transform localTransform,
            string label,
            Texture2D background,
            Texture2D highlight)
            : base(parent, localTransform, label)
        {
            m_spriteNode = new SpriteNode(this, label + "_sprite", background);
            m_spriteNode.Origin = new Vector2(0.5f);

            m_textNode = new TextNode(this, label + "_text");
            m_textNode.Alignment = Alignment.Centered;
            m_textNode.Text.Append(label);
            m_textNode.LocalTransform = new Transform(Vector2.Zero, new Vector2(0.6f));

            m_highlightSpriteNode = new SpriteNode(this, label + "_highlight", highlight);
            m_highlightSpriteNode.Origin = new Vector2(0.5f);
        }
コード例 #4
0
ファイル: BeatNode.cs プロジェクト: RobJellinghaus/Holofunk
 public BeatNode(
     AParentSceneNode parent,
     Transform localTransform,
     string label,
     // are we filling in every beat, or just the current beat?
     bool fillInEveryBeat,
     // by how much do we scale down our texture when rendering a quarter note?
     float textureScale,
     Func<Duration<Sample>> trackLengthFunc,
     Func<int> initialBeatFunc,
     Func<Color> colorFunc)
     : base(parent, localTransform, label)
 {
     m_fillInEveryBeat = fillInEveryBeat;
     m_textureScale = textureScale;
     m_trackLengthFunc = trackLengthFunc;
     m_initialBeatFunc = initialBeatFunc;
     m_colorFunc = colorFunc;
 }
コード例 #5
0
ファイル: TrackNode.cs プロジェクト: RobJellinghaus/Holofunk
        internal TrackNode(
            AParentSceneNode parent,
            Transform transform,
            string label,
            TextureContent content,
            int id,
            SparseSampleByteStream videoStream,
            bool fillInEveryBeat,
            Func<float> levelRatioFunc,
            Func<Color> circleColorFunc,
            Func<Color> videoColorFunc,
            Func<Duration<Sample>> trackDurationFunc,
            Func<int> initialBeatFunc,
            Func<Color> beatColorFunc,
            Func<float> videoRateFunc)
            : base(parent, transform, label)
        {
            m_id = id;

            m_levelRatioFunc = levelRatioFunc;
            m_circleColorFunc = circleColorFunc;
            m_videoColorFunc = videoColorFunc;
            m_beatColorFunc = beatColorFunc;
            m_videoRateFunc = videoRateFunc;

            // create this first so it is Z-ordered behind m_soundNode
            m_selectNode = new SpriteNode(this, "TrackHighlight", content.FilledCircle);
            m_selectNode.Color = new Color((byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80);
            m_selectNode.Origin = new Vector2(0.5f);

            m_soundNode = new SpriteNode(this, "TrackSound", content.FilledCircle);
            m_soundNode.Color = Color.Blue;
            m_soundNode.Origin = new Vector2(0.5f);

            m_videoNode = new SpriteNode(this, "Headshot", content.NewDynamicTexture(MagicNumbers.HeadCaptureSize, MagicNumbers.HeadCaptureSize));
            m_videoNode.Origin = new Vector2(0.5f);
            m_videoNode.LocalTransform = new Transform(new Vector2(0), new Vector2(MagicNumbers.HeadRatio));
            m_videoNode.SetSecondaryViewOption(SecondaryViewOption.TextureMirrored);

            m_videoStream = videoStream;

            m_beatNode = new BeatNode(
                this,
                // move it down a bit from the sprite node
                new Transform(new Vector2(0, 75)),
                "TrackBeats",
                fillInEveryBeat,
                MagicNumbers.MeasureCircleScale,
                trackDurationFunc,
                initialBeatFunc,
                beatColorFunc);

            m_beatNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored);

            // we always mirror track node position
            SetSecondaryViewOption(SecondaryViewOption.PositionMirrored);

            m_lastVideoFrame = default(Slice<Frame, byte>);
        }
コード例 #6
0
 protected AParentSceneNode(AParentSceneNode parent, Transform localTransform, string label)
     : base(parent, localTransform, label)
 {
 }
コード例 #7
0
ファイル: TextNode.cs プロジェクト: RobJellinghaus/Holofunk
 public TextNode(AParentSceneNode parent, string label)
     : base(parent, Transform.Identity, label)
 {
     m_text = new StringBuilder();
 }
コード例 #8
0
ファイル: LineNode.cs プロジェクト: RobJellinghaus/Holofunk
 public LineNode(AParentSceneNode parent, string label)
     : base(parent, Transform.Identity, label)
 {
 }
コード例 #9
0
 TextNode[] MakeEffectLabels(AParentSceneNode group)
 {
     TextNode[] ret = new TextNode[4];
     ret[0] = MakeEffectLabel(group, m_parent.HandDiameter / 2, 0, 0, false);
     ret[1] = MakeEffectLabel(group, 0, -m_parent.HandDiameter / 2, Math.PI * 3 / 2, false);
     ret[2] = MakeEffectLabel(group, -m_parent.HandDiameter / 2, 0, 0, true);
     ret[3] = MakeEffectLabel(group, 0, m_parent.HandDiameter / 2, Math.PI / 2, false);
     return ret;
 }
コード例 #10
0
 TextNode MakeEffectLabel(AParentSceneNode group, float x, float y, double rotation, bool rightJustified)
 {
     TextNode ret = new TextNode(group, "");
     ret.LocalTransform = new Transform(new Vector2(x, y), new Vector2(MagicNumbers.EffectTextScale));
     ret.Rotation = (float)rotation;
     if (rightJustified) {
         ret.Alignment = Alignment.TopRight;
     }
     return ret;
 }
コード例 #11
0
ファイル: GroupNode.cs プロジェクト: RobJellinghaus/Holofunk
 public GroupNode(AParentSceneNode parent, Transform localTransform, string label)
     : base(parent, localTransform, label)
 {
 }
コード例 #12
0
ファイル: SpriteNode.cs プロジェクト: RobJellinghaus/Holofunk
 public SpriteNode(AParentSceneNode parent, string label, Texture2D texture)
     : base(parent, Transform.Identity, label)
 {
     m_texture = texture;
 }