示例#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
        private Point Widget_GetFullscreenLocation(Bitmap bitmap, HaloHud.BitmapWidgetProperties widgetProperties)
        {
            //Initialize
            int x = widgetProperties.FullscreenPositionOffset.X, y = widgetProperties.FullscreenPositionOffset.Y;

            //Adjust based on anchor
            switch (widgetProperties.Anchor)
            {
            case Halo2.Anchor.HealthAndShield:
                x += 592;
                y += 36;
                break;

            case Halo2.Anchor.WeaponHud:
                x += 48;
                y += 36;
                break;

            case Halo2.Anchor.MotionSensor:
                x += 48;
                y += 444;
                break;

            case Halo2.Anchor.Scoreboard:
                x += 592;
                y += 444;
                break;

            case Halo2.Anchor.Crosshair:
                x += 320;
                y += 284;
                break;

            case Halo2.Anchor.LockOnTarget:
                x += 320;
                y += 60;
                break;
            }

            //Registration Point
            x -= (int)(bitmap.Width * widgetProperties.FullscreenRegistrationPoint.X);
            y -= (int)(bitmap.Height * widgetProperties.FullscreenRegistrationPoint.Y);

            //Return
            return(new Point(x, y));
        }
示例#3
0
        private Size Widget_GetSize(Bitmap bitmap, HaloHud.BitmapWidgetProperties widgetProperties)
        {
            //Get width and height
            int cx = bitmap.Width, cy = bitmap.Height;

            //Check Flags
            if (widgetProperties.Flags.HasFlag(DrawFlags.MirrorX))
            {
                cx *= 2;
            }
            if (widgetProperties.Flags.HasFlag(DrawFlags.MirrorY))
            {
                cy *= 2;
            }

            //Return
            return(new Size(cx, cy));
        }
示例#4
0
        private void HudBox_MouseMove(object sender, MouseEventArgs e)
        {
            //Check
            if (widgetComboBox.SelectedItem != null && widgetComboBox.SelectedItem is HaloHud.BitmapWidgetProperties)
            {
                //Get Bitmap Widget
                HaloHud.BitmapWidgetProperties widget = (HaloHud.BitmapWidgetProperties)widgetComboBox.SelectedItem;

                //Check
                Point widgetLocation = Widget_GetFullscreenLocation(hudBitmaps[widget], widget);
                Size  widgetSize     = Widget_GetSize(hudBitmaps[widget], widget);

                //Check
                if (e.X >= widgetLocation.X && e.X < widgetLocation.X + widgetSize.Width && e.Y >= widgetLocation.Y && e.Y < widgetLocation.Y + widgetSize.Height)
                {
                    //Set Cursor
                    hudBox.Cursor = Cursors.SizeAll;

                    //Check
                    if (e.Button == MouseButtons.Left)
                    {
                        Point newPoint    = new Point(e.X - previousMouseLocation.X, e.Y - previousMouseLocation.Y);
                        Point widgetPoint = new Point(widget.FullscreenPositionOffset.X + newPoint.X, widget.FullscreenPositionOffset.Y + newPoint.Y);
                        widget.FullscreenPositionOffset = widgetPoint;
                        HudBox_DrawHud();
                    }
                }
                else
                {
                    hudBox.Cursor = Cursors.Default;
                }
            }

            //Set
            previousMouseLocation = e.Location;
        }