Пример #1
0
        private void BitmapWidget_LoadBitmap(HaloHud.BitmapWidgetProperties widget)
        {
            //Prepare
            Bitmap map = null;

            //Get Tag
            if (widget.BitmapTag != null && Map.IndexEntries[widget.BitmapTag.ID].Root == HaloTags.bitm)
            {
                if (widget.FullscreenSequenceIndex != byte.MaxValue)
                {
                    using (HaloBitmap bitmap = new HaloBitmap(Map.IndexEntries[widget.BitmapTag.ID]))
                    {
                        //Get Widget Bitmap
                        if (widget.FullscreenSequenceIndex < bitmap.BitmapCount)
                        {
                            map = bitmap[widget.FullscreenSequenceIndex, 0, 0];
                        }
                        if (widget.FullscreenSequenceIndex < bitmap.SequenceCount)
                        {
                            map = bitmap[bitmap.Sequences[widget.FullscreenSequenceIndex].Index, 0, 0];
                        }

                        //Clone
                        map = (Bitmap)map.Clone();
                    }
                }
            }

            //Add
            hudBitmaps.Add(widget, map);
        }
Пример #2
0
            /// <summary>
            /// Initializes a new <see cref="SequenceProperties"/> instance using the supplied <see cref="HaloBitmap"/> instance and sequence index.
            /// </summary>
            /// <param name="bitmap">The Halo 2 bitmap instance.</param>
            /// <param name="index">The sequence index within the bitmap tag.</param>
            /// <exception cref="ArgumentNullException"><paramref name="bitmap"/> is null.</exception>
            /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> it outside of valid range.</exception>
            public SequenceProperties(HaloBitmap bitmap, int index)
            {
                //Check
                if (bitmap == null)
                {
                    throw new ArgumentNullException(nameof(bitmap));
                }
                if (index < 0 || bitmap.SequenceCount <= index)
                {
                    throw new ArgumentOutOfRangeException(nameof(index));
                }

                this.bitmap = bitmap;
                this.index  = index;
            }