Exemplo n.º 1
0
        //have to add new entry for GL Circle to draw sensor bubbles around taskgroups/populations/missile contacts
        //CircleElement has the circle in it already, but that might be inappropriate for what I want
        //SceenElement has the lable properly done.

        public SensorElement(GLEffect a_oDefaultEffect, Vector3 a_oPosition, float a_fRadius, System.Drawing.Color a_oColor, String LabelText, GameEntity Ent, ComponentTypeTN SType, Sceen ParentSceenArg)
            : base()
        {
            _ParentSceen = ParentSceenArg;

            _DisplayRadius = a_fRadius;

            m_oPrimaryPrimitive = new GLCircle(a_oDefaultEffect,
                                               a_oPosition,
                                               a_fRadius,
                                               a_oColor,
                                               UIConstants.Textures.DEFAULT_TEXTURE);

            m_lPrimitives.Add(m_oPrimaryPrimitive);

            int     LabelMid = LabelText.Length / 4;
            float   xAdjust  = -LabelMid * (UIConstants.DEFAULT_TEXT_SIZE.X / _ParentSceen.ZoomSclaer);
            float   yAdjust  = 10.0f / ParentSceenArg.ZoomSclaer;
            Vector3 LPos     = new Vector3(xAdjust, (a_fRadius + yAdjust), 0.0f);

            LPos       = LPos + a_oPosition;
            Lable      = new GLUtilities.GLFont(a_oDefaultEffect, LPos, UIConstants.DEFAULT_TEXT_SIZE, a_oColor, UIConstants.Textures.DEFAULT_GLFONT2, LabelText);
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / ParentSceenArg.ZoomSclaer;
            SetActualPosition(a_oPosition);

            SceenEntity = Ent;
            _SensorType = SType;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a survey element by making a default circle element, then creating the GLCircle, and then adding this to the parent element list.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="oSurveyPoint"></param>
        /// <param name="a_oDefaultEffect"></param>
        /// <param name="SPIndex"></param>
        private void CreateSurveyPoint(SceenElement parent, SurveyPoint oSurveyPoint, GLEffect a_oDefaultEffect, int SPIndex)
        {
            Vector3 v3SPPos = new Vector3((float)oSurveyPoint.Position.X, (float)oSurveyPoint.Position.Y, 0.0f);

            CircleElement oSurveyPointElement = new CircleElement();

            oSurveyPointElement.EntityID = oSurveyPoint.Id;

            GLCircle oSPCircle = new GLCircle(a_oDefaultEffect,
                                              v3SPPos,
                                              4.0f / m_fZoomScaler,
                                              Color.White,
                                              UIConstants.Textures.DEFAULT_TEXTURE);


            GLUtilities.GLFont oNameLable = new GLUtilities.GLFont(SceenDefaultEffect, v3SPPos,
                                                                   UIConstants.DEFAULT_TEXT_SIZE, Color.White, UIConstants.Textures.DEFAULT_GLFONT2, SPIndex.ToString());

            oSurveyPointElement._isSurveyPoint   = true;
            oSurveyPointElement.Lable            = oNameLable;
            oSurveyPointElement.Lable.Size       = UIConstants.DEFAULT_TEXT_SIZE / m_fZoomScaler; //Initial taskgroup names weren't being scaled properly for whatever reason.
            oSurveyPointElement.RealSize         = new Vector2(0.0001f, 0.0001f) / m_fZoomScaler;
            oSurveyPointElement.PrimaryPrimitive = oSPCircle;
            oSurveyPointElement.AddPrimitive(oSPCircle);
            parent.AddChildElement(oSurveyPointElement);
        }
Exemplo n.º 3
0
        public CircleElement(GLEffect a_oDefaultEffect, Vector3 a_oPosition, OrbitingEntity a_oOrbitEntity, System.Drawing.Color a_oColor)
            : base()
        {
            m_oPrimaryPrimitive = new GLCircle(a_oDefaultEffect,
                                               a_oPosition,
                                               a_oOrbitEntity,
                                               a_oColor,
                                               UIConstants.Textures.DEFAULT_TEXTURE);

            m_lPrimitives.Add(m_oPrimaryPrimitive);
        }
Exemplo n.º 4
0
        /// <summary>
        /// SetActualPosition casts the primary primitive as a circle, tests to see if it exists, and moves it.
        /// </summary>
        /// <param name="a_v3Pos">Position to move this circle element to.</param>
        private void SetActualPosition(Vector3 a_v3Pos)
        {
            GLCircle temp = this.PrimaryPrimitive as GLCircle;

            if (temp != null)
            {
                temp.Position = a_v3Pos;

                /// <summary>
                /// Have to call this to get openGL to update temps position.
                /// </summary>
                temp.RecalculateModelMatrix();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// SetActualPosition casts the primary primitive as a circle, tests to see if it exists, and moves it.
        /// </summary>
        /// <param name="a_v3Pos">Position to move this circle element to.</param>
        public void SetActualPosition(Vector3 a_v3Pos)
        {
            GLCircle temp = this.PrimaryPrimitive as GLCircle;

            if (temp != null)
            {
                temp.Position = a_v3Pos;
                int     LabelMid = Lable.Text.Length / 4;
                float   xAdjust  = -LabelMid * (UIConstants.DEFAULT_TEXT_SIZE.X / _ParentSceen.ZoomSclaer);
                float   yAdjust  = 10.0f / _ParentSceen.ZoomSclaer;
                Vector3 LPos     = new Vector3(xAdjust, (_DisplayRadius + yAdjust), 0.0f);
                Lable.Position = temp.Position + LPos;

                /// <summary>
                /// Have to call this to get openGL to update temps position.
                /// </summary>
                temp.RecalculateModelMatrix();
            }
        }
Exemplo n.º 6
0
        public override void Refresh(float a_fZoomScaler)
        {
            if (_IsSurveyPoint == true)
            {
                Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / a_fZoomScaler;
                RealSize   = new Vector2(0.0001f, 0.0001f) / a_fZoomScaler;

                GLCircle temp = this.PrimaryPrimitive as GLCircle;
                if (temp != null)
                {
                    temp.ChangeRadius(4.0f / a_fZoomScaler);
                }
            }
            // loop through any children:
            foreach (SceenElement oElement in m_lChildren)
            {
                oElement.Refresh(a_fZoomScaler);
            }
        }