예제 #1
0
        /// <summary>
        /// Draws a frame of the scene.
        /// </summary>
        /// <param name="gameTime">Game frame interval.</param>
        public void Draw(GameTime gameTime)
        {
            GraphicsDevice graphics = GameManager
                                      .GraphicsDevice;

            try
            {
                SpriteBatch.Begin();
                // Draw waiting screen
                SpriteBatch.Draw(LoadingScreen, graphics.Viewport.Bounds,
                                 Color.White);
                StatusLabel.Draw(gameTime, SpriteBatch);
                SpriteBatch.End();
            }
            catch
            {
            }
        }
예제 #2
0
        /// <summary>
        /// Draws a frame of the scene.
        /// </summary>
        /// <param name="gameTime">Game frame interval.</param>
        public void Draw(GameTime gameTime)
        {
            GraphicsDevice graphics = GameManager
                                      .GraphicsDevice;

            try
            {
                StatusLabel.SetText("Game starts in " +
                                    ((Time - Timer.ElapsedMilliseconds) / 1000 + 1).ToString()
                                    + "s");

                SpriteBatch.Begin();
                // Draw countdown screen
                SpriteBatch.Draw(LoadingScreen, graphics.Viewport.Bounds,
                                 Color.White);
                StatusLabel.Draw(gameTime, SpriteBatch);
                SpriteBatch.End();
            }
            catch
            {
            }
        }
예제 #3
0
파일: Engine.cs 프로젝트: bsimser/CoM
    /**
     * Draws all visibile game states.
     */
    virtual public void DoDraw()
    {
        // check for any cache updates that need to happen
        GuiContainer.ValidateAll();

        if (!EnableCamera)
        {
            GL.Clear(true, true, Color.black);
        }

        // draws all layers into a render texture.
        bool layerComposite = false;

        RenderTexture compositeTexture = null;

        PureGUIMatrix = GUI.matrix;

        GUI.matrix    = Matrix4x4.Scale(new Vector3(GuiScale, GuiScale, 1));
        BaseGUIMatrix = GUI.matrix;

        if (layerComposite)
        {
            compositeTexture = RenderTexture.GetTemporary(Screen.width, Screen.height);
            Graphics.SetRenderTarget(compositeTexture);
            GL.Clear(true, true, Color.clear);
        }

        // states are drawn backwards from the last state to block vision
        int firstStateToDraw;

        for (firstStateToDraw = 0; firstStateToDraw < StateList.Count; firstStateToDraw++)
        {
            if (!StateList[firstStateToDraw].TransparentDraw)
            {
                break;
            }
        }

        if (!HideGUI)
        {
            for (int lp = firstStateToDraw; lp >= 0; lp--)
            {
                try {
                    StateList[lp].Draw();
                } catch (Exception error) {
                    Trace.LogDebug("Error drawing state {0} of {1}: {2}", lp, StateList.Count, error.Message);
                }
            }
        }

        if (layerComposite)
        {
            Graphics.SetRenderTarget(null);
            var dp = DrawParameters.Default;
            //Graphics.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), compositeTexture, new Rect(0, 0, Screen.width, Screen.height), 0, 0, 0, 0, Color.white, dp.GetPreparedMaterial(compositeTexture));
            Graphics.Blit(compositeTexture, dp.GetPreparedMaterial(compositeTexture));
            RenderTexture.ReleaseTemporary(compositeTexture);
        }

        // draw notifications
        for (int lp = 0; lp < notificationList.Count; lp++)
        {
            var notification = notificationList[lp];
            notification.Update();
            notification.Draw();
        }

        if (DragDrop != null)
        {
            DragDrop.Draw();
        }

        if (Settings.General.ShowFPS)
        {
            FPSLabel.Draw();
        }

        if (Settings.Advanced.ShowLogs)
        {
            CurrentState.PositionComponent(LogWindow, 1, 0);
            LogWindow.Update();
            LogWindow.Draw();
        }
    }