new cursor while cleaning up from refactor.
This commit is contained in:
parent
1195b8228a
commit
a4bedd34af
Binary file not shown.
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 272 KiB |
@ -35,6 +35,8 @@ namespace RhythmBullet
|
||||
private bool resizing;
|
||||
private bool initialLoadComplete;
|
||||
private MainScreen mainScreen;
|
||||
private Texture2D currentCursorTexture;
|
||||
|
||||
public RhythmBulletGame()
|
||||
{
|
||||
graphics = new GraphicsDeviceManager(this);
|
||||
@ -91,6 +93,8 @@ namespace RhythmBullet
|
||||
protected override void UnloadContent()
|
||||
{
|
||||
Assets.UnloadAll();
|
||||
screenManager.Dispose();
|
||||
currentCursorTexture.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -108,10 +112,12 @@ namespace RhythmBullet
|
||||
{
|
||||
resizing = false;
|
||||
PostResize();
|
||||
} else if (!initialLoadComplete)
|
||||
}
|
||||
else if (!initialLoadComplete)
|
||||
{
|
||||
Console.WriteLine("Initial load complete.");
|
||||
Debug.WriteLine("Initial load complete.");
|
||||
initialLoadComplete = true;
|
||||
SetUpCursor();
|
||||
mainScreen = new MainScreen(Assets);
|
||||
}
|
||||
|
||||
@ -143,6 +149,7 @@ namespace RhythmBullet
|
||||
Assets.UnloadAll();
|
||||
QueueContent();
|
||||
screenManager.Resize(new LoadingScreen(this, Content.Load<Texture2D>("loading_ring"), 0.4f));
|
||||
SetUpCursor();
|
||||
}
|
||||
|
||||
private void PostResize()
|
||||
@ -159,6 +166,24 @@ namespace RhythmBullet
|
||||
Assets.Queue<Texture2D>("backgrounds/mainBG");
|
||||
}
|
||||
|
||||
private void SetUpCursor()
|
||||
{
|
||||
Texture2D texture = Assets.Get<Texture2D>("cursor");
|
||||
int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight);
|
||||
Debug.WriteLine("Cursor size length: " + cursorSize);
|
||||
RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize);
|
||||
GraphicsDevice.SetRenderTarget(renderTarget);
|
||||
GraphicsDevice.Clear(Color.Transparent);
|
||||
spriteBatch.Begin();
|
||||
spriteBatch.Draw(texture, new Rectangle(0, 0, cursorSize, cursorSize), Color.White);
|
||||
spriteBatch.End();
|
||||
GraphicsDevice.SetRenderTarget(null);
|
||||
|
||||
currentCursorTexture?.Dispose();
|
||||
currentCursorTexture = renderTarget;
|
||||
Mouse.SetCursor(MouseCursor.FromTexture2D(currentCursorTexture, currentCursorTexture.Width / 2, currentCursorTexture.Height / 2));
|
||||
}
|
||||
|
||||
private void RequireNextScreen(Screen Screen)
|
||||
{
|
||||
Screen.NextScreen = mainScreen;
|
||||
|
@ -38,7 +38,6 @@ namespace RhythmBullet.Zer01HD.Screens.MainMenu
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
Mouse.SetCursor(MouseCursor.FromTexture2D(assets.Get<Texture2D>("cursor"), 256, 256));
|
||||
Transitions.Add(fat);
|
||||
base.Show();
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
|
||||
|
||||
public T Get<T>(string assetName)
|
||||
{
|
||||
Console.WriteLine("Attempt get");
|
||||
lock (queue)
|
||||
{
|
||||
return (T)assets[assetName];
|
||||
|
@ -31,7 +31,18 @@ namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem
|
||||
this.proportion = proportion;
|
||||
this.rotate = rotate;
|
||||
Transitions.Add(this);
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
game.IsMouseVisible = false;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
game.IsMouseVisible = true;
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
public void InitiateTransition(Rectangle dimensions)
|
||||
|
@ -44,6 +44,7 @@ namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem
|
||||
|
||||
Debug.WriteLine("Showing " + value.GetType().Name);
|
||||
Screen.Show();
|
||||
previousScreen?.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user