screens update normal logic during transition now; added comments; book now has an initiate function; image has more functions; minor improvements on module system;

This commit is contained in:
2018-11-15 01:22:19 -06:00
parent e00f89325d
commit 507cde744d
7 changed files with 82 additions and 23 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using RhythmBullet.Zer01HD.UI.Modular;
using System;
using System.Collections.Generic;
@@ -10,16 +11,51 @@ namespace RhythmBullet.Zer01HD.Utilities.UI.Modular.Modules
{
class Image : UIModule
{
Texture2D texture;
public Texture2D Texture { get; set; }
public float ScaleX
{
get
{
return (float)Bounds.Width / Texture.Width;
}
set
{
Bounds.Width = (int)(Texture.Width * value);
}
}
public float ScaleY
{
get
{
return (float)Bounds.Height / Texture.Height;
}
set
{
Bounds.Height = (int)(Texture.Height * value);
}
}
public float Scale
{
set
{
Bounds.Height = (int)(Texture.Height * value);
Bounds.Width = (int)(Texture.Width * value);
}
}
public Image(Texture2D texture)
{
this.texture = texture;
Texture = texture ?? throw new ArgumentException("Image requires a texture.");
Bounds = texture.Bounds;
}
public override void Draw(SpriteBatch batch)
{
batch.Draw(texture, Bounds, Color);
batch.Draw(Texture, Bounds, Color);
base.Draw(batch);
}
}

View File

@@ -16,7 +16,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
public Rectangle Bounds;
public UIModuleGroup Parent;
public string Name;
public Color Color;
public Color Color = Color.White;
public virtual void Update(GameTime gameTime)
{

View File

@@ -18,7 +18,7 @@ namespace RhythmBullet.Zer01HD.UI.Modular
RasterizerState scissorRasterizer = new RasterizerState();
public Camera2D Camera { get; set; }
public UIModuleGroup(Camera2D camera = null, bool crop = false)
public UIModuleGroup(bool crop = false, Camera2D camera = null)
{
Camera = camera;
if (crop)