예제 #1
0
 public unsafe ObsSceneItem(ObsSceneItem sceneItem)
     : this(sceneItem.instance)
 {
 }
예제 #2
0
 public unsafe ObsSceneItem(ObsSceneItem sceneItem)
     : this(sceneItem.instance)
 {
 }
예제 #3
0
        private bool DrawSelectedItem(ObsScene scene, ObsSceneItem item, IntPtr data)
        {
            if (!item.Selected)
                return true;

            GS.LoadVertexBuffer(boxPrimitive);
            libobs.matrix4 boxTransform = item.BoxTransform;

            DrawOutline(boxTransform, item.Width, item.Height, 5.0f);

            return true;
        }
예제 #4
0
        private void SetHoveredItem(ObsSceneItem item)
        {
            if (hoveredItem != null)
                hoveredItem.Dispose();

            hoveredItem = item;
        }
예제 #5
0
        public TestTransform(ObsSceneItem item)
        {
            InitializeComponent();

            // Store scene item
            _selectedItem = item;

            // Set minmax on numerics
            // the rendercontext minmax are bigger than the decimal one so this is fine
            const decimal min = decimal.MinValue;
            const decimal max = decimal.MaxValue;

            xNumeric.Minimum = min;
            xNumeric.Maximum = max;

            yNumeric.Minimum = min;
            yNumeric.Maximum = max;

            wNumeric.Minimum = min;
            wNumeric.Maximum = max;

            hNumeric.Minimum = min;
            hNumeric.Maximum = max;

            // Populate Controls

            // Position
            _oldPos = _selectedItem.Position;
            xNumeric.Value = (decimal)_oldPos.x;
            yNumeric.Value = (decimal)_oldPos.y;

            // Scale
            _oldScale = _selectedItem.Scale;
            wNumeric.Value = (decimal)_oldScale.x;
            hNumeric.Value = (decimal)_oldScale.y;

            // Rotation
            _oldRot = _selectedItem.Rotation;
            Rotation.Rotation = (int)Math.Round(_oldRot);

            // Alignment
            _oldAlignment = _selectedItem.Alignment;
            Alignment.Alignment = _oldAlignment;

            // Delegates to change transform properties
            xNumeric.ValueChanged += (sender, args) => _selectedItem.Position = ItemPosition;
            yNumeric.ValueChanged += (sender, args) => _selectedItem.Position = ItemPosition;

            wNumeric.ValueChanged += (sender, args) => _selectedItem.Scale = ItemScale;
            hNumeric.ValueChanged += (sender, args) => _selectedItem.Scale = ItemScale;

            // These even handlers return the exact value we need
            // Do this in the future for all custom even handlers
            // Makes creating inline event handlers a breeze!
            Rotation.RotationChanged += rotation => _selectedItem.Rotation = rotation;

            Alignment.AlignmentChanged += alignment => _selectedItem.Alignment = alignment;

            // Close form methods

            okButton.Click += (sender, args) => Close();
            cancelButton.Click += (sender, args) =>
            {
                _selectedItem.Position = _oldPos;
                _selectedItem.Scale = _oldScale;
                _selectedItem.Rotation = _oldRot;
                _selectedItem.Alignment = _oldAlignment;

                Close();
            };
        }