private bool LoadSubtexture() { if (subTexturetoLoad != null) { Texture2D subtitleTexture = content.Load<Texture2D>(subTexturetoLoad); subTitleX = ScreenManager.GraphicsDevice.Viewport.Width - subtitleTexture.Width - 10.0f; subtitleText = new CursorText(subtitleTexture, 1.5f, 5.0f, content); return true; } else { subtitleText = new CursorText(null, 0, 0, content); return false; } }
/// <summary> /// Draws the loading screen. /// </summary> public override void Draw(GameTime gameTime) { // If we are the only active screen, that means all the previous screens // must have finished transitioning off. We check for this in the Draw // method, rather than in Update, because it isn't enough just for the // screens to be gone: in order for the transition to look good we must // have actually drawn a frame without them before we perform the load. if ((ScreenState == ScreenState.Active) && (ScreenManager.GetScreens().Length == 1)) { otherScreensAreGone = true; } // The gameplay screen takes a while to load, so we display a loading // message while that is going on, but the menus load very quickly, and // it would look silly if we flashed this up for just a fraction of a // second while returning from the game to the menus. This parameter // tells us how long the loading is going to take, so we know whether // to bother drawing the message. if (loadingIsSlow) { if (loadingScreenContentLoaded == false) { //assume we have Content manager? ContentManager content = ScreenManager.Game.Content; generatingMapTexture = content.Load<Texture2D>("Sprites\\Titles\\GeneratingMap"); generatingMapText = new CursorText(generatingMapTexture, 2.5f, 0.0f, content); loadingScreenContentLoaded = true; } SpriteBatch sb = ScreenManager.SpriteBatch; // Center the text in the viewport. Viewport viewport = ScreenManager.GraphicsDevice.Viewport; Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height); Vector2 textPosition = (viewportSize - new Vector2(generatingMapTexture.Width, generatingMapTexture.Height)) / 2; Color color = Color.White * TransitionAlpha; sb.Begin(); // Draw the text. generatingMapText.DrawSelf(sb, textPosition, color); sb.End(); } }
public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); backgroundTexture = content.Load<Texture2D>("sprites\\Background"); levelWinTexture = content.Load<Texture2D>(levelWinTexturePath); taptoContinueTexture = content.Load<Texture2D>(taptoContinueTexturePath); levelwinText = new CursorText(levelWinTexture, 1.5f, 1.0f, content); levelWinTextDrawLocation = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2 - levelWinTexture.Width / 2, ScreenManager.GraphicsDevice.Viewport.Height / 2 - levelWinTexture.Height / 2); originalLevelWinTextDrawLocation = levelWinTextDrawLocation; tapToContinueLocation = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2 - taptoContinueTexture.Width / 2, ScreenManager.GraphicsDevice.Viewport.Height - 100); levelWinTextRaiseLocation = new Vector2(levelWinTextDrawLocation.X, 60); splashSound = content.Load<SoundEffect>(soundPath); raiseSound = content.Load<SoundEffect>("Sounds\\Thump"); AddAccountingControl(); }