Exemple #1
0
        //  Returns true or false to let child implementation know if it has to run its own version of draw.
        public virtual bool Draw()
        {
            //  This is just background of the screen rectangle
            if ((m_backgroundColor.HasValue) && (m_size.HasValue))
            {
                //  Background texture
                if (m_backgroundTexture == null)
                {
                    if (m_size.HasValue)
                    {
                        //  If this screen doesn't have custom texture, we will use one of the default - but with respect to screen's aspect ratio
                        m_backgroundTexture = MyGuiManager.GetBackgroundTextureFilenameByAspectRatio(m_size.Value);
                    }
                }

                MyGuiManager.DrawSpriteBatch(m_backgroundTexture, m_position, m_size.Value, ApplyTransitionAlpha(m_backgroundColor.Value), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                //if (MyFakes.DRAW_GUI_SCREEN_BORDERS && MyFinalBuildConstants.IS_DEBUG)
                //{
                //    MyGuiManager2.DrawBorders(GetPositionAbsoluteTopLeft(), m_size.Value, Color.White, 1);
                //}
            }

            DrawElements(m_transitionAlpha);
            DrawControls(m_transitionAlpha);
            return(true);
        }
Exemple #2
0
        //  Returns true or false to let child implementation know if it has to run its own version of draw.
        public virtual bool Draw(float backgroundFadeAlpha)
        {
            //  If this screen has focus and there are other screens too, draw large black-transparent rectangle below it, so all other screens will look darker
            //  Only one screen can draw this sort of background, and it is always top-most screen!
            //if ((hasFocus == true) && (MyGuiManager.GetScreensCount() > 1))
            //if (MyGuiManager.GetScreensCount() > 1)
            if (backgroundFadeAlpha > 0)
            {
                Vector4 fadeColorVec = m_backgroundFadeColor;
                fadeColorVec.W *= backgroundFadeAlpha;
                if (m_backgroundColor.HasValue)
                {
                    fadeColorVec.X *= m_backgroundColor.Value.X;
                    fadeColorVec.Y *= m_backgroundColor.Value.Y;
                    fadeColorVec.Z *= m_backgroundColor.Value.Z;
                }
                Color fadeColor = new Color(fadeColorVec);

                //  Blank background fade
                MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), new Rectangle(0, 0, MyMinerGame.ScreenSize.X, MyMinerGame.ScreenSize.Y), fadeColor);
            }

            //  This is just background of the screen rectangle
            if ((m_backgroundColor.HasValue) && (m_size.HasValue))
            {
                //  Background texture
                if (m_backgroundTexture == null)
                {
                    if (m_size.HasValue)
                    {
                        //  If this screen doesn't have custom texture, we will use one of the default - but with respect to screen's aspect ratio
                        m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>(MyGuiManager.GetBackgroundTextureFilenameByAspectRatio(m_size.Value), loadingMode: LoadingMode.LazyBackground);
                    }
                }

                MyGuiManager.DrawSpriteBatch(m_backgroundTexture, m_position, m_size.Value, GetColorAfterTransitionAlpha(m_backgroundColor.Value), MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }

            DrawControls();
            //DrawControlsFinal();

            return(true);
        }