began trying to fix primitive batch.

This commit is contained in:
2019-01-30 07:45:55 -06:00
parent c7211323fd
commit 2acdda2338
4 changed files with 76 additions and 94 deletions

View File

@@ -63,7 +63,7 @@ namespace RhythmBullet
Resolution resolution = preferencesManager.GetPreferences<General>().Resolution;
graphics.PreferredBackBufferWidth = resolution.Width;
graphics.PreferredBackBufferHeight = resolution.Height;
RecrownedAthenaeum.Configuration.graphicsDeviceManager = graphics;
RecrownedAthenaeum.Configuration.GraphicsDeviceManager = graphics;
}
/// <summary>
@@ -96,8 +96,11 @@ 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(Camera);
RecrownedAthenaeum.Configuration.Camera2D = new Camera2D();
Camera = RecrownedAthenaeum.Configuration.Camera2D;
screenManager = new ScreenManager();
screenManager.ShowFirstScreenEvent += ShowFirstScreen;
QueueContent();
screenManager.Screen = new LoadingScreen(this, Content.Load<Texture2D>("RhythmBullet"), 0.7f);
@@ -242,7 +245,7 @@ namespace RhythmBullet
TextButtonSkinDefinition textButtonSkinDefinition = new TextButtonSkinDefinition("Rounded9pButton-down", "Rounded9pButton");
textButtonSkinDefinition.disabledRegion = "Rounded9pButton-disabled";
skin.AddDefinition("default", textButtonSkinDefinition);
skin.AddDefinition(textButtonSkinDefinition);
skin.Laminate();
skinManager.BaseSkin = skin;

View File

@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.ContentSystem;
using RecrownedAthenaeum.Render;
using RecrownedAthenaeum.UI.BookSystem;
using RecrownedAthenaeum.UI.Modular.Modules;
using RecrownedAthenaeum.UI.Modular.Modules.Interactive;
@@ -15,6 +16,8 @@ namespace RhythmBullet.Screens.MainMenu
TextButton playButton;
TextButton quitButton;
PrimitiveBatch primitiveBatch = new PrimitiveBatch();
internal MainPage() : base(0, 0)
{
}
@@ -26,8 +29,6 @@ namespace RhythmBullet.Screens.MainMenu
SpriteFont font = assets.Get<SpriteFont>("gasalt_regular");
var test = skin.ObtainDefinition<TextButtonSkinDefinition>(typeof(TextButton));
playButton = new TextButton("Play!", font, skin);
AddModule(playButton);
@@ -38,15 +39,19 @@ namespace RhythmBullet.Screens.MainMenu
public override void ApplySize(int width, int height)
{
title.Scale = (width - 40) / title.Texture.Width;
title.CenterOrigin();
title.bounds.X = width / 2;
title.bounds.Y = height / 2;
title.bounds.X = (int)(width / 2f);
title.bounds.Y = (int)(height / 2f);
base.ApplySize(width, height);
}
public override void Draw(SpriteBatch batch)
{
primitiveBatch.Begin(PrimitiveType.LineList);
primitiveBatch.AddVertex(new Vector2(20, 20), Color.Red);
primitiveBatch.AddVertex(new Vector2(50, 60), Color.Red);
primitiveBatch.End();
base.Draw(batch);
}
}