Exemplo n.º 1
0
 /// <summary>
 /// Fetch data from barometer sensor from NAZE FULL AFRO FLIGHT
 /// </summary>
 private void DrawRegion_1(GameTime gameTime, SpriteBatch spriteBatch)
 {
     #region "REGION 1 ALTIMETER AKA ALTITUDE METER"
     xnaDrawPanel.GraphicsDevice.Viewport = v1;
     //********************HUD********************
     int W = xnaDrawPanel.GraphicsDevice.Viewport.Width, H = xnaDrawPanel.GraphicsDevice.Viewport.Height;
     //********************HUD********************
     spriteBatch.Begin();
     //Base Background Image
     int pointer_X = (W / 2) - (H / 2), pointer_Y = 4, adjWidth = H - 4, adjHeight = H - 8;
     spriteBatch.Draw(IMAGELIST[7], new Rectangle(0, 0, W, H), Color.Purple);
     XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, xnaDrawPanel.QuartzMSFont, Math.Round(AltiValue, 2).ToString() + "  FT", new Rectangle(pointer_X, pointer_Y, H, H), Color.White);
     spriteBatch.DrawString(xnaDrawPanel.HUDfont, "A-Meter 1", new Vector2(2, 0), Color.White);
     spriteBatch.End();
     #endregion
 }
Exemplo n.º 2
0
        /// <summary>
        /// CAPTURE ALL SENSOR DATA AND DRAW MAIN HUD
        /// </summary>
        private void DrawRegion_4(GameTime gameTime, SpriteBatch spriteBatch)
        {
            #region "REGION 4 MAIN FEEDBACK"
            xnaDrawPanel.GraphicsDevice.Viewport = v4;
            //********************HUD********************
            spriteBatch.Begin();

            //Draw Capture Image
            DrawCaptureImage(gameTime, spriteBatch);
            //HUD TITLE
            spriteBatch.DrawString(xnaDrawPanel.HUDfont, "MAIN HUD 4", new Vector2(0, 0), Color.Black);
            //ARMED SIGN
            String armString = "NOT ARMED";
            if (isArmed)
            {
                armString = "ARMED"; if (tcpCore != null)
                {
                    armString += tcpCore.ConnectionStatus;
                }
            }
            Rectangle aRect = new Rectangle(0, v4.Height - (v4.Height / 20), v4.Width, v4.Height / 20);
            XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, xnaDrawPanel.ArialFont, armString, aRect, Color.DarkRed);
            spriteBatch.Draw(IMAGELIST[5], aRect, Color.FromNonPremultiplied(10, 255, 10, 20));

            String camString = "Cam Off";
            if (isCapture)
            {
                camString = "Cam On";
            }
            Rectangle bRect = new Rectangle(0, 0, v4.Width, v4.Height / 20);
            XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, xnaDrawPanel.ArialFont, camString, bRect, Color.DarkRed);
            spriteBatch.Draw(IMAGELIST[5], bRect, Color.FromNonPremultiplied(10, 255, 10, 20));

            if (ISHUDON)
            {
                DrawRollHUD(gameTime, spriteBatch);
                DrawAuxHUD(gameTime, spriteBatch);
                ThrottleBar.Draw(gameTime, spriteBatch);
                ElevatorBar.Draw(gameTime, spriteBatch);
                RudderBar.Draw(gameTime, spriteBatch);
                AileronBar.Draw(gameTime, spriteBatch);
            }
            spriteBatch.End();
            #endregion
        }
Exemplo n.º 3
0
        private void DrawVerticalBar(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Bar_V, barBox, Color.White);
            Rectangle tempP = new Rectangle(0, 0, Pointer.Width, Pointer.Height);

            if (pointerAlign == PointerAlign.Left)
            {
                spriteBatch.Draw(Pointer, pointerBox, tempP, Color.White, MathHelper.ToRadians(270), new Vector2(tempP.Center.X, tempP.Center.Y), SpriteEffects.None, 0);
            }
            else if (pointerAlign == PointerAlign.Right)
            {
                spriteBatch.Draw(Pointer, pointerBox, tempP, Color.White, MathHelper.ToRadians(90), new Vector2(tempP.Center.X, tempP.Center.Y), SpriteEffects.None, 0);
            }
            spriteBatch.Draw(TestBack, fontBox, Color.FromNonPremultiplied(0, 255, 0, 40));
            XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, HUD_FONT, CURRENTValue.ToString(), fontBox, Color.Black);

            Rectangle rect = new Rectangle(barBox.X - (int)HUD_FONT.MeasureString(BarName).X / 2, barBox.Y - (int)HUD_FONT.MeasureString(BarName).Y, (int)HUD_FONT.MeasureString(BarName).X, (int)HUD_FONT.MeasureString(BarName).Y);

            spriteBatch.Draw(TestBack, rect, Color.FromNonPremultiplied(0, 255, 0, 40));
            XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, HUD_FONT, BarName, rect, Color.Black);
        }
Exemplo n.º 4
0
        private void DrawRollHUD(GameTime gameTime, SpriteBatch spriteBatch)
        {
            int W = xnaDrawPanel.GraphicsDevice.Viewport.Width, H = xnaDrawPanel.GraphicsDevice.Viewport.Height;
            //ALGLE BAR -------------------->
            int ref_anglebar_adjWidth, ref_anglebar_adjHeight;
            {
                //DRONE_ANGLE += 1;//FROM ANGLE
                //original width ,height
                int     orgWidth = IMAGELIST[0].Width, orgHeight = IMAGELIST[0].Height;
                decimal adjWidthAngle, adjHeightAngle;
                adjWidthAngle  = W / 4;
                adjHeightAngle = Math.Round(decimal.Divide(adjWidthAngle, decimal.Divide(orgWidth, orgHeight)), 4);
                //Position
                int angle_X, angle_Y;
                angle_X = (int)((W / 2));
                angle_Y = (H / 2);
                Vector2 centerPivot = new Vector2((float)orgWidth / 2, (float)orgHeight / 2);

                ref_anglebar_adjWidth = (int)adjWidthAngle; ref_anglebar_adjHeight = (int)adjHeightAngle;

                spriteBatch.Draw(IMAGELIST[0], new Rectangle(angle_X, angle_Y, (int)adjWidthAngle, (int)adjHeightAngle), new Rectangle(0, 0, orgWidth, orgHeight), HUD_GUI_ANGLE_MASK_COLOR, MathHelper.ToRadians(DRONE_ANGLE), centerPivot, SpriteEffects.None, 1);
            }
            //POINTER
            {
                int     orgWidth = IMAGELIST[1].Width, orgHeight = IMAGELIST[1].Height;
                decimal adjWidthPointer, adjHeightPointer;
                adjWidthPointer  = W / 60;
                adjHeightPointer = Math.Round(decimal.Divide(adjWidthPointer, decimal.Divide(orgWidth, orgHeight)), 4);

                int pointer_X, pointer_Y;
                pointer_X = (W / 2) - ((int)adjWidthPointer / 2);
                pointer_Y = (H / 2) - ((int)adjHeightPointer) - (ref_anglebar_adjHeight / 2);
                spriteBatch.Draw(IMAGELIST[1], new Rectangle(pointer_X, pointer_Y, (int)adjWidthPointer, (int)adjHeightPointer), HUD_GUI_ANGLE_MASK_COLOR);

                Rectangle fontBox = new Rectangle(pointer_X + (int)adjWidthPointer, pointer_Y, DRONE_ANGLE.ToString().Length *(int)adjWidthPointer, (int)adjHeightPointer);
                spriteBatch.Draw(IMAGELIST[5], fontBox, Color.FromNonPremultiplied(0, 255, 0, 40));
                XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, CSM_Font, DRONE_ANGLE.ToString() + ".d", fontBox, Color.Black);
            }
        }
Exemplo n.º 5
0
        private void DrawAuxHUD(GameTime gameTime, SpriteBatch spriteBatch)
        {
            int X = xnaDrawPanel.GraphicsDevice.Viewport.Width - xnaDrawPanel.GraphicsDevice.Viewport.Width / 4;
            int Y = xnaDrawPanel.GraphicsDevice.Viewport.Height / 2 - xnaDrawPanel.GraphicsDevice.Viewport.Height / 8;

            int boxWidth  = xnaDrawPanel.GraphicsDevice.Viewport.Width / 40;
            int boxHeight = boxWidth;

            int marginBelow = xnaDrawPanel.GraphicsDevice.Viewport.Height / 60;

            for (int i = 0; i < 4; i++)
            {
                Rectangle rect = new Rectangle(X, Y + (i * (boxHeight + marginBelow)), boxWidth, boxHeight);
                Rectangle rectString = new Rectangle(rect.X + rect.Width + 10, rect.Y - rect.Height / 2, rect.Width * 3, rect.Height * 2);
                Rectangle rectCheck = new Rectangle(0, 0, 64, 64), rectUnCheck = new Rectangle(64, 0, 64, 64), rectList = new Rectangle(128, 0, 64, 64);

                String label = "";
                if (Buttons_X == true && i == 1)
                {
                    spriteBatch.Draw(IMAGELIST[10], rect, rectCheck, Color.FromNonPremultiplied(0, 255, 0, 130));
                }
                else if (Buttons_A == true && i == 2)
                {
                    spriteBatch.Draw(IMAGELIST[10], rect, rectCheck, Color.FromNonPremultiplied(0, 255, 0, 130));
                }
                else if (Buttons_B == true && i == 3)
                {
                    spriteBatch.Draw(IMAGELIST[10], rect, rectCheck, Color.FromNonPremultiplied(0, 255, 0, 130));
                }
                else
                {
                    if (i == 0)
                    {
                        if (AuxMode == 1)
                        {
                            spriteBatch.Draw(IMAGELIST[10], rect, rectList, Color.FromNonPremultiplied(0, 0, 255, 130));
                        }
                        else if (AuxMode == 2)
                        {
                            spriteBatch.Draw(IMAGELIST[10], rect, rectList, Color.FromNonPremultiplied(0, 255, 0, 130));
                        }
                        else if (AuxMode == 3)
                        {
                            spriteBatch.Draw(IMAGELIST[10], rect, rectList, Color.FromNonPremultiplied(255, 0, 0, 130));
                        }
                        else if (AuxMode == 4)
                        {
                            spriteBatch.Draw(IMAGELIST[10], rect, rectList, Color.FromNonPremultiplied(255, 255, 0, 130));
                        }
                    }
                    else
                    {
                        spriteBatch.Draw(IMAGELIST[10], rect, rectUnCheck, Color.FromNonPremultiplied(255, 0, 0, 130));
                    }
                }
                if (i == 0)
                {
                    label = "AUX { " + AuxMode + " } [Y]";
                }
                else if (i == 1)
                {
                    label = "In { " + AUXL + " } [X]";
                }
                else if (i == 2)
                {
                    label = "In { " + AUXM + " } [A]";
                }
                else if (i == 3)
                {
                    label = "In { " + AUXH + " } [B]";
                }
                XNADrawPanel.DrawStringUsingRectangleBox(spriteBatch, xnaDrawPanel.ArialFont, label, rectString, Color.FromNonPremultiplied(255, 255, 255, 150));
            }
        }