began trying to fix primitive batch.

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

Binary file not shown.

View File

@ -141,11 +141,16 @@
All variables here should be for RecrownedAthenaeum to use when needed and thus eliminates unessecary passing.
</summary>
</member>
<member name="F:RecrownedAthenaeum.Configuration.graphicsDeviceManager">
<member name="P:RecrownedAthenaeum.Configuration.GraphicsDeviceManager">
<summary>
The graphics device that will be used by default.
</summary>
</member>
<member name="P:RecrownedAthenaeum.Configuration.Camera2D">
<summary>
2D camera to be used by default.
</summary>
</member>
<member name="T:RecrownedAthenaeum.SpecialTypes.ISpecialDrawable">
<summary>
A wrapper that makes sure anything implementing can be drawn with options.
@ -290,6 +295,13 @@
<param name="graphicsDevice">graphics device to be used. Default is null and will resort to using graphics device from <see cref="T:RecrownedAthenaeum.Configuration"/>'s graphics device manager.</param>
<returns>The texture from the region.</returns>
</member>
<member name="M:RecrownedAthenaeum.SpecialTypes.TextureAtlas.ContainsRegion(System.String)">
<summary>
Whether or not this atlas contains the given region name.
</summary>
<param name="regionName">The name of the region to check for.</param>
<returns>True if this atlas does contain the region given by name.</returns>
</member>
<member name="M:RecrownedAthenaeum.SpecialTypes.TextureAtlas.Dispose">
<summary>
Disposes unmanaged resources for the texture atlas.
@ -659,7 +671,7 @@
The skin definition data.
</summary>
</member>
<member name="M:RecrownedAthenaeum.Data.SkinData.DefinitionData.#ctor(System.String,RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData)">
<member name="M:RecrownedAthenaeum.Data.SkinData.DefinitionData.#ctor(System.String,RecrownedAthenaeum.UI.SkinSystem.Definitions.SkinDefinitionData)">
<summary>
Sets values for data.
</summary>
@ -726,7 +738,7 @@
<summary>
Creates a batch used to draw primitives.
</summary>
<param name="camera">The current camera being used.</param>
<param name="camera">The current camera being used. Will use default set in <see cref="T:RecrownedAthenaeum.Configuration"/> if left null.</param>
<param name="graphicsDevice">The graphics device used to draw the primitives. Will be using <see cref="T:RecrownedAthenaeum.Configuration"/>'s graphics device from graphics device manager if null. Default is null.</param>
<param name="verticesPerBatch">The amount of vertices every batch can hold before flushing. Default is 450. Should be changed to be the most optimal number if possible to prevent unnecessary resizing. Especially if using strip primitive types.</param>
</member>
@ -1005,8 +1017,8 @@
<summary>
Creates a screen manager that helps manage multiple screens and their transitions.
</summary>
<param name="camera">The camera to be used to perform the correct translations and transformations.</param>
<param name="graphicsDeviceManager">The graphics device manager to be used.</param>
<param name="camera">The camera to be used to perform the correct translations and transformations. Will use default set in <see cref="T:RecrownedAthenaeum.Configuration"/> if left null.</param>
<param name="graphicsDeviceManager">The graphics device manager to be used. Will use default set in <see cref="T:RecrownedAthenaeum.Configuration"/> if left null.</param>
</member>
<member name="M:RecrownedAthenaeum.ScreenSystem.ScreenManager.UpdateCurrentScreen(Microsoft.Xna.Framework.GameTime,System.Boolean)">
<summary>
@ -1170,7 +1182,7 @@
</member>
<member name="P:RecrownedAthenaeum.UI.Modular.Modules.Image.Scale">
<summary>
Overall scale.
Sets scale of X and Y.
</summary>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Image.#ctor(Microsoft.Xna.Framework.Graphics.Texture2D)">
@ -1237,6 +1249,13 @@
<param name="skin">The skin containing the information of the textures and design to follow.</param>
<param name="definitionName">The name of the definition in the skin. Can be null to select the default.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Interactive.Button.#ctor(RecrownedAthenaeum.UI.SkinSystem.ISkin,RecrownedAthenaeum.UI.SkinSystem.Definitions.ButtonSkinDefinition)">
<summary>
Instantiates a button using a definition.
</summary>
<param name="skin">The skin the definition is defined in.</param>
<param name="skinDefinition">The definition itself.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Interactive.Button.Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch)">
<summary>
Draws the button.
@ -1292,6 +1311,15 @@
<param name="skin">The skin to use.</param>
<param name="definitionName">Name of the definition for this type in the skin given.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Interactive.TextButton.#ctor(System.String,Microsoft.Xna.Framework.Graphics.SpriteFont,RecrownedAthenaeum.UI.SkinSystem.ISkin,RecrownedAthenaeum.UI.SkinSystem.Definitions.TextButtonSkinDefinition)">
<summary>
Creates a text button with a given definition.
</summary>
<param name="text">The text to be displayed on this button.</param>
<param name="font">The font to use for this button.</param>
<param name="skin">The skin the definition is from.</param>
<param name="skinDefinition">The definition to use.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Interactive.TextButton.Update(Microsoft.Xna.Framework.GameTime)">
<summary>
Updates the text button.
@ -1341,15 +1369,6 @@
<param name="font">The font to use.</param>
<param name="content">The string for the text.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Text.#ctor(RecrownedAthenaeum.UI.SkinSystem.ISkin,Microsoft.Xna.Framework.Graphics.SpriteFont,System.String,System.String)">
<summary>
Creates a UI text object
</summary>
<param name="skin">The skin to be used.</param>
<param name="skinDefinitionName">The name of the skin's definition to use of a <see cref="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.TextSkinDefinition"/>.</param>
<param name="font">The font to be used.</param>
<param name="content">The string of text to be displayed.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.Modules.Text.Update(Microsoft.Xna.Framework.GameTime)">
<summary>
Updates the positioning and attempts to perform any operations that were marked automatic.
@ -1393,6 +1412,11 @@
Module for UI layout.
</summary>
</member>
<member name="P:RecrownedAthenaeum.UI.Modular.UIModule.Debugging">
<summary>
Draws rectangle using the bounds of this module.
</summary>
</member>
<member name="F:RecrownedAthenaeum.UI.Modular.UIModule.bounds">
<summary>
Bounds of this module.
@ -1466,7 +1490,7 @@
Contains a group of modules and has its own relative coordinate system.
</summary>
</member>
<member name="P:RecrownedAthenaeum.UI.Modular.UIModuleGroup.Camera">
<member name="F:RecrownedAthenaeum.UI.Modular.UIModuleGroup.camera">
<summary>
Camera used by the module for cropping.
</summary>
@ -1476,7 +1500,7 @@
Creates a module group.
</summary>
<param name="crop">Whether or not to crop out of bounds. Default is false.</param>
<param name="camera">What camera to use for cropping. Default is null.</param>
<param name="camera">What camera to use for cropping. Default is null and will use <see cref="T:RecrownedAthenaeum.Configuration"/>'s camera if crop is enabled.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.Modular.UIModuleGroup.Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch)">
<summary>
@ -1541,9 +1565,6 @@
Names for the regions in the texture atlas respectively.
</summary>
</member>
<member name="P:RecrownedAthenaeum.UI.SkinSystem.Definitions.ButtonSkinDefinition.UIModuleType">
<inheritDoc/>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Definitions.ButtonSkinDefinition.#ctor(System.String,System.String)">
<summary>
Constructs the definition with minimum requirements.
@ -1551,14 +1572,19 @@
<param name="downRegion">Name of region specifying the texture shown for when the button is pressed down.</param>
<param name="upRegion">Name of region specifying the texture shown for when the button is not pressed.</param>
</member>
<member name="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData">
<member name="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.SkinDefinitionData">
<summary>
A definition containing the data for the skin system. Should be in data transfer object model.
A definition containing the data for the skin system. Needs to follow data transfer object model.
</summary>
</member>
<member name="P:RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData.UIModuleType">
<member name="F:RecrownedAthenaeum.UI.SkinSystem.Definitions.SkinDefinitionData.uiModuleTypeFullName">
<summary>
The module type this definition is definining.
The full name of the UI module this definition defines.
</summary>
</member>
<member name="P:RecrownedAthenaeum.UI.SkinSystem.Definitions.SkinDefinitionData.UIModuleType">
<summary>
Sets the module type by setting <see cref="F:RecrownedAthenaeum.UI.SkinSystem.Definitions.SkinDefinitionData.uiModuleTypeFullName"/>.
</summary>
</member>
<member name="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.TextButtonSkinDefinition">
@ -1571,11 +1597,6 @@
Name of color from the skin to use for the font.
</summary>
</member>
<member name="P:RecrownedAthenaeum.UI.SkinSystem.Definitions.TextButtonSkinDefinition.UIModuleType">
<summary>
The type of module that will be using this definition.
</summary>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Definitions.TextButtonSkinDefinition.#ctor(System.String,System.String)">
<summary>
Creates this definition with the most minimal requirements.
@ -1607,6 +1628,7 @@
<member name="M:RecrownedAthenaeum.UI.SkinSystem.ISkin.GetColor(System.String)">
<summary>
Returns a <see cref="T:Microsoft.Xna.Framework.Color"/> with given name of defined color;
Should use value "default" if <paramref name="name"/> is null.
</summary>
<param name="name">Name of defined color.</param>
<returns>The defined color based on the name given.</returns>
@ -1618,38 +1640,14 @@
<param name="name">Name of region.</param>
<returns>The region corresponding to the name.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.ISkin.ObtainDefinition(System.String,System.Type)">
<summary>
Returns an <see cref="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData"/> of the given name and type.
</summary>
<param name="definitionName">Name of definition of the <paramref name="type"/></param>
<param name="type">The UIModule the definition defines.</param>
<returns>The interface for the definition.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.ISkin.ObtainDefinition(System.Type)">
<summary>
Returns the default <see cref="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData"/> of the given parameters.
</summary>
<param name="type">The type of definition the default should be coming from.</param>
<returns>The default definition for the given type.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.ISkin.ObtainDefinition``1(System.String,System.Type)">
<member name="M:RecrownedAthenaeum.UI.SkinSystem.ISkin.ObtainDefinition``1(System.String)">
<summary>
Returns the proper definition for the given parameters or throws exception in the case the requested definition does not exist.
</summary>
<typeparam name="T">Convenience to cast to the needed definition type.</typeparam>
<param name="definitionName">The name of the definition.</param>
<param name="type">UIModule type the definition defines.</param>
<param name="definitionName">The name of the definition. Default is null and will be replaced with "default" for name.</param>
<returns>The definition cast to T.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.ISkin.ObtainDefinition``1(System.Type)">
<summary>
Returns the default definition.
</summary>
<typeparam name="T">Convenience to cast to T.</typeparam>
<param name="type">The type of the UIModule to retrieve the default from.</param>
<returns>The default definition for the given type.</returns>
</member>
<member name="T:RecrownedAthenaeum.UI.SkinSystem.Skin">
<summary>
A skin is used to group a theme which can then be applied to the UI via the use of modules.
@ -1674,16 +1672,16 @@
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.GetTextureAtlasRegion(System.String)">
<summary>
Returns a <see cref="T:RecrownedAthenaeum.SpecialTypes.TextureAtlas.Region"/> with given name of region.
Returns a <see cref="T:RecrownedAthenaeum.SpecialTypes.TextureAtlas.Region"/> with given name of region. Null values acceptable. Will return null if parameter is null.
</summary>
<param name="name">Name of region.</param>
<returns>The region corresponding to the name.</returns>
<returns>The region corresponding to the name or null if the requested region doesn't exist.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.GetColor(System.String)">
<summary>
Returns a <see cref="T:Microsoft.Xna.Framework.Color"/> with given name of defined color;
</summary>
<param name="name">Name of defined color.</param>
<param name="name">Name of defined color. Will use "default" if null. Default value is null.</param>
<returns>The defined color based on the name given.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.Draw(System.String,System.String,Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Rectangle,System.Single,Microsoft.Xna.Framework.Vector2)">
@ -1697,43 +1695,19 @@
<param name="rotation">The rotation to use in radians.</param>
<param name="origin">The origin for the rotation.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.ObtainDefinition(System.String,System.Type)">
<summary>
Returns an <see cref="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData"/> of the given name and type.
</summary>
<param name="definitionName">Name of definition of the <paramref name="type"/></param>
<param name="type">The UIModule the definition defines.</param>
<returns>The interface for the definition.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.ObtainDefinition(System.Type)">
<summary>
Returns the default <see cref="T:RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData"/> of the given parameters.
</summary>
<param name="type">The type of definition the default should be coming from.</param>
<returns>The default definition for the given type.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.ObtainDefinition``1(System.String,System.Type)">
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.ObtainDefinition``1(System.String)">
<summary>
Returns the proper definition for the given parameters or throws exception in the case the requested definition does not exist.
</summary>
<typeparam name="T">Convenience to cast to the needed definition type.</typeparam>
<param name="definitionName">The name of the definition.</param>
<param name="type">UIModule type the definition defines.</param>
<returns>The definition cast to T.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.ObtainDefinition``1(System.Type)">
<summary>
Returns the default definition.
</summary>
<typeparam name="T">Convenience to cast to T.</typeparam>
<param name="type">The type of the UIModule to retrieve the default from.</param>
<returns>The default definition for the given type.</returns>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.AddDefinition(System.String,RecrownedAthenaeum.UI.SkinSystem.Definitions.ISkinDefinitionData)">
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.AddDefinition(RecrownedAthenaeum.UI.SkinSystem.Definitions.SkinDefinitionData,System.String)">
<summary>
Adds the definition.
</summary>
<param name="definitionName">The name of the definition.</param>
<param name="definitionName">The name of the definition. Default (if left blank) name is "default".</param>
<param name="skinDefinition">The definition itself.</param>
</member>
<member name="M:RecrownedAthenaeum.UI.SkinSystem.Skin.AddColor(System.String,Microsoft.Xna.Framework.Color)">

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);
}
}