Update test game to showcase camera system.
This commit is contained in:
30
TestGame/World.cs
Normal file
30
TestGame/World.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Numerics;
|
||||
using DaggerFramework;
|
||||
using DaggerFramework.Rendering;
|
||||
using DaggerFramework.SceneGraph;
|
||||
|
||||
public class World : Drawable2d
|
||||
{
|
||||
protected override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
|
||||
_randomPositions = new Vector2[_rectangleAmount];
|
||||
for (int i = 0; i < _rectangleAmount - 1; i++)
|
||||
{
|
||||
_randomPositions[i] = MathUtils.RandomVector2(Position, Vector2.One * 2048f);
|
||||
}
|
||||
}
|
||||
public override void OnDraw(Renderer renderer)
|
||||
{
|
||||
for (int i = 0; i < _rectangleAmount; i++)
|
||||
{
|
||||
renderer.SetTransform(_randomPositions[i], PivotOffset, 0);
|
||||
renderer.DrawRectangle(Vector2.One * 16f, _rectangleColor);
|
||||
}
|
||||
}
|
||||
|
||||
private Color _rectangleColor = new Color(0.25f, 0.25f, 0.25f, 1.0f);
|
||||
private int _rectangleAmount = 6000;
|
||||
private Vector2[] _randomPositions;
|
||||
}
|
||||
Reference in New Issue
Block a user