diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs index 793045a..88b8950 100644 --- a/RhythmBullet/RhythmBulletGame.cs +++ b/RhythmBullet/RhythmBulletGame.cs @@ -30,7 +30,7 @@ namespace RhythmBullet readonly ResolutionContentResolver resolutionContentResolver; public PreferencesManager preferencesManager; private ScreenManager screenManager; - private Camera2D camera; + public Camera2D Camera { get; private set; } private bool resizing; public RhythmBulletGame() @@ -75,8 +75,8 @@ namespace RhythmBullet { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); - camera = new Camera2D(graphics.GraphicsDevice); - screenManager = new ScreenManager(graphics, camera); + Camera = new Camera2D(graphics.GraphicsDevice); + screenManager = new ScreenManager(graphics, Camera); screenManager.RequireNextScreenEvent += ExitTransitionComplete; QueueContent(); screenManager.Screen = new LoadingScreen(Content.Load("RhythmBullet"), 0.7f); @@ -111,7 +111,7 @@ namespace RhythmBullet screenManager.UpdateCurrentScreen(gameTime, Assets.Done); InputUtilities.Update(); - camera.Update(); + Camera.Update(); base.Update(gameTime); } diff --git a/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainPage.cs b/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainPage.cs index 2e9f03d..9586854 100644 --- a/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainPage.cs +++ b/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainPage.cs @@ -2,20 +2,29 @@ using Microsoft.Xna.Framework.Graphics; using RhythmBullet.Zer01HD.UI.Book; using RhythmBullet.Zer01HD.Utilities.ContentSystem; +using RhythmBullet.Zer01HD.Utilities.UI.Modular.Modules; namespace RhythmBullet.Zer01HD.Game.Screens.MainMenu { internal class MainPage : Page { - Texture2D title; - internal MainPage(ContentSystem assets, GraphicsDevice graphicsDevice) : base(0, 0, graphicsDevice) + Image title; + internal MainPage(ContentSystem assets) : base(0, 0) { - title = assets.Get("title"); + title = new Image(assets.Get("title")); + AddModule(title); + } + + public override void ApplySize(int width, int height) + { + title.Scale = (width - 40) / title.Texture.Width; + title.Bounds.X = (int)((width - title.Bounds.Width) / 2f); + title.Bounds.Y = (int)((height - title.Bounds.Height) / 2f); + base.ApplySize(width, height); } public override void Draw(SpriteBatch batch) { - batch.Draw(title, title.Bounds, Color.White); base.Draw(batch); } } diff --git a/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainScreen.cs b/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainScreen.cs index 778755f..5bfe1bd 100644 --- a/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainScreen.cs +++ b/RhythmBullet/Zer01HD/Game/Screens/MainMenu/MainScreen.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using RhythmBullet.Zer01HD.UI.Book; +using RhythmBullet.Zer01HD.Utilities.Camera; namespace RhythmBullet.Zer01HD.Game.Screens.MainMenu { @@ -20,12 +21,21 @@ namespace RhythmBullet.Zer01HD.Game.Screens.MainMenu FadeAwayTransition fat; Texture2D background; Book book; + MainPage mainPage; public MainScreen(ContentSystem assets) : base(true) { background = assets.Get("backgrounds/mainBG"); fat = new FadeAwayTransition(1.5f); - book = new Book(Camera); - } + book = new Book(); + mainPage = new MainPage(assets); + book.AddPages(mainPage); + } + + public override void Initiate(GraphicsDevice graphicsDevice, Rectangle screenSize, Camera2D camera) + { + book.Initiate(camera, screenSize); + base.Initiate(graphicsDevice, screenSize, camera); + } public override void Show() { @@ -35,6 +45,7 @@ namespace RhythmBullet.Zer01HD.Game.Screens.MainMenu public override void Draw(SpriteBatch spriteBatch) { + spriteBatch.Draw(background, ScreenSize, Color.White); book.Draw(spriteBatch); base.Draw(spriteBatch); diff --git a/RhythmBullet/Zer01HD/Utilities/UI/Book/Book.cs b/RhythmBullet/Zer01HD/Utilities/UI/Book/Book.cs index cbdc741..1e7730c 100644 --- a/RhythmBullet/Zer01HD/Utilities/UI/Book/Book.cs +++ b/RhythmBullet/Zer01HD/Utilities/UI/Book/Book.cs @@ -22,7 +22,7 @@ namespace RhythmBullet.Zer01HD.UI.Book /// /// Camera game is currently using. /// Dimensions of the book and the dimensions the pages will use. - public void Initialize(Camera2D camera, Rectangle dimensions) + public void Initiate(Camera2D camera, Rectangle dimensions) { this.camera = camera; this.dimensions = dimensions;