Beispiel #1
0
        //Game Rendering
        public static void Render()
        {
            var takingScreenshot = false;

            if (Renderer?.ScreenshotRequests.Count > 0)
            {
                takingScreenshot = Renderer.BeginScreenshot();
            }

            if (!(Renderer?.Begin() ?? false))
            {
                return;
            }

            if (Renderer.GetScreenWidth() != sOldWidth ||
                Renderer.GetScreenHeight() != sOldHeight ||
                Renderer.DisplayModeChanged())
            {
                sDarknessTexture = null;
                Interface.Interface.DestroyGwen();
                Interface.Interface.InitGwen();
                sOldWidth  = Renderer.GetScreenWidth();
                sOldHeight = Renderer.GetScreenHeight();
            }

            Renderer.Clear(Color.Black);
            DrawCalls     = 0;
            MapsDrawn     = 0;
            EntitiesDrawn = 0;
            LightsDrawn   = 0;

            UpdateView();

            switch (Globals.GameState)
            {
            case GameStates.Intro:
                DrawIntro();

                break;

            case GameStates.Menu:
                DrawMenu();

                break;

            case GameStates.Loading:
                break;

            case GameStates.InGame:
                DrawInGame();

                break;

            case GameStates.Error:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Interface.Interface.DrawGui();

            DrawGameTexture(
                Renderer.GetWhiteTexture(), new FloatRect(0, 0, 1, 1), CurrentView,
                new Color((int)Fade.GetFade(), 0, 0, 0), null, GameBlendModes.None
                );

            // Draw our mousecursor at the very end, but not when taking screenshots.
            if (!takingScreenshot && !string.IsNullOrWhiteSpace(ClientConfiguration.Instance.MouseCursor))
            {
                var renderLoc = ConvertToWorldPoint(Globals.InputManager.GetMousePosition());
                DrawGameTexture(
                    Globals.ContentManager.GetTexture(GameContentManager.TextureType.Misc, ClientConfiguration.Instance.MouseCursor), renderLoc.X, renderLoc.Y
                    );
            }

            Renderer.End();

            if (takingScreenshot)
            {
                Renderer.EndScreenshot();
            }
        }
Beispiel #2
0
        //Game Rendering
        public static void Render()
        {
            var takingScreenshot = false;

            if (Renderer?.ScreenshotRequests.Count > 0)
            {
                takingScreenshot = Renderer.BeginScreenshot();
            }

            if (!(Renderer?.Begin() ?? false))
            {
                return;
            }

            if (Renderer.GetScreenWidth() != sOldWidth ||
                Renderer.GetScreenHeight() != sOldHeight ||
                Renderer.DisplayModeChanged())
            {
                sDarknessTexture = null;
                Interface.Interface.DestroyGwen();
                Interface.Interface.InitGwen();
                sOldWidth  = Renderer.GetScreenWidth();
                sOldHeight = Renderer.GetScreenHeight();
            }

            Renderer.Clear(Color.Black);
            DrawCalls     = 0;
            MapsDrawn     = 0;
            EntitiesDrawn = 0;
            LightsDrawn   = 0;

            UpdateView();

            switch (Globals.GameState)
            {
            case GameStates.Intro:
                DrawIntro();

                break;

            case GameStates.Menu:
                DrawMenu();

                break;

            case GameStates.Loading:
                break;

            case GameStates.InGame:
                DrawInGame();

                break;

            case GameStates.Error:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Interface.Interface.DrawGui();

            DrawGameTexture(
                Renderer.GetWhiteTexture(), new FloatRect(0, 0, 1, 1), CurrentView,
                new Color((int)Fade.GetFade(), 0, 0, 0), null, GameBlendModes.None
                );

            Renderer.End();

            if (takingScreenshot)
            {
                Renderer.EndScreenshot();
            }
        }