began implementing music controller system.
This commit is contained in:
parent
673cdd0b79
commit
1edebdd223
@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using RhythmBullet.Zer01HD.Audio;
|
||||||
using RhythmBullet.Zer01HD.ContentResolvers;
|
using RhythmBullet.Zer01HD.ContentResolvers;
|
||||||
using RhythmBullet.Zer01HD.Preferences;
|
using RhythmBullet.Zer01HD.Preferences;
|
||||||
using RhythmBullet.Zer01HD.Screens.MainMenu;
|
using RhythmBullet.Zer01HD.Screens.MainMenu;
|
||||||
@ -27,7 +28,7 @@ namespace RhythmBullet
|
|||||||
|
|
||||||
GraphicsDeviceManager graphics;
|
GraphicsDeviceManager graphics;
|
||||||
SpriteBatch spriteBatch;
|
SpriteBatch spriteBatch;
|
||||||
public readonly ContentManagerController Assets;
|
public readonly ContentManagerController assets;
|
||||||
readonly ResolutionContentResolver resolutionContentResolver;
|
readonly ResolutionContentResolver resolutionContentResolver;
|
||||||
public PreferencesManager preferencesManager;
|
public PreferencesManager preferencesManager;
|
||||||
private ScreenManager screenManager;
|
private ScreenManager screenManager;
|
||||||
@ -36,17 +37,20 @@ namespace RhythmBullet
|
|||||||
private bool initialLoadComplete;
|
private bool initialLoadComplete;
|
||||||
private MainScreen mainScreen;
|
private MainScreen mainScreen;
|
||||||
private Texture2D currentCursorTexture;
|
private Texture2D currentCursorTexture;
|
||||||
|
internal readonly MusicController musicController;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
musicController = new MusicController();
|
||||||
|
|
||||||
resolutionContentResolver = new ResolutionContentResolver();
|
resolutionContentResolver = new ResolutionContentResolver();
|
||||||
FontContentResolver fcr = new FontContentResolver(resolutionContentResolver);
|
FontContentResolver fcr = new FontContentResolver(resolutionContentResolver);
|
||||||
Assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver);
|
assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver);
|
||||||
Assets.contentPathModifier.Add(typeof(SpriteFont), fcr);
|
assets.contentPathModifier.Add(typeof(SpriteFont), fcr);
|
||||||
preferencesManager = new PreferencesManager(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet",
|
preferencesManager = new PreferencesManager(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet",
|
||||||
new General(),
|
new General(),
|
||||||
new Controls());
|
new Controls());
|
||||||
@ -67,6 +71,8 @@ namespace RhythmBullet
|
|||||||
Resolution resolution = preferencesManager.GetPreferences<General>().Resolution;
|
Resolution resolution = preferencesManager.GetPreferences<General>().Resolution;
|
||||||
resolutionContentResolver.Width = resolution.Width;
|
resolutionContentResolver.Width = resolution.Width;
|
||||||
resolutionContentResolver.Height = resolution.Height;
|
resolutionContentResolver.Height = resolution.Height;
|
||||||
|
musicController.musicList.path = preferencesManager.GetPreferences<General>().MusicDirectory;
|
||||||
|
musicController.musicList.StartSearch();
|
||||||
Debug.WriteLine("Initial setup complete.");
|
Debug.WriteLine("Initial setup complete.");
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
}
|
}
|
||||||
@ -92,7 +98,7 @@ namespace RhythmBullet
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void UnloadContent()
|
protected override void UnloadContent()
|
||||||
{
|
{
|
||||||
Assets.UnloadAll();
|
assets.UnloadAll();
|
||||||
screenManager.Dispose();
|
screenManager.Dispose();
|
||||||
currentCursorTexture.Dispose();
|
currentCursorTexture.Dispose();
|
||||||
}
|
}
|
||||||
@ -104,9 +110,9 @@ namespace RhythmBullet
|
|||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
if (!Assets.Done)
|
if (!assets.Done)
|
||||||
{
|
{
|
||||||
Assets.Update();
|
assets.Update();
|
||||||
}
|
}
|
||||||
else if (resizing)
|
else if (resizing)
|
||||||
{
|
{
|
||||||
@ -118,10 +124,10 @@ namespace RhythmBullet
|
|||||||
Debug.WriteLine("Initial load complete.");
|
Debug.WriteLine("Initial load complete.");
|
||||||
initialLoadComplete = true;
|
initialLoadComplete = true;
|
||||||
SetUpCursor();
|
SetUpCursor();
|
||||||
mainScreen = new MainScreen(Assets);
|
mainScreen = new MainScreen(assets);
|
||||||
}
|
}
|
||||||
|
|
||||||
screenManager.UpdateCurrentScreen(gameTime, Assets.Done);
|
screenManager.UpdateCurrentScreen(gameTime, assets.Done && musicController.musicList.Searched);
|
||||||
|
|
||||||
InputUtilities.Update();
|
InputUtilities.Update();
|
||||||
Camera.Update();
|
Camera.Update();
|
||||||
@ -146,7 +152,7 @@ namespace RhythmBullet
|
|||||||
graphics.PreferredBackBufferWidth = width;
|
graphics.PreferredBackBufferWidth = width;
|
||||||
graphics.PreferredBackBufferHeight = height;
|
graphics.PreferredBackBufferHeight = height;
|
||||||
resizing = true;
|
resizing = true;
|
||||||
Assets.UnloadAll();
|
assets.UnloadAll();
|
||||||
QueueContent();
|
QueueContent();
|
||||||
screenManager.Resize(new LoadingScreen(this, Content.Load<Texture2D>("loading_ring"), 0.4f));
|
screenManager.Resize(new LoadingScreen(this, Content.Load<Texture2D>("loading_ring"), 0.4f));
|
||||||
SetUpCursor();
|
SetUpCursor();
|
||||||
@ -160,15 +166,15 @@ 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");
|
||||||
Assets.Queue<Texture2D>("default_cover", false);
|
assets.Queue<Texture2D>("default_cover", false);
|
||||||
Assets.Queue<Texture2D>("backgrounds/mainBG");
|
assets.Queue<Texture2D>("backgrounds/mainBG");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetUpCursor()
|
private void SetUpCursor()
|
||||||
{
|
{
|
||||||
Texture2D texture = Assets.Get<Texture2D>("cursor");
|
Texture2D texture = assets.Get<Texture2D>("cursor");
|
||||||
int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight);
|
int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight);
|
||||||
Debug.WriteLine("Cursor size length: " + cursorSize);
|
Debug.WriteLine("Cursor size length: " + cursorSize);
|
||||||
RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize);
|
RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user