Tried cleaning things up. Idk.

This commit is contained in:
Harrison Deng 2019-11-23 21:46:46 -05:00
parent a06c5ec4ff
commit e3946c526f
4 changed files with 24 additions and 5 deletions

View File

@ -10,7 +10,7 @@
#-------------------------------- References --------------------------------# #-------------------------------- References --------------------------------#
/reference:..\..\..\RecrownedAthenaeum\RecrownedAthenaeum.Pipeline\bin\Release\netstandard2.0\publish\RecrownedAthenaeum.Pipeline.dll /reference:..\..\..\RecrownedAthenaeum\RecrownedAthenaeum.Pipeline\bin\Debug\netstandard2.0\publish\RecrownedAthenaeum.Pipeline.dll
#---------------------------------- Content ---------------------------------# #---------------------------------- Content ---------------------------------#

View File

@ -11,7 +11,7 @@ with.
<!-- <!--
Modify this string to change the font that will be imported. Modify this string to change the font that will be imported.
--> -->
<FontName>Darktech_ldr</FontName> <FontName>darktech_ldr</FontName>
<!-- <!--
Size is a float value, measured in points. Modify this value to change Size is a float value, measured in points. Modify this value to change

View File

@ -38,7 +38,7 @@ namespace RhythmBullet.ContentResolvers
} }
} }
Resolution[] resolutions = { public Resolution[] resolutions = {
new Resolution(1920, 1080), new Resolution(1920, 1080),
new Resolution(2560, 1440), new Resolution(2560, 1440),
new Resolution(3840, 2160) new Resolution(3840, 2160)

View File

@ -40,12 +40,18 @@ namespace RhythmBullet
internal readonly MusicController musicController; internal readonly MusicController musicController;
private SkinManager skinManager = new SkinManager(); private SkinManager skinManager = new SkinManager();
private ISkin Skin { get { return skinManager.Skin; } } private ISkin Skin { get { return skinManager.Skin; } }
private ResolutionContentResolver resolutionContentResolver = new ResolutionContentResolver();
private FontContentResolver fontContentResolver;
public RhythmBulletGame() public RhythmBulletGame()
{ {
graphics = new GraphicsDeviceManager(this); graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content"; Content.RootDirectory = "Content";
assets = new ContentManagerController(Content); assets = new ContentManagerController(Content);
//Add the content resolvers.
assets.AddContentPathResolver(typeof(Texture2D), resolutionContentResolver);
fontContentResolver = new FontContentResolver(resolutionContentResolver);
assets.AddContentPathResolver(typeof(SpriteFont), fontContentResolver);
musicController = new MusicController(); musicController = new MusicController();
preferencesManager = new PreferencesManager( preferencesManager = new PreferencesManager(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet",
@ -82,6 +88,7 @@ namespace RhythmBullet
Camera = new Camera2D(resolution.Width, resolution.Height, cameraEffect); Camera = new Camera2D(resolution.Width, resolution.Height, cameraEffect);
Debug.WriteLine("Initial setup complete."); Debug.WriteLine("Initial setup complete.");
base.Initialize(); base.Initialize();
} }
/// <summary> /// <summary>
@ -95,7 +102,11 @@ namespace RhythmBullet
screenManager = new ScreenManager(graphics); screenManager = new ScreenManager(graphics);
screenManager.NeedNextScreen += ShowFirstScreen; screenManager.NeedNextScreen += ShowFirstScreen;
General general = preferencesManager.GetPreferences<General>();
Resolution resolution = general.Resolution;
QueueContent(); QueueContent();
resolutionContentResolver.Height = resolution.Height;
resolutionContentResolver.Width = resolution.Width;
screenManager.Screen = new LoadingScreen(this, Content.Load<Texture2D>("RhythmBullet"), 0.7f); screenManager.Screen = new LoadingScreen(this, Content.Load<Texture2D>("RhythmBullet"), 0.7f);
} }
@ -146,12 +157,20 @@ namespace RhythmBullet
base.Draw(gameTime); base.Draw(gameTime);
} }
/// <summary>
/// Updates the world constants, unloads all assets, queues the new batch, and resizes the virtual screens.
/// Finishes by updating the cursor size.
/// </summary>
/// <param name="width">New window width.</param>
/// <param name="height">New window height.</param>
public void Resize(int width, int height) public void Resize(int width, int height)
{ {
pixels_per_WU = height / WORLD_HEIGHT; pixels_per_WU = height / WORLD_HEIGHT;
graphics.PreferredBackBufferWidth = width; graphics.PreferredBackBufferWidth = width;
graphics.PreferredBackBufferHeight = height; graphics.PreferredBackBufferHeight = height;
assets.UnloadAll(); assets.UnloadAll();
resolutionContentResolver.Height = height;
resolutionContentResolver.Width = width;
QueueContent(); QueueContent();
screenManager.Resize(new LoadingScreen(this, Content.Load<Texture2D>("loading_ring"), 0.4f, true)); screenManager.Resize(new LoadingScreen(this, Content.Load<Texture2D>("loading_ring"), 0.4f, true));
UpdateCursor(); UpdateCursor();
@ -187,7 +206,7 @@ namespace RhythmBullet
private void QueueContent() private void QueueContent()
{ {
assets.Queue<Texture2D>("cursor", false); assets.Queue<Texture2D>("cursor", false);
assets.Queue<Texture2D>("title"); assets.Queue<Texture2D>("title", false);
assets.Queue<Texture2D>("default_cover", false); assets.Queue<Texture2D>("default_cover", false);
assets.Queue<TextureAtlas>("UI"); assets.Queue<TextureAtlas>("UI");
assets.Queue<SpriteFont>("gasalt_regular"); assets.Queue<SpriteFont>("gasalt_regular");