public void Draw(SpriteBatch spriteBatch, Vector2 position) { Vector2 offsets = offset + position; Vector2 offsetIcons = offsets + offsetIcon; background.Draw(spriteBatch, offsets, 0.8f); imgLine.Draw(spriteBatch, new Vector2(114, 6) + offsets, 0.81f); imgHCBackdrop.Draw(spriteBatch, new Vector2(61, 2) + offsets, 0.81f); DiamondIcon.Draw(spriteBatch, new Vector2(0, 0) + offsetIcons, 0.81f); CreditIcon.Draw(spriteBatch, new Vector2(0, 19) + offsetIcons, 0.81f); DucketIcon.Draw(spriteBatch, new Vector2(0, 38) + offsetIcons, 0.81f); HCIcon.Draw(spriteBatch, new Vector2(78, 13) + offsets, 0.81f); HelpButton.Draw(spriteBatch, new Vector2(120, 3) + offsets, 0.81f); ExitButton.Draw(spriteBatch, new Vector2(120, 24) + offsets, 0.81f); SettingsButton.Draw(spriteBatch, new Vector2(120, 45) + offsets, 0.81f); txtDiamond.Draw(spriteBatch, offsets + new Vector2(38 - txtDiamond.measureString().X, 6)); txtCredit.Draw(spriteBatch, offsets + new Vector2(38 - txtCredit.measureString().X, 24)); txtDucket.Draw(spriteBatch, offsets + new Vector2(38 - txtDucket.measureString().X, 44)); //100 = HC Text }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.AliceBlue); var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; _frameCounter.Update(deltaTime); var fps = string.Format("FPS: {0}", _frameCounter.AverageFramesPerSecond); if (GameSteate == GameSteates.MainMenu) { Shaders.MainMenu.Parameters["time"].SetValue((float)gameTime.TotalGameTime.TotalSeconds); //_planetRenderTarget = new RenderTarget2D(GraphicsDevice, (int)(GraphicsDevice.Viewport.Width * 0.625f + 1), GraphicsDevice.Viewport.Height / 2, false, SurfaceFormat.Color, DepthFormat.None); spriteBatch.GraphicsDevice.SetRenderTarget(_planetRenderTarget); spriteBatch.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, Shaders.MainMenu); spriteBatch.Draw(_planetRenderTarget, new Rectangle(0, 0, _planetRenderTarget.Width, _planetRenderTarget.Height), Color.White); //_mainMenuEffect.CurrentTechnique.Passes[0].Apply(); spriteBatch.End(); if (PlayButtonClicked) { Shaders.BlackHoleTransition.Parameters["time"].SetValue((float)(TimePlayClicked - gameTime.TotalGameTime.TotalSeconds)); Shaders.BlackHoleTransition.Parameters["resolution"].SetValue(new Vector2(_planetRenderTarget.Width, _planetRenderTarget.Height)); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, Shaders.BlackHoleTransition); spriteBatch.Draw(_planetRenderTarget, new Rectangle(0, 0, _planetRenderTarget.Width, _planetRenderTarget.Height), Color.White); spriteBatch.End(); } spriteBatch.GraphicsDevice.SetRenderTarget(null); spriteBatch.GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.Draw(_planetRenderTarget, new Vector2(0, 0), new Rectangle(0, 0, _planetRenderTarget.Width, _planetRenderTarget.Height), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); PlayButton.Draw(graphics, spriteBatch); SettingsButton.Draw(graphics, spriteBatch); ExitButton.Draw(graphics, spriteBatch); spriteBatch.DrawString(Space.spriteFont, fps, new Vector2(50, 50), Color.White); spriteBatch.End(); /*spriteBatch.Begin( * rasterizerState: RasterizerState.CullNone, * effect: _mainMenuEffect * ); * * * * PlayButton.Draw(graphics, spriteBatch); * * * * PlayButton.Draw(graphics, spriteBatch); * * spriteBatch.End();*/ /* * * spriteBatch.Begin(); * PlayButton.Draw(graphics, spriteBatch); * spriteBatch.Draw(testTexture, new Vector2(50, 50), Color.White); * spriteBatch.End();*/ } else if (GameSteate == GameSteates.Settings) { } else if (GameSteate == GameSteates.Lobby) { } else if (GameSteate == GameSteates.Game) { spriteBatch.Begin(transformMatrix: Global.Camera.ProjectionMatrix); //spriteBatch.Begin(); Space.Draw(spriteBatch, graphics, Global.Camera); spriteBatch.End(); DrawModel(Cube, Vector3.Zero); } base.Draw(gameTime); }