+ Added property "CalculatedWorldScale", what always updates the world scale if required.

~ Changed how items can be inserted to a item collection.
~ AddObject(), AddScript(), RemoveObject(), RemoveScript() are now obsolte.
~ Fixed a issue, where the background was using the default mesh, what caused some visual errors if changed.
This commit is contained in:
Michel Fedde 2021-04-19 20:49:46 +02:00
parent 6cb1fea19a
commit 35c433fa85
7 changed files with 70 additions and 16 deletions

View file

@ -4,6 +4,7 @@ using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using SM.Base.Drawing;
using SM.Base.Objects.Static;
using SM.Base.Scene;
using SM.Base.Textures;
using SM.Base.Window;
@ -53,6 +54,7 @@ namespace SM2D.Drawing
public DrawBackground(Color4 color)
{
Color = color;
Mesh = Plate.Object;
}
/// <summary>
@ -62,6 +64,7 @@ namespace SM2D.Drawing
public DrawBackground(Bitmap texture)
{
Texture = (Texture) texture;
Mesh = Plate.Object;
}
/// <summary>
@ -73,6 +76,7 @@ namespace SM2D.Drawing
{
Color = tint;
Texture = (Texture) texture;
Mesh = Plate.Object;
}

View file

@ -2,6 +2,7 @@
using System;
using OpenTK;
using SM.Base;
using SM.Base.Scene;
using SM.Base.Types;
using SM.Base.Window;
@ -38,6 +39,22 @@ namespace SM2D.Scene
}
}
/// <summary>
/// Will always return a updated version of the world scale.
/// </summary>
public Vector2 CalculatedWorldScale
{
get
{
if (ResizeCounter != _resizeCounter || _updateWorldScale)
{
CalculateWorldScale(SMRenderer.CurrentWindow);
}
return WorldScale;
}
}
/// <summary>
/// The world scale that got calculated.
/// </summary>