示例#1
0
        /// <summary>
        /// Gets the input state of the given type for the given view.
        /// </summary>
        /// <param name="viewInfo">The view for which to get the requested input state object</param>
        public T?TryGetState <T>(ViewInformation viewInfo)
            where T : InputStateBase
        {
            viewInfo.EnsureNotNull(nameof(viewInfo));

            var inputStateCount = _inputStates.Count;

            for (var loop = 0; loop < inputStateCount; loop++)
            {
                var actStateCasted = _inputStates[loop] as T;
                if (actStateCasted == null)
                {
                    continue;
                }

                if (actStateCasted.RelatedView != viewInfo)
                {
                    continue;
                }

                return(actStateCasted);
            }

            return(null);
        }
示例#2
0
        /// <summary>
        /// Tries to get the bounding box for the given render-loop.
        /// Returns BoundingBox.Empty if it is not available.
        /// </summary>
        /// <param name="viewInfo">The ViewInformation for which to get the BoundingBox.</param>
        public override BoundingBox TryGetBoundingBox(ViewInformation viewInfo)
        {
            viewInfo.EnsureNotNull(nameof(viewInfo));

            var device = viewInfo.Device;

            device.EnsureNotNull(nameof(device));

            var geometryResource = this.TryGetGeometryResource(device !);

            if (geometryResource is { IsLoaded : true })
示例#3
0
        /// <summary>
        /// Gets all input state for the given view.
        /// </summary>
        /// <param name="viewInfo">The view for which to get all input states.</param>
        public IEnumerable <InputStateBase> GetInputStates(ViewInformation viewInfo)
        {
            viewInfo.EnsureNotNull(nameof(viewInfo));

            var inputStateCount = _inputStates.Count;

            for (var loop = 0; loop < inputStateCount; loop++)
            {
                if (_inputStates[loop].RelatedView == viewInfo)
                {
                    yield return(_inputStates[loop]);
                }
            }
        }