07.10.2020

+ Parent, Name and Flags to objects.

~ Improved Matrix calculations
This commit is contained in:
Michel Fedde 2020-10-08 12:25:20 +02:00
parent f865496414
commit 2c00dbd31a
21 changed files with 383 additions and 42 deletions

View file

@ -1,4 +1,5 @@
using SM.Base.Contexts; using System.Collections.Generic;
using SM.Base.Contexts;
using SM.Base.Objects.Static; using SM.Base.Objects.Static;
using SM.OGL.Mesh; using SM.OGL.Mesh;
@ -16,7 +17,16 @@ namespace SM.Base.Scene
/// <summary> /// <summary>
/// The mesh it should use. /// The mesh it should use.
/// </summary> /// </summary>
protected GenericMesh _mesh = Defaults.DefaultMesh; protected GenericMesh _mesh = SMRenderer.DefaultMesh;
/// <inheritdoc />
public object Parent { get; set; }
/// <inheritdoc />
public string Name { get; set; } = "Unnamed draw object";
/// <inheritdoc />
public ICollection<string> Flags { get; set; }
/// <inheritdoc /> /// <inheritdoc />
public virtual void Update(UpdateContext context) public virtual void Update(UpdateContext context)
@ -33,6 +43,18 @@ namespace SM.Base.Scene
DrawContext(ref context); DrawContext(ref context);
} }
/// <inheritdoc />
public virtual void OnAdded(object sender)
{
}
/// <inheritdoc />
public virtual void OnRemoved(object sender)
{
}
/// <summary> /// <summary>
/// Draws the context, that was given to them. /// Draws the context, that was given to them.
/// </summary> /// </summary>

View file

@ -7,10 +7,34 @@ namespace SM.Base.Scene
/// </summary> /// </summary>
public abstract class GenericTransformation public abstract class GenericTransformation
{ {
/// <summary>
/// Contains the current model matrix.
/// </summary>
protected Matrix4 _modelMatrix { get; private set; }
/// <summary>
/// Contains the last frame the matrix was calculated.
/// </summary>
protected ulong _lastFrame { get; private set; }
/// <summary>
/// Returns the current model matrix.
/// </summary>
/// <returns></returns>
public Matrix4 GetMatrix()
{
if (_lastFrame != SMRenderer.CurrentFrame)
{
_lastFrame = SMRenderer.CurrentFrame;
_modelMatrix = RequestMatrix();
}
return _modelMatrix;
}
/// <summary> /// <summary>
/// Calculates the current matrix. /// Calculates the current matrix.
/// </summary> /// </summary>
/// <returns>The current matrix.</returns> /// <returns>The current matrix.</returns>
public abstract Matrix4 GetMatrix(); protected abstract Matrix4 RequestMatrix();
} }
} }

View file

@ -0,0 +1,16 @@
using System.Collections.Generic;
using SM.OGL.Framebuffer;
namespace SM.Base.PostProcessing
{
public abstract class PostProcessingEffect
{
public virtual Dictionary<string, int> AdditionalFramebufferOutputs { get; }
public virtual ICollection<Framebuffer> AdditionalFramebuffers { get; }
public void ApplyOutputs(Framebuffer mainbuffer)
{
mainbuffer.Append();
}
}
}

View file

@ -52,18 +52,19 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Controls\Mouse.cs" /> <Compile Include="Controls\Mouse.cs" />
<Compile Include="Defaults.cs" />
<Compile Include="Drawing\DrawingBasis.cs" /> <Compile Include="Drawing\DrawingBasis.cs" />
<Compile Include="Drawing\GenericTransformation.cs" /> <Compile Include="Drawing\GenericTransformation.cs" />
<Compile Include="Drawing\Instance.cs" /> <Compile Include="Drawing\Instance.cs" />
<Compile Include="Drawing\IShader.cs" /> <Compile Include="Drawing\IShader.cs" />
<Compile Include="Log.cs" /> <Compile Include="Log.cs" />
<Compile Include="Objects\Mesh.cs" /> <Compile Include="Objects\Mesh.cs" />
<Compile Include="PostProcessing\PostProcessingEffect.cs" />
<Compile Include="Scene\IShowCollection.cs" /> <Compile Include="Scene\IShowCollection.cs" />
<Compile Include="Scene\IShowItem.cs" /> <Compile Include="Scene\IShowItem.cs" />
<Compile Include="Drawing\Material.cs" /> <Compile Include="Drawing\Material.cs" />
<Compile Include="Scene\IBackgroundItem.cs" /> <Compile Include="Scene\IBackgroundItem.cs" />
<Compile Include="Scene\GenericItemCollection.cs" /> <Compile Include="Scene\GenericItemCollection.cs" />
<Compile Include="SMRenderer.cs" />
<Compile Include="Textures\Texture.cs" /> <Compile Include="Textures\Texture.cs" />
<Compile Include="Text\CharParameter.cs" /> <Compile Include="Text\CharParameter.cs" />
<Compile Include="Text\Font.cs" /> <Compile Include="Text\Font.cs" />
@ -79,6 +80,7 @@
<Compile Include="Utility\Assembly.cs" /> <Compile Include="Utility\Assembly.cs" />
<Compile Include="Utility\Deltatime.cs" /> <Compile Include="Utility\Deltatime.cs" />
<Compile Include="Utility\Randomize.cs" /> <Compile Include="Utility\Randomize.cs" />
<Compile Include="Utility\RotationUtility.cs" />
<Compile Include="Window\Contexts\DrawContext.cs" /> <Compile Include="Window\Contexts\DrawContext.cs" />
<Compile Include="Window\Contexts\UpdateContext.cs" /> <Compile Include="Window\Contexts\UpdateContext.cs" />
<Compile Include="Window\GenericWindow.cs" /> <Compile Include="Window\GenericWindow.cs" />

View file

@ -1,6 +1,4 @@
using SM.Base.Objects; using SM.Base.Objects.Static;
using SM.Base.Objects.Static;
using SM.Base.Scene;
using SM.Base.Text; using SM.Base.Text;
using SM.OGL.Mesh; using SM.OGL.Mesh;
using SM.Utility; using SM.Utility;
@ -8,9 +6,9 @@ using SM.Utility;
namespace SM.Base namespace SM.Base
{ {
/// <summary> /// <summary>
/// The default options. /// Contains different information about this renderer.
/// </summary> /// </summary>
public class Defaults public class SMRenderer
{ {
/// <summary> /// <summary>
/// The default mesh. /// The default mesh.
@ -26,5 +24,10 @@ namespace SM.Base
/// The default deltatime helper. /// The default deltatime helper.
/// </summary> /// </summary>
public static Deltatime DefaultDeltatime = new Deltatime(); public static Deltatime DefaultDeltatime = new Deltatime();
/// <summary>
/// Current Frame
/// </summary>
public static ulong CurrentFrame { get; internal set; } = 0;
} }
} }

View file

@ -14,7 +14,37 @@ namespace SM.Base.Scene
public List<TItem> Objects => this; public List<TItem> Objects => this;
/// <inheritdoc /> /// <inheritdoc />
public void Update(UpdateContext context) public object Parent { get; set; }
/// <inheritdoc />
public string Name { get; set; } = "Unnamed Item Collection";
/// <inheritdoc />
public ICollection<string> Flags { get; set; } = new[] {"collection"};
/// <summary>
/// Adds a item.
/// </summary>
public new void Add(TItem item)
{
base.Add(item);
item.Parent = this;
item.OnAdded(this);
}
/// <summary>
/// Removes a item.
/// </summary>
/// <param name="item"></param>
public new void Remove(TItem item)
{
base.Remove(item);
item.Parent = null;
item.OnRemoved(this);
}
/// <inheritdoc />
public virtual void Update(UpdateContext context)
{ {
for(int i = 0; i < Objects.Count; i++) for(int i = 0; i < Objects.Count; i++)
this[i].Update(context); this[i].Update(context);
@ -26,6 +56,64 @@ namespace SM.Base.Scene
for (int i = 0; i < Objects.Count; i++) for (int i = 0; i < Objects.Count; i++)
this[i].Draw(context); this[i].Draw(context);
} }
/// <inheritdoc />
public virtual void OnAdded(object sender)
{
}
/// <inheritdoc />
public virtual void OnRemoved(object sender)
{ }
/// <summary>
/// Returns a object with this name or the default, if not available.
/// <para>Not reclusive.</para>
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public TItem GetItemByName(string name)
{
TItem obj = default;
for (var i = 0; i < this.Count; i++)
{
if (this[i].Name == name)
{
obj = this[i];
break;
}
}
return obj;
}
/// <summary>
/// Returns a object with this name or the default if not available.
/// <para>Not reclusive.</para>
/// </summary>
/// <typeparam name="TGetItem">Type of return</typeparam>
public TGetItem GetItemByName<TGetItem>(string name)
where TGetItem : TItem
{
return (TGetItem)GetItemByName(name);
}
/// <summary>
/// Returns all object that have this flag.
/// <para>Only in this list.</para>
/// </summary>
public ICollection<TItem> GetItemsWithFlag(string flag)
{
List<TItem> list = new List<TItem>();
for (var i = 0; i < this.Count; i++)
{
TItem obj = this[i];
if (obj.Flags.Contains(flag)) list.Add(obj);
}
return list;
}
} }
/// <summary> /// <summary>
@ -45,7 +133,7 @@ namespace SM.Base.Scene
/// <inheritdoc /> /// <inheritdoc />
public override void Draw(DrawContext context) public override void Draw(DrawContext context)
{ {
context.View = Transform.GetMatrix() * context.View; context.ModelMaster = Transform.GetMatrix() * context.ModelMaster;
base.Draw(context); base.Draw(context);
} }

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using OpenTK; using OpenTK;
using SM.Base.Contexts; using SM.Base.Contexts;
@ -9,10 +10,29 @@ namespace SM.Base.Scene
/// </summary> /// </summary>
public abstract class GenericScene public abstract class GenericScene
{ {
private IBackgroundItem _background;
/// <summary> /// <summary>
/// This contains the background. /// This contains the background.
/// </summary> /// </summary>
protected IBackgroundItem _background; protected IBackgroundItem _Background
{
get => _background;
set
{
value.Parent = this;
_background = value;
}
}
/// <summary>
/// Updates this scene.
/// </summary>
/// <param name="context"></param>
public virtual void Update(UpdateContext context)
{
}
/// <summary> /// <summary>
/// Draws this scene. /// Draws this scene.
@ -48,6 +68,9 @@ namespace SM.Base.Scene
where TCollection : GenericItemCollection<TItem>, new() where TCollection : GenericItemCollection<TItem>, new()
where TItem : IShowItem where TItem : IShowItem
{ {
private TCollection _objectCollection = new TCollection();
private TCollection _hud = new TCollection();
/// <summary> /// <summary>
/// The active camera, that is used if the context doesn't force the viewport camera. /// The active camera, that is used if the context doesn't force the viewport camera.
/// <para>If none set, it automaticly uses the viewport camera.</para> /// <para>If none set, it automaticly uses the viewport camera.</para>
@ -65,16 +88,42 @@ namespace SM.Base.Scene
/// <summary> /// <summary>
/// Objects inside the scene. /// Objects inside the scene.
/// </summary> /// </summary>
public TCollection Objects { get; set; } = new TCollection(); public TCollection Objects
{
get => _objectCollection;
set
{
value.Parent = this;
_objectCollection = value;
}
}
/// <summary> /// <summary>
/// This defines the HUD objects. /// This defines the HUD objects.
/// </summary> /// </summary>
public TCollection HUD { get; } = new TCollection(); public TCollection HUD
{
get => _hud;
set
{
value.Parent = this;
_hud = value;
}
}
/// <summary> /// <summary>
/// A collection for cameras to switch easier to different cameras. /// A collection for cameras to switch easier to different cameras.
/// </summary> /// </summary>
public Dictionary<string, TCamera> Cameras = new Dictionary<string, TCamera>(); public Dictionary<string, TCamera> Cameras = new Dictionary<string, TCamera>();
/// <inheritdoc />
public override void Update(UpdateContext context)
{
_Background?.Update(context);
_objectCollection.Update(context);
_hud.Update(context);
}
/// <inheritdoc /> /// <inheritdoc />
public override void Draw(DrawContext context) public override void Draw(DrawContext context)
{ {
@ -82,12 +131,12 @@ namespace SM.Base.Scene
DrawContext backgroundDrawContext = context; DrawContext backgroundDrawContext = context;
backgroundDrawContext.View = BackgroundCamera.CalculateViewMatrix(); backgroundDrawContext.View = BackgroundCamera.CalculateViewMatrix();
_background?.Draw(backgroundDrawContext); _Background?.Draw(backgroundDrawContext);
Objects.Draw(context); _objectCollection.Draw(context);
context.View = HUDCamera.CalculateViewMatrix(); context.View = HUDCamera.CalculateViewMatrix();
HUD.Draw(context); _hud.Draw(context);
} }
} }
} }

View file

@ -1,4 +1,5 @@
using SM.Base.Contexts; using System.Collections.Generic;
using SM.Base.Contexts;
namespace SM.Base.Scene namespace SM.Base.Scene
{ {
@ -7,6 +8,21 @@ namespace SM.Base.Scene
/// </summary> /// </summary>
public interface IShowItem public interface IShowItem
{ {
/// <summary>
/// Parent of the object.
/// </summary>
object Parent { get; set; }
/// <summary>
/// Contains the name for the object.
/// </summary>
string Name { get; set; }
/// <summary>
/// Contains specific flags for the object.
/// </summary>
ICollection<string> Flags { get; set; }
/// <summary> /// <summary>
/// Tells the object to update own systems. /// Tells the object to update own systems.
/// </summary> /// </summary>
@ -17,5 +33,14 @@ namespace SM.Base.Scene
/// </summary> /// </summary>
/// <param name="context"></param> /// <param name="context"></param>
void Draw(DrawContext context); void Draw(DrawContext context);
/// <summary>
/// Action, that is called, when the object was added to a GenericItemCollection.
/// </summary>
void OnAdded(object sender);
/// <summary>
/// Action, that is called, when the object was removed from a GenericItemCollection.
/// </summary>
void OnRemoved(object sender);
} }
} }

View file

@ -0,0 +1,20 @@
using System;
using OpenTK;
namespace SM.Utility
{
/// <summary>
/// Utilitys for rotations
/// </summary>
public class RotationUtility
{
/// <summary>
/// Angle towards an coordinate.
/// </summary>
/// <returns></returns>
public static float TurnTowards(Vector2 origin, Vector2 target)
{
return MathHelper.RadiansToDegrees((float)Math.Atan2(target.Y - origin.Y, target.X - origin.X));
}
}
}

View file

@ -24,6 +24,10 @@ namespace SM.Base.Contexts
/// </summary> /// </summary>
public Matrix4 View; public Matrix4 View;
/// <summary> /// <summary>
/// The master model matrix.
/// </summary>
public Matrix4 ModelMaster;
/// <summary>
/// The drawing instances. /// The drawing instances.
/// <para>If there is only one, it's index 0</para> /// <para>If there is only one, it's index 0</para>
/// </summary> /// </summary>

View file

@ -11,7 +11,7 @@ namespace SM.Base.Contexts
/// <summary> /// <summary>
/// The delta time. /// The delta time.
/// </summary> /// </summary>
public float Deltatime => Defaults.DefaultDeltatime.DeltaTime; public float Deltatime => SMRenderer.DefaultDeltatime.DeltaTime;
/// <summary> /// <summary>
/// The current keyboard state. /// The current keyboard state.

View file

@ -95,6 +95,16 @@ namespace SM.Base
MouseState = Mouse.GetState() MouseState = Mouse.GetState()
}; };
Update(e, ref context);
}
/// <summary>
/// Updates the system.
/// </summary>
/// <param name="e"></param>
/// <param name="context"></param>
protected virtual void Update(FrameEventArgs e, ref UpdateContext context)
{
Stopwatch.PerformTicks(context); Stopwatch.PerformTicks(context);
} }
@ -152,14 +162,24 @@ namespace SM.Base
ViewportCamera = new TCamera(); ViewportCamera = new TCamera();
} }
/// <inheritdoc />
protected override void Update(FrameEventArgs e, ref UpdateContext context)
{
base.Update(e, ref context);
CurrentScene?.Update(context);
}
/// <inheritdoc /> /// <inheritdoc />
protected override void OnRenderFrame(FrameEventArgs e) protected override void OnRenderFrame(FrameEventArgs e)
{ {
SMRenderer.CurrentFrame++;
Deltatime.RenderDelta = (float)e.Time; Deltatime.RenderDelta = (float)e.Time;
DrawContext drawContext = new DrawContext() DrawContext drawContext = new DrawContext()
{ {
World = ViewportCamera.World, World = ViewportCamera.World,
View = ViewportCamera.CalculateViewMatrix(), View = ViewportCamera.CalculateViewMatrix(),
ModelMaster = Matrix4.Identity,
Instances = new[] { new Instance {ModelMatrix = Matrix4.Identity, TexturePosition = Vector2.Zero, TextureScale = Vector2.One } }, Instances = new[] { new Instance {ModelMatrix = Matrix4.Identity, TexturePosition = Vector2.Zero, TextureScale = Vector2.One } },
Mesh = Plate.Object, Mesh = Plate.Object,
ForceViewport = ForceViewportCamera, ForceViewport = ForceViewportCamera,

View file

@ -13,10 +13,20 @@ namespace SM2D.Controls
internal new void MouseMoveEvent(MouseMoveEventArgs mmea) => base.MouseMoveEvent(mmea); internal new void MouseMoveEvent(MouseMoveEventArgs mmea) => base.MouseMoveEvent(mmea);
public Vector2 InWorld(Camera cam) public Vector2 InWorld()
{ {
Vector2 res = _window.WorldScale; Vector2 res = _window.WorldScale;
return InScreenNormalized * res - res / 2; return InScreenNormalized * res - res / 2;
} }
public Vector2 InWorld(Camera cam)
{
return InWorld() + cam.Position;
}
public Vector2 InWorld(Vector2 position)
{
return InWorld() + position;
}
} }
} }

View file

@ -1,4 +1,5 @@
using System.Drawing; using System.Collections.Generic;
using System.Drawing;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using SM.Base; using SM.Base;
@ -43,10 +44,12 @@ namespace SM2D.Drawing
Texture = (Texture) texture; Texture = (Texture) texture;
} }
public object Parent { get; set; }
public string Name { get; set; } = "Background";
public ICollection<string> Flags { get; set; } = new string[0];
public void Update(UpdateContext context) public void Update(UpdateContext context)
{ { }
throw new System.NotImplementedException();
}
public void Draw(DrawContext context) public void Draw(DrawContext context)
{ {
@ -56,5 +59,13 @@ namespace SM2D.Drawing
context.Instances[0].ModelMatrix = Matrix4.CreateScale(context.WorldScale.X, context.WorldScale.Y, 1); context.Instances[0].ModelMatrix = Matrix4.CreateScale(context.WorldScale.X, context.WorldScale.Y, 1);
context.Shader.Draw(context); context.Shader.Draw(context);
} }
public void OnAdded(object sender)
{
}
public void OnRemoved(object sender)
{
}
} }
} }

View file

@ -0,0 +1,7 @@
namespace SM2D.Pipelines
{
public class Adv2DPipeline
{
}
}

View file

@ -17,7 +17,7 @@ namespace SM2D.Pipelines
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
scene.Draw(context); scene?.Draw(context);
} }
} }
} }

View file

@ -55,6 +55,7 @@
<Compile Include="GLWindow2D.cs" /> <Compile Include="GLWindow2D.cs" />
<Compile Include="Object\Polygon.cs" /> <Compile Include="Object\Polygon.cs" />
<Compile Include="Object\PolygonVertex.cs" /> <Compile Include="Object\PolygonVertex.cs" />
<Compile Include="Pipelines\Adv2DPipeline.cs" />
<Compile Include="Pipelines\Basic2DPipeline.cs" /> <Compile Include="Pipelines\Basic2DPipeline.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scene\Camera.cs" /> <Compile Include="Scene\Camera.cs" />

View file

@ -7,11 +7,11 @@ namespace SM2D.Scene
{ {
public class Scene : GenericScene<Camera, ItemCollection, I2DShowItem> public class Scene : GenericScene<Camera, ItemCollection, I2DShowItem>
{ {
public DrawBackground Background => (DrawBackground)_background; public DrawBackground Background => (DrawBackground)_Background;
public Scene() public Scene()
{ {
_background = new DrawBackground(Color4.Black); _Background = new DrawBackground(Color4.Black);
} }
} }
} }

View file

@ -25,7 +25,7 @@ namespace SM2D.Shader
GL.BindVertexArray(context.Mesh); GL.BindVertexArray(context.Mesh);
// Vertex Uniforms // Vertex Uniforms
Uniforms["MVP"].SetMatrix4(context.View * context.World); Uniforms["MVP"].SetMatrix4(context.ModelMaster * context.View * context.World);
Uniforms["HasVColor"].SetUniform1(context.Mesh.AttribDataIndex.ContainsKey(3) && context.Mesh.AttribDataIndex[3] != null); Uniforms["HasVColor"].SetUniform1(context.Mesh.AttribDataIndex.ContainsKey(3) && context.Mesh.AttribDataIndex[3] != null);
for (int i = 0; i < context.Instances.Length; i++) for (int i = 0; i < context.Instances.Length; i++)

View file

@ -1,20 +1,54 @@
using OpenTK; using System;
using System.Configuration.Assemblies;
using OpenTK;
using SM.Base.Scene; using SM.Base.Scene;
using SM.Base.Types; using SM.Base.Types;
using SM.Utility;
namespace SM2D.Types namespace SM2D.Types
{ {
public class Transformation : GenericTransformation public class Transformation : GenericTransformation
{ {
public CVector2 Position = new CVector2(0); private float _eulerRotation = 0;
public CVector2 Size = new CVector2(50); private CVector2 _position = new CVector2(0);
public float Rotation; private CVector2 _scale = new CVector2(50);
public override Matrix4 GetMatrix() public CVector2 Position
{ {
return Matrix4.CreateScale(Size.X, Size.Y, 1) * get => _position;
Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(Rotation)) * set => _position = value;
Matrix4.CreateTranslation(Position.X, Position.Y, 0); }
public CVector2 Size
{
get => _scale;
set => _scale = value;
}
public float Rotation
{
get => _eulerRotation;
set => _eulerRotation = value;
}
protected override Matrix4 RequestMatrix()
{
return Matrix4.CreateScale(_scale.X, _scale.Y, 1) *
Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(_eulerRotation)) *
Matrix4.CreateTranslation(_position.X, _position.Y, 0);
}
public void TurnTo(Vector2 v)
{
_eulerRotation = RotationUtility.TurnTowards(Position, v);
}
public Vector2 LookAtVector()
{
if (_modelMatrix.Determinant < 0.0001) return new Vector2(0);
Vector3 vec = Vector3.TransformNormal(Vector3.UnitX, _modelMatrix);
vec.Normalize();
return vec.Xy;
} }
} }
} }

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Authentication.ExtendedProtection.Configuration;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using SM.Base; using SM.Base;
@ -41,7 +42,11 @@ namespace SM_TEST
private static void WindowOnUpdateFrame(object sender, FrameEventArgs e) private static void WindowOnUpdateFrame(object sender, FrameEventArgs e)
{ {
polyogn.Transform.Position.Set(window.Mouse.InWorld(window.ViewportCamera)); Vector2 mousepos = window.Mouse.InWorld();
//polyogn.Transform.Position.Set(mousepos);
polyogn.Transform.TurnTo(mousepos);
Log.Write(LogType.Info, polyogn.Transform.LookAtVector());
} }
private static void WindowOnLoad(object sender, EventArgs e) private static void WindowOnLoad(object sender, EventArgs e)
@ -52,7 +57,7 @@ namespace SM_TEST
col = new ItemCollection() col = new ItemCollection()
{ {
Transform = { Position = new SM.Base.Types.CVector2(0, -400) }, Transform = { Position = new SM.Base.Types.CVector2(0, 400) },
ZIndex = 1 ZIndex = 1
}; };
@ -69,12 +74,12 @@ namespace SM_TEST
scene.Objects.Add(col); scene.Objects.Add(col);
scene.Objects.Add(new DrawText(font, "Testing...") scene.Objects.Add(new DrawText(font, "Testing...")
{ {
Transform = { Position = new SM.Base.Types.CVector2(0, -400)}, Transform = { Position = new SM.Base.Types.CVector2(0, 400)},
Color = Color4.Black Color = Color4.Black
}); });
scene.Objects.Add(polyogn = new DrawPolygon(Polygon.GenerateCircle(),Color4.Blue)); scene.Objects.Add(new DrawPolygon(Polygon.GenerateCircle(),Color4.Blue));
scene.Objects.Add(new DrawPolygon(new Polygon(new[] scene.Objects.Add(polyogn = new DrawPolygon(new Polygon(new[]
{ {
new PolygonVertex(new Vector2(.25f, 0), Color4.White), new PolygonVertex(new Vector2(.25f, 0), Color4.White),
new PolygonVertex(new Vector2(.75f, 0), Color4.White), new PolygonVertex(new Vector2(.75f, 0), Color4.White),