Replaced color usage with OpenTK's implementation.
This commit is contained in:
parent
c9ad922341
commit
005d66840d
@ -1,4 +1,6 @@
|
|||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using System;
|
||||||
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Data
|
namespace RecrownedAthenaeum.Data
|
||||||
@ -74,13 +76,13 @@ namespace RecrownedAthenaeum.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">the name to be referenced by.</param>
|
/// <param name="name">the name to be referenced by.</param>
|
||||||
/// <param name="color">The color value <paramref name="name"/> represents.</param>
|
/// <param name="color">The color value <paramref name="name"/> represents.</param>
|
||||||
public ColorData(string name, Color color)
|
public ColorData(string name, Color4 color)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
r = color.r;
|
r = color.GetRedAsByte();
|
||||||
g = color.g;
|
g = color.GetGreenAsByte();
|
||||||
b = color.b;
|
b = color.GetBlueAsByte();
|
||||||
a = color.a;
|
a = color.GetAlphaAsByte();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render
|
namespace RecrownedAthenaeum.Graphics.Render
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
13
RecrownedAthenaeum/Graphics/Render/Batch.cs
Normal file
13
RecrownedAthenaeum/Graphics/Render/Batch.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
namespace RecrownedAthenaeum.Graphics.Render {
|
||||||
|
public class Batch {
|
||||||
|
private bool begun;
|
||||||
|
public Batch() {
|
||||||
|
|
||||||
|
}
|
||||||
|
public void Begin() {
|
||||||
|
if (begun) throw new InvalidOperationException("This batch has already been started.");
|
||||||
|
begun = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render
|
namespace RecrownedAthenaeum.Graphics.Render
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK.Graphics;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using OpenTK;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render
|
namespace RecrownedAthenaeum.Graphics.Render
|
||||||
@ -78,7 +78,7 @@ namespace RecrownedAthenaeum.Graphics.Render
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="vertex">The vector that represents the vertex.</param>
|
/// <param name="vertex">The vector that represents the vertex.</param>
|
||||||
/// <param name="color">The color of that vertex.</param>
|
/// <param name="color">The color of that vertex.</param>
|
||||||
public void AddVertex(Vector2 vertex, Color color)
|
public void AddVertex(Vector2 vertex, Color4 color)
|
||||||
{
|
{
|
||||||
if (!began) throw new InvalidOperationException("Begin needs to be called before adding vertex.");
|
if (!began) throw new InvalidOperationException("Begin needs to be called before adding vertex.");
|
||||||
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
|
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK.Graphics;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using OpenTK;
|
||||||
|
using RecrownedAthenaeum.Types;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Graphics.Render
|
namespace RecrownedAthenaeum.Graphics.Render
|
||||||
@ -73,7 +74,7 @@ namespace RecrownedAthenaeum.Graphics.Render
|
|||||||
/// <param name="height">Height of rectangle.</param>
|
/// <param name="height">Height of rectangle.</param>
|
||||||
/// <param name="color">Color of all vertices of this rectangle.</param>
|
/// <param name="color">Color of all vertices of this rectangle.</param>
|
||||||
/// <param name="rotation">Rotation of rectangle. Default is 0 radians.</param>
|
/// <param name="rotation">Rotation of rectangle. Default is 0 radians.</param>
|
||||||
public void Draw(int x, int y, int width, int height, Color color, float rotation = 0)
|
public void Draw(int x, int y, int width, int height, Color4 color, float rotation = 0)
|
||||||
{
|
{
|
||||||
primitiveBatch.primitiveCount = filled ? 3 : 4;
|
primitiveBatch.primitiveCount = filled ? 3 : 4;
|
||||||
Vector2[] corners = new Vector2[4];
|
Vector2[] corners = new Vector2[4];
|
||||||
@ -110,7 +111,7 @@ namespace RecrownedAthenaeum.Graphics.Render
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rectangle">Uses the x, y and dimensions to draw a rectangle.</param>
|
/// <param name="rectangle">Uses the x, y and dimensions to draw a rectangle.</param>
|
||||||
/// <param name="color">The color of the rectangle.</param>
|
/// <param name="color">The color of the rectangle.</param>
|
||||||
public void Draw(Rectangle rectangle, Color color)
|
public void Draw(Rectangle rectangle, Color4 color)
|
||||||
{
|
{
|
||||||
Draw(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, color);
|
Draw(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, color);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
using RecrownedAthenaeum.Input;
|
using RecrownedAthenaeum.Input;
|
||||||
using RecrownedAthenaeum.Assets;
|
using RecrownedAthenaeum.Assets;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.BookSystem
|
namespace RecrownedAthenaeum.Graphics.UI.BookSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains the pages.
|
/// Contains the pages.
|
@ -1,9 +1,9 @@
|
|||||||
using RecrownedAthenaeum.Assets;
|
using RecrownedAthenaeum.Assets;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.UI.Modular;
|
using RecrownedAthenaeum.Graphics.UI.Modular;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.BookSystem
|
namespace RecrownedAthenaeum.Graphics.UI.BookSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A page a part of a <see cref="Book"/>.
|
/// A page a part of a <see cref="Book"/>.
|
@ -1,8 +1,10 @@
|
|||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular.Modules
|
namespace RecrownedAthenaeum.Graphics.UI.Modular.Modules
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a texture with more information.
|
/// Represents a texture with more information.
|
||||||
@ -62,7 +64,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
|||||||
/// <param name="color">The color tint to use.</param>
|
/// <param name="color">The color tint to use.</param>
|
||||||
/// <param name="rotation">Rotation of image.</param>
|
/// <param name="rotation">Rotation of image.</param>
|
||||||
/// <param name="origin">Origin for the rotation.</param>
|
/// <param name="origin">Origin for the rotation.</param>
|
||||||
public void Draw(ConsistentSpriteBatch spriteBatch, Rectangle destination, Color color, float rotation = 0, Vector2 origin = default(Vector2))
|
public void Draw(ConsistentSpriteBatch spriteBatch, Rectangle destination, Color4 color, float rotation = 0, Vector2 origin = default(Vector2))
|
||||||
{
|
{
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
@ -1,10 +1,10 @@
|
|||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
using RecrownedAthenaeum.Input;
|
using RecrownedAthenaeum.Input;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
namespace RecrownedAthenaeum.Graphics.UI.Modular.Modules.Interactive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Function to be called when button is clicked.
|
/// Function to be called when button is clicked.
|
@ -1,9 +1,9 @@
|
|||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.Types;
|
using OpenTK.Graphics;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
namespace RecrownedAthenaeum.Graphics.UI.Modular.Modules.Interactive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Button that holds a string.
|
/// Button that holds a string.
|
||||||
@ -18,7 +18,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The color the font should be rendered in.
|
/// The color the font should be rendered in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color FontColor { get { return text.color; } set { text.color = value; } }
|
public Color4 FontColor { get { return text.color; } set { text.color = value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs text button with the positions represented by <see cref="ISpecialDrawable"/>
|
/// Constructs text button with the positions represented by <see cref="ISpecialDrawable"/>
|
@ -1,10 +1,9 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular.Modules
|
namespace RecrownedAthenaeum.Graphics.UI.Modular.Modules
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents text for the UI.
|
/// Represents text for the UI.
|
@ -1,11 +1,13 @@
|
|||||||
using RecrownedAthenaeum.Input;
|
using RecrownedAthenaeum.Input;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular.Modules
|
namespace RecrownedAthenaeum.Graphics.UI.Modular.Modules
|
||||||
{
|
{
|
||||||
public class UIScrollable : UIModule
|
public class UIScrollable : UIModule
|
||||||
{
|
{
|
||||||
@ -13,7 +15,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
|||||||
Rectangle viewport;
|
Rectangle viewport;
|
||||||
UIModuleGroup group;
|
UIModuleGroup group;
|
||||||
|
|
||||||
Color scrollBarColor = Color.White;
|
Color4 scrollBarColor = Color4.White;
|
||||||
float opacityOfBar = 1f;
|
float opacityOfBar = 1f;
|
||||||
bool showingBars;
|
bool showingBars;
|
||||||
private bool mouseWasPressed;
|
private bool mouseWasPressed;
|
||||||
@ -105,7 +107,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
|||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
opacityOfBar = 1f;
|
opacityOfBar = 1f;
|
||||||
scrollBarColor = color * opacityOfBar;
|
scrollBarColor = color.ReturnMultipliedByFloat(opacityOfBar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +209,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
|||||||
{
|
{
|
||||||
opacityOfBar = 1f;
|
opacityOfBar = 1f;
|
||||||
}
|
}
|
||||||
scrollBarColor = color * opacityOfBar;
|
scrollBarColor = color.ReturnMultipliedByFloat(opacityOfBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (horScrollAvailable)
|
if (horScrollAvailable)
|
@ -1,10 +1,11 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using RecrownedAthenaeum.Types;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using RecrownedAthenaeum.Input;
|
using RecrownedAthenaeum.Input;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular
|
namespace RecrownedAthenaeum.Graphics.UI.Modular
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -61,7 +62,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The color tint of this module.
|
/// The color tint of this module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color color = Color.White;
|
public Color4 color = Color4.White;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called every frame to update this module. Calculations and movement should go here.
|
/// Called every frame to update this module. Calculations and movement should go here.
|
@ -4,7 +4,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular
|
namespace RecrownedAthenaeum.Graphics.UI.Modular
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
@ -2,7 +2,7 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.ScreenSystem
|
namespace RecrownedAthenaeum.Graphics.UI.ScreenSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contracts a transition that the <see cref="ScreenManager"/> can use.
|
/// Contracts a transition that the <see cref="ScreenManager"/> can use.
|
@ -1,10 +1,10 @@
|
|||||||
|
using OpenTK.Graphics;
|
||||||
using Microsoft.Xna.Framework;
|
using OpenTK;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
|
using RecrownedAthenaeum.Types;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.ScreenSystem
|
namespace RecrownedAthenaeum.Graphics.UI.ScreenSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A screen specifically meant to fill in loading times.
|
/// A screen specifically meant to fill in loading times.
|
||||||
@ -15,7 +15,7 @@ namespace RecrownedAthenaeum.UI.ScreenSystem
|
|||||||
private const float EXIT_TIME = 1f;
|
private const float EXIT_TIME = 1f;
|
||||||
Game game;
|
Game game;
|
||||||
readonly Texture2D texture;
|
readonly Texture2D texture;
|
||||||
Color color;
|
Color4 color;
|
||||||
Rectangle textureBounds;
|
Rectangle textureBounds;
|
||||||
readonly float proportion;
|
readonly float proportion;
|
||||||
bool recorded;
|
bool recorded;
|
||||||
@ -62,7 +62,7 @@ namespace RecrownedAthenaeum.UI.ScreenSystem
|
|||||||
/// <param name="dimensions">The window dimensions.</param>
|
/// <param name="dimensions">The window dimensions.</param>
|
||||||
public void InitiateTransition(Rectangle dimensions)
|
public void InitiateTransition(Rectangle dimensions)
|
||||||
{
|
{
|
||||||
color = Color.White;
|
color = Color4.White;
|
||||||
textureBounds.Width = (int)(height * proportion);
|
textureBounds.Width = (int)(height * proportion);
|
||||||
textureBounds.Height = (int)(height * proportion);
|
textureBounds.Height = (int)(height * proportion);
|
||||||
textureBounds.X = (width) / 2;
|
textureBounds.X = (width) / 2;
|
||||||
@ -108,9 +108,9 @@ namespace RecrownedAthenaeum.UI.ScreenSystem
|
|||||||
{
|
{
|
||||||
if (!recorded)
|
if (!recorded)
|
||||||
{
|
{
|
||||||
rR = (Color.White.R - BackgroundColor.R) / ENTER_TIME;
|
rR = (Color4.White.R - BackgroundColor.R) / ENTER_TIME;
|
||||||
rG = (Color.White.G - BackgroundColor.G) / ENTER_TIME;
|
rG = (Color4.White.G - BackgroundColor.G) / ENTER_TIME;
|
||||||
rB = (Color.White.B - BackgroundColor.B) / ENTER_TIME;
|
rB = (Color4.White.B - BackgroundColor.B) / ENTER_TIME;
|
||||||
recorded = true;
|
recorded = true;
|
||||||
}
|
}
|
||||||
progR += rR * deltaf;
|
progR += rR * deltaf;
|
@ -1,9 +1,8 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK.Graphics;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.ScreenSystem
|
namespace RecrownedAthenaeum.Graphics.UI.ScreenSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one of the poosible states a screen can be in.
|
/// Represents one of the poosible states a screen can be in.
|
||||||
@ -41,7 +40,7 @@ namespace RecrownedAthenaeum.UI.ScreenSystem
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The background color to be used to clear the screen.
|
/// The background color to be used to clear the screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BackgroundColor;
|
public Color4 BackgroundColor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The next screen to be displayed after exit transition finishes. May be null, leading to transition to previous screen or loading screen.
|
/// The next screen to be displayed after exit transition finishes. May be null, leading to transition to previous screen or loading screen.
|
@ -1,10 +1,9 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK.Graphics;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.ScreenSystem
|
namespace RecrownedAthenaeum.Graphics.UI.ScreenSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the first screen is being shown.
|
/// Called when the first screen is being shown.
|
||||||
@ -55,7 +54,7 @@ namespace RecrownedAthenaeum.UI.ScreenSystem
|
|||||||
previousScreenRenderTarget = new RenderTarget2D(graphics.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
|
previousScreenRenderTarget = new RenderTarget2D(graphics.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
|
||||||
}
|
}
|
||||||
graphics.GraphicsDevice.SetRenderTarget(previousScreenRenderTarget);
|
graphics.GraphicsDevice.SetRenderTarget(previousScreenRenderTarget);
|
||||||
graphics.GraphicsDevice.Clear(Color.Black);
|
graphics.GraphicsDevice.Clear(Color4.Black);
|
||||||
|
|
||||||
Debug.WriteLine("Showing " + value.GetType().Name);
|
Debug.WriteLine("Showing " + value.GetType().Name);
|
||||||
Screen.Show();
|
Screen.Show();
|
@ -1,6 +1,6 @@
|
|||||||
using RecrownedAthenaeum.UI.Modular.Modules.Interactive;
|
using RecrownedAthenaeum.Graphics.UI.Modular.Modules.Interactive;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skin definition for a button.
|
/// Skin definition for a button.
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A definition containing the data for the skin system. Needs to follow data transfer object model.
|
/// A definition containing the data for the skin system. Needs to follow data transfer object model.
|
@ -1,6 +1,6 @@
|
|||||||
using RecrownedAthenaeum.UI.Modular.Modules.Interactive;
|
using RecrownedAthenaeum.Graphics.UI.Modular.Modules.Interactive;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Definition for a text button for a skin theme.
|
/// Definition for a text button for a skin theme.
|
@ -1,11 +1,11 @@
|
|||||||
using RecrownedAthenaeum.UI.Modular.Modules;
|
using RecrownedAthenaeum.Graphics.UI.Modular.Modules;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skin definition of a scroll module.
|
/// Skin definition of a scroll module.
|
@ -1,8 +1,10 @@
|
|||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The output requirements of a skin. This allows for very customized skin systems if needed.
|
/// The output requirements of a skin. This allows for very customized skin systems if needed.
|
||||||
@ -31,7 +33,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">Name of defined color.</param>
|
/// <param name="name">Name of defined color.</param>
|
||||||
/// <returns>The defined color based on the name given.</returns>
|
/// <returns>The defined color based on the name given.</returns>
|
||||||
Color GetColor(string name = null);
|
Color4 GetColor(string name = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="TextureAtlas.Region"/> with given name of region.
|
/// Returns a <see cref="TextureAtlas.Region"/> with given name of region.
|
@ -2,9 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem
|
||||||
{
|
{
|
||||||
internal class MergedSkin : ISkin
|
internal class MergedSkin : ISkin
|
||||||
{
|
{
|
||||||
@ -44,7 +46,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color GetColor(string name)
|
public Color4 GetColor(string name)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
@ -1,12 +1,12 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using RecrownedAthenaeum.Graphics.Render;
|
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem.Definitions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A skin is used to group a theme which can then be applied to the UI via the use of modules.
|
/// A skin is used to group a theme which can then be applied to the UI via the use of modules.
|
||||||
@ -21,7 +21,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
|
|
||||||
private TextureAtlas textureAtlas;
|
private TextureAtlas textureAtlas;
|
||||||
|
|
||||||
Dictionary<string, Color> colors;
|
Dictionary<string, Color4> colors;
|
||||||
readonly Dictionary<string, string> definitionOfType;
|
readonly Dictionary<string, string> definitionOfType;
|
||||||
readonly Dictionary<string, Dictionary<string, SkinDefinitionData>> definitions;
|
readonly Dictionary<string, Dictionary<string, SkinDefinitionData>> definitions;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
{
|
{
|
||||||
this.textureAtlas = textureAtlas;
|
this.textureAtlas = textureAtlas;
|
||||||
this.CursorTexture = cursorTexture;
|
this.CursorTexture = cursorTexture;
|
||||||
colors = new Dictionary<string, Color>();
|
colors = new Dictionary<string, Color4>();
|
||||||
definitionOfType = new Dictionary<string, string>();
|
definitionOfType = new Dictionary<string, string>();
|
||||||
definitions = new Dictionary<string, Dictionary<string, SkinDefinitionData>>();
|
definitions = new Dictionary<string, Dictionary<string, SkinDefinitionData>>();
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">Name of defined color. Will use "default" if null. Default value is null.</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>
|
/// <returns>The defined color based on the name given.</returns>
|
||||||
public Color GetColor(string name = null)
|
public Color4 GetColor(string name = null)
|
||||||
{
|
{
|
||||||
if (name == null) name = "default";
|
if (name == null) name = "default";
|
||||||
return colors[name];
|
return colors[name];
|
||||||
@ -133,7 +133,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="color"></param>
|
/// <param name="color"></param>
|
||||||
public void AddColor(string name, Color color)
|
public void AddColor(string name, Color4 color)
|
||||||
{
|
{
|
||||||
if (Laminated) throw new InvalidOperationException("This skin has been laminated and cannot be edited.");
|
if (Laminated) throw new InvalidOperationException("This skin has been laminated and cannot be edited.");
|
||||||
colors.Add(name, color);
|
colors.Add(name, color);
|
@ -1,7 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using OpenTK;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using OpenTK.Graphics;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using RecrownedAthenaeum.ContentReaders;
|
|
||||||
using RecrownedAthenaeum.Data;
|
using RecrownedAthenaeum.Data;
|
||||||
using RecrownedAthenaeum.Types;
|
using RecrownedAthenaeum.Types;
|
||||||
using System;
|
using System;
|
||||||
@ -9,7 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.SkinSystem
|
namespace RecrownedAthenaeum.Graphics.UI.SkinSystem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the skin manager has completed a async action.
|
/// Called when the skin manager has completed a async action.
|
||||||
@ -170,7 +169,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
atlasTexture.GetData(data);
|
atlasTexture.GetData(data);
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
Color.FromNonPremultiplied(data[i]);
|
Color4Ext.FromNonPremultiplied(ref data[i]);
|
||||||
}
|
}
|
||||||
atlasTexture.SetData(data);
|
atlasTexture.SetData(data);
|
||||||
}
|
}
|
||||||
@ -186,7 +185,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
atlasTexture.GetData(data);
|
atlasTexture.GetData(data);
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
{
|
{
|
||||||
Color.FromNonPremultiplied(data[i]);
|
Color4Ext.FromNonPremultiplied(ref data[i]);
|
||||||
}
|
}
|
||||||
cursorTexture.SetData(data);
|
cursorTexture.SetData(data);
|
||||||
}
|
}
|
||||||
@ -200,7 +199,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
|||||||
for (int i = 0; i < skinData.colors.Length; i++)
|
for (int i = 0; i < skinData.colors.Length; i++)
|
||||||
{
|
{
|
||||||
SkinData.ColorData colorData = skinData.colors[i];
|
SkinData.ColorData colorData = skinData.colors[i];
|
||||||
skin.AddColor(colorData.name, new Color(colorData.r, colorData.g, colorData.b, colorData.a));
|
skin.AddColor(colorData.name, new Color4(colorData.r, colorData.g, colorData.b, colorData.a));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < skinData.definitions.Length; i++)
|
for (int i = 0; i < skinData.definitions.Length; i++)
|
@ -1,40 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace RecrownedAthenaeum.Types
|
|
||||||
{
|
|
||||||
public struct Color
|
|
||||||
{
|
|
||||||
public byte r, g, b, a;
|
|
||||||
public float R {
|
|
||||||
set {
|
|
||||||
r = (byte)Math.Min(Math.Round(Byte.MaxValue * value), Byte.MaxValue);
|
|
||||||
}
|
|
||||||
get {
|
|
||||||
return r / (float)(byte.MaxValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public float G {
|
|
||||||
set {
|
|
||||||
g = (byte)Math.Min(Math.Round(Byte.MaxValue * value), Byte.MaxValue);
|
|
||||||
}
|
|
||||||
get {
|
|
||||||
return g / (float)(byte.MaxValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public float B {
|
|
||||||
set {
|
|
||||||
g = (byte)Math.Min(Math.Round(Byte.MaxValue * value), Byte.MaxValue);
|
|
||||||
}
|
|
||||||
get {
|
|
||||||
return g / (float)(byte.MaxValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public float A {
|
|
||||||
set {
|
|
||||||
a = (byte)Math.Min(Math.Round(Byte.MaxValue * value), Byte.MaxValue);
|
|
||||||
}
|
|
||||||
get {
|
|
||||||
return a / (float)(byte.MaxValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
33
RecrownedAthenaeum/Types/Extensions.cs
Normal file
33
RecrownedAthenaeum/Types/Extensions.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
namespace RecrownedAthenaeum.Types {
|
||||||
|
public static class Color4Ext {
|
||||||
|
public static byte GetRedAsByte(this Color4 color) {
|
||||||
|
return (byte) (color.R * Byte.MaxValue);
|
||||||
|
}
|
||||||
|
public static byte GetGreenAsByte(this Color4 color) {
|
||||||
|
return (byte) (color.G * Byte.MaxValue);
|
||||||
|
}
|
||||||
|
public static byte GetBlueAsByte(this Color4 color) {
|
||||||
|
return (byte) (color.B * Byte.MaxValue);
|
||||||
|
}
|
||||||
|
public static byte GetAlphaAsByte(this Color4 color) {
|
||||||
|
return (byte) (color.A * Byte.MaxValue);
|
||||||
|
}
|
||||||
|
public static void MultiplyByFloat(this Color4 color, float val) {
|
||||||
|
color.A *= val;
|
||||||
|
color.R *= val;
|
||||||
|
color.G *= val;
|
||||||
|
color.B *= val;
|
||||||
|
}
|
||||||
|
public static Color4 ReturnMultipliedByFloat(this Color4 color, float val) {
|
||||||
|
Color4 output = new Color4(color.R * val, color.G * val, color.B * val, color.A * val);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
public static void FromNonPremultiplied(ref Vector4 vector) {
|
||||||
|
//Premultiplied.
|
||||||
|
vector = new Vector4(vector.W * vector.X, vector.W * vector.Y, vector.W * vector.Z, vector.W);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
using RecrownedAthenaeum.Graphics.Render;
|
using RecrownedAthenaeum.Graphics.Render;
|
||||||
using System;
|
using System;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Types
|
namespace RecrownedAthenaeum.Types
|
||||||
{
|
{
|
||||||
@ -83,7 +85,7 @@ namespace RecrownedAthenaeum.Types
|
|||||||
/// <param name="spriteBatch">Batch to use.</param>
|
/// <param name="spriteBatch">Batch to use.</param>
|
||||||
/// <param name="color">The color of the patch.</param>
|
/// <param name="color">The color of the patch.</param>
|
||||||
/// <param name="destination">Where to the patch.</param>
|
/// <param name="destination">Where to the patch.</param>
|
||||||
public void Draw(ConsistentSpriteBatch spriteBatch, Color color, Rectangle destination)
|
public void Draw(ConsistentSpriteBatch spriteBatch, Color4 color, Rectangle destination)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -114,7 +116,7 @@ namespace RecrownedAthenaeum.Types
|
|||||||
/// <param name="color">The tint for each patch.</param>
|
/// <param name="color">The tint for each patch.</param>
|
||||||
/// <param name="rotation">Not considered for 9patches.</param>
|
/// <param name="rotation">Not considered for 9patches.</param>
|
||||||
/// <param name="origin">Not considered for 9patches.</param>
|
/// <param name="origin">Not considered for 9patches.</param>
|
||||||
public void Draw(ConsistentSpriteBatch spriteBatch, Rectangle destination, Color color, float rotation = 0, Vector2 origin = default(Vector2))
|
public void Draw(ConsistentSpriteBatch spriteBatch, Rectangle destination, Color4 color, float rotation = 0, Vector2 origin = default(Vector2))
|
||||||
{
|
{
|
||||||
if (rotation != 0) throw new NotImplementedException("Ninepatches can't be rotated.");
|
if (rotation != 0) throw new NotImplementedException("Ninepatches can't be rotated.");
|
||||||
if (origin != default(Vector2))
|
if (origin != default(Vector2))
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Types
|
namespace RecrownedAthenaeum.Types
|
||||||
{
|
{
|
||||||
@ -55,7 +57,7 @@ namespace RecrownedAthenaeum.Types
|
|||||||
/// <param name="color">Color to use.</param>
|
/// <param name="color">Color to use.</param>
|
||||||
/// <param name="rotation">Rotation of texture drawn.</param>
|
/// <param name="rotation">Rotation of texture drawn.</param>
|
||||||
/// <param name="origin">Origin used by rotation.</param>
|
/// <param name="origin">Origin used by rotation.</param>
|
||||||
public void Draw(string name, ConsistentSpriteBatch batch, Rectangle destination, Color color = default(Color), float rotation = 0, Vector2 origin = new Vector2())
|
public void Draw(string name, ConsistentSpriteBatch batch, Rectangle destination, Color4 color = default(Color4), float rotation = 0, Vector2 origin = new Vector2())
|
||||||
{
|
{
|
||||||
dictionaryOfRegions[name].Draw(batch, destination, color, rotation, origin);
|
dictionaryOfRegions[name].Draw(batch, destination, color, rotation, origin);
|
||||||
}
|
}
|
||||||
@ -166,7 +168,7 @@ namespace RecrownedAthenaeum.Types
|
|||||||
/// <param name="color">The color to use.</param>
|
/// <param name="color">The color to use.</param>
|
||||||
/// <param name="rotation">Rotation of the final drawing. Ignored if is a 9patch.</param>
|
/// <param name="rotation">Rotation of the final drawing. Ignored if is a 9patch.</param>
|
||||||
/// <param name="origin">The origin of the drawing. Ignored if is a 9patch.</param>
|
/// <param name="origin">The origin of the drawing. Ignored if is a 9patch.</param>
|
||||||
public void Draw(ConsistentSpriteBatch batch, Rectangle destination, Color color, float rotation = 0, Vector2 origin = default(Vector2))
|
public void Draw(ConsistentSpriteBatch batch, Rectangle destination, Color4 color, float rotation = 0, Vector2 origin = default(Vector2))
|
||||||
{
|
{
|
||||||
if (Disposed) throw new ObjectDisposedException(GetType().Name);
|
if (Disposed) throw new ObjectDisposedException(GetType().Name);
|
||||||
|
|
||||||
@ -191,7 +193,7 @@ namespace RecrownedAthenaeum.Types
|
|||||||
|
|
||||||
if (regionTexture == null)
|
if (regionTexture == null)
|
||||||
{
|
{
|
||||||
Color[] data = new Color[sourceRectangle.Width * sourceRectangle.Height];
|
Color4[] data = new Color4[sourceRectangle.Width * sourceRectangle.Height];
|
||||||
regionTexture = new Texture2D(graphicsDevice, sourceRectangle.Width, sourceRectangle.Height);
|
regionTexture = new Texture2D(graphicsDevice, sourceRectangle.Width, sourceRectangle.Height);
|
||||||
atlasTexture.GetData(0, sourceRectangle, data, 0, sourceRectangle.Width * sourceRectangle.Height);
|
atlasTexture.GetData(0, sourceRectangle, data, 0, sourceRectangle.Width * sourceRectangle.Height);
|
||||||
regionTexture.SetData(data);
|
regionTexture.SetData(data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user