コード例 #1
0
        protected override void Draw(GameTime gameTime)
        {
            Profiler.Start("Rendering", Color.LimeGreen);
            Time.GameTime = gameTime;
            //GraphicsDevice.Clear(Color.CornflowerBlue);

            base.Draw(gameTime);

            if (IsGameWorldloaded)
            {
                worldRenderer.RenderWorld(theWorld);
            }
            else
            {
                World.Draw(gameTime);
            }

            RenderUtils.Draw(Graphics.GraphicsDevice,
                             World.player.camera.ViewMatrix,
                             World.player.camera.ProjectionMatrix);

            if (IsGameWorldloaded)
            {
                theWorld.player.Draw();
            }
            else
            {
                if (World.player != null)
                {
                    World.player.Draw();
                }
            }

            //Render UI
            UiStateManager.Begin();
            foreach (GuiScreen ui in GUIs)
            {
                if (ui.visible)
                {
                    ui.Render();
                }
            }
            UiStateManager.End();

            LateDraw();
            Profiler.Stop("Rendering");
        }
コード例 #2
0
        public static void RegisterUiMenus()
        {
            //Caching images requires us to start the spritebatch
            UiStateManager.Begin();
            //ORDER MATTERS!!

            //UI
            hotbarUI = new HotbarScreen();
            GameClient.Instance.RegisterGui(hotbarUI);

#if !DEBUG
            //If this is a release build, we add the debug UI on top of the hotbar but beneath all other UI elements
            debugUI = new DebugScreen();
            GameClient.Instance.RegisterGui(debugUI);
#endif

            pauseUI = new PauseScreen();
            GameClient.Instance.RegisterGui(pauseUI);

            mainMenuUI = new MainMenuScreen();
            GameClient.Instance.RegisterGui(mainMenuUI);

            multiplayerUI = new MultiplayerScreen();
            GameClient.Instance.RegisterGui(multiplayerUI);

            optionsUI = new OptionsScreen();
            GameClient.Instance.RegisterGui(optionsUI);

            languageUI = new LanguageScreen();
            GameClient.Instance.RegisterGui(languageUI);

            statsUI = new StatisticsScreen();
            GameClient.Instance.RegisterGui(statsUI);

            loadingUI = new LoadingScreen();
            GameClient.Instance.RegisterGui(loadingUI);

#if DEBUG
            //If we're in debug mode, the debug UI is added last for debugging reasons
            debugUI = new DebugScreen();
            GameClient.Instance.RegisterGui(debugUI);
#endif

            UiStateManager.End();
        }
コード例 #3
0
        public override void Draw(Texture2D screen)
        {
            int MinX = screen.Width / 2 - CrossHairWidth / 2;
            int MaxX = MinX + CrossHairWidth;

            int MinY = screen.Height / 2 - CrossHairWidth / 2;
            int MaxY = MinY + CrossHairWidth;

            int HeightMinY = screen.Height / 2 - CrossHairThickness / 2;
            int HeightMaxY = HeightMinY + CrossHairThickness;

            int WidthMinY = screen.Width / 2 - CrossHairThickness / 2;
            int WidthMaxY = WidthMinY + CrossHairThickness;

            base.Draw(screen);

            Texture2D pixel = TextureLoader.getWhitePixel();

            //spriteBatch.Begin(SpriteSortMode.Deferred, InvertBlendState);
            UiStateManager.Begin();
            UiStateManager.DrawImage(new Rectangle(new Point(MaxX, HeightMaxY), new Point(MinX - MaxX, HeightMinY - HeightMaxY)), pixel, Color.White);
            UiStateManager.DrawImage(new Rectangle(new Point(WidthMaxY, MaxY), new Point(WidthMinY - WidthMaxY, MinY - MaxY)), pixel, Color.White);
            UiStateManager.End();
        }