Example #1
0
        public void WinForm_LaunchSubPlatform(float xpos, float ypos)
        {
            if (!_pause)
            {
                DDDObjects obj = GetSelectedObject();
                if (obj != null)
                {
                    xpos = (xpos - Map.Position.X) / Scale;
                    ypos = (ypos - Map.Position.Y) / Scale;

                    if (obj.SubPlatforms != null)
                    {
                        if (obj.SubPlatforms.Length > 0)
                        {
                            if ((obj.CurrentSubplatform >= 0) && (obj.CurrentSubplatform < obj.SubPlatforms.Length))
                            {
                                if (!obj.IsWeapon)
                                {
                                    if (!DDD_Global.Instance.IsObserver && !DDD_Global.Instance.IsForkReplay)
                                    {
                                        double parentAltitude = 0.0;
                                        parentAltitude = obj.Altitude;
                                        Command.SubPlatformLaunch(obj.SubPlatforms[obj.CurrentSubplatform], obj.ObjectID, xpos, ypos, parentAltitude);
                                    }
                                }
                            }
                        }
                    }
                }


                Mode = MapModes.MOVE;
                Command.SelectionUpdate();
            }
        }
Example #2
0
 public void EnterMoveMode()
 {
     Mode = MapModes.MOVE;
     if (SelectionCount() > 1)
     {
         RemoveSelection(1, SelectionCount() - 1);
     }
 }
Example #3
0
        /// <summary>
        /// Function to get the kerning pairs for a font.
        /// </summary>
        /// <returns>A list of kerning pair values for the active font.</returns>
        public static KERNINGPAIR[] GetKerningPairs()
        {
            KERNINGPAIR[] pairs;

            if (_hdc == IntPtr.Zero)
            {
                throw new GorgonException(GorgonResult.CannotEnumerate, Resources.GORGFX_ERR_FONT_CANNOT_RETRIEVE_KERNING);
            }

            MapModes lastMode = SetMapMode(_hdc, MapModes.MM_TEXT);

            try
            {
                // Get the number of pairs.
                int size = (int)GetKerningPairsW(_hdc, 0, null);

                // If we have no pairs, then leave here.
                if (size == 0)
                {
                    return(Array.Empty <KERNINGPAIR>());
                }

                pairs = new KERNINGPAIR[size];
                KERNINGPAIR *pairPtr = stackalloc KERNINGPAIR[size];

                if (GetKerningPairsW(_hdc, (uint)size, pairPtr) == 0)
                {
                    throw new GorgonException(GorgonResult.CannotEnumerate, Resources.GORGFX_ERR_FONT_CANNOT_RETRIEVE_KERNING);
                }

                for (int i = 0; i < size; i++)
                {
                    pairs[i] = pairPtr[i];
                }
            }
            finally
            {
                SetMapMode(_hdc, lastMode);
            }

            return(pairs);
        }
Example #4
0
 public void EnterAttackMode()
 {
     Mode = MapModes.ATTACK;
 }
Example #5
0
        public override void OnMouseUp(object sender, MouseEventArgs e)
        {
            if (!ClientArea.Contains(e.X, e.Y))
            {
                return;
            }
            switch (e.Button)
            {
                case MouseButtons.Left:
                    if (!DrawDistanceLine)
                    {
                        Mode = MapModes.MOVE;
                        DDDObjects previous = this.GetSelectedObject();
                        if (!SelectSingle(e.X, e.Y))
                        {
                            DeselectAll();
                            DDD_Global.Instance.RangeFinderDistanceString = "";
                        }
                        DDDObjects current = GetSelectedObject();

                        if ((current == null) && (previous == null))
                        {
                            return;
                        }
                        if ((current != null) && (previous != null))
                        {
                            if (previous.ObjectID.CompareTo(current.ObjectID) == 0)
                            {
                                return;
                            }
                        }
                        DDD_Global.Instance.RangeFinderDistanceString = " ";
                        Command.SelectionUpdate();
                    }
                    break;
                case MouseButtons.Right:
                    switch (Mode)
                    {
                        case MapModes.MOVE:
                               MoveSelected(e.X, e.Y);
                            break;
                        case MapModes.ATTACK:
                            if (RightClickSelect(e.X, e.Y))
                            {
                                WinForm_AttackSelected();
                            }
                            break;
                        case MapModes.SUBPLATFORM:
                            if (!RightClickSelect(e.X, e.Y))
                            {
                                WinForm_LaunchSubPlatform(e.X, e.Y);
                            }
                            else
                            {
                                // Dock to selected subplatform
                                WinForm_DockToSelected();
                            }
                            break;
                    }

                    break;
            }
        }
Example #6
0
        public void WinForm_LaunchSubPlatform(float xpos, float ypos)
        {
            if (!_pause)
            {
                DDDObjects obj = GetSelectedObject();
                if (obj != null)
                {
                    xpos = (xpos - Map.Position.X) / Scale;
                    ypos = (ypos - Map.Position.Y) / Scale;

                    if (obj.SubPlatforms != null)
                    {
                        if (obj.SubPlatforms.Length > 0)
                        {
                            if ((obj.CurrentSubplatform >= 0) && (obj.CurrentSubplatform < obj.SubPlatforms.Length))
                            {
                                if (!obj.IsWeapon)
                                {
                                    if (!DDD_Global.Instance.IsObserver && !DDD_Global.Instance.IsForkReplay)
                                    {
                                        double parentAltitude = 0.0;
                                        parentAltitude = obj.Altitude;
                                        Command.SubPlatformLaunch(obj.SubPlatforms[obj.CurrentSubplatform], obj.ObjectID, xpos, ypos, parentAltitude);
                                    }
                                }
                            }
                        }
                    }
                }

                
                Mode = MapModes.MOVE;
                Command.SelectionUpdate();
            }
        }
Example #7
0
 public void EnterDrawMode()
 {
     Mode = MapModes.DRAW;
 }
Example #8
0
 public void EnterSubPlatformMode()
 {
     Mode = MapModes.SUBPLATFORM;
 }
Example #9
0
 public void EnterMoveMode()
 {
     Mode = MapModes.MOVE;
     if (SelectionCount() > 1)
     {
         RemoveSelection(1, SelectionCount() - 1);
     }
 }
Example #10
0
 public void EnterAttackMode()
 {
     Mode = MapModes.ATTACK;
 }
Example #11
0
        public override void OnMouseUp(object sender, MouseEventArgs e)
        {
            if (!ClientArea.Contains(e.X, e.Y))
            {
                return;
            }
            switch (e.Button)
            {
            case MouseButtons.Left:
                if (!DrawDistanceLine)
                {
                    Mode = MapModes.MOVE;
                    DDDObjects previous = this.GetSelectedObject();
                    if (!SelectSingle(e.X, e.Y))
                    {
                        DeselectAll();
                        DDD_Global.Instance.RangeFinderDistanceString = "";
                    }
                    DDDObjects current = GetSelectedObject();

                    if ((current == null) && (previous == null))
                    {
                        return;
                    }
                    if ((current != null) && (previous != null))
                    {
                        if (previous.ObjectID.CompareTo(current.ObjectID) == 0)
                        {
                            return;
                        }
                    }
                    DDD_Global.Instance.RangeFinderDistanceString = " ";
                    Command.SelectionUpdate();
                }
                break;

            case MouseButtons.Right:
                switch (Mode)
                {
                case MapModes.MOVE:
                    MoveSelected(e.X, e.Y);
                    break;

                case MapModes.ATTACK:
                    if (RightClickSelect(e.X, e.Y))
                    {
                        WinForm_AttackSelected();
                    }
                    break;

                case MapModes.SUBPLATFORM:
                    if (!RightClickSelect(e.X, e.Y))
                    {
                        WinForm_LaunchSubPlatform(e.X, e.Y);
                    }
                    else
                    {
                        // Dock to selected subplatform
                        WinForm_DockToSelected();
                    }
                    break;
                }

                break;
            }
        }
Example #12
0
 public void EnterDrawMode()
 {
     Mode = MapModes.DRAW;
 }
Example #13
0
 public void EnterSubPlatformMode()
 {
     Mode = MapModes.SUBPLATFORM;
 }
Example #14
0
 private static extern MapModes SetMapMode(IntPtr HDC, MapModes fnMapMode);