using System;
using BadKid;using BadKid.Engine;
using Core;
using Core.Math;
using Core.Utilities;
namespace Example{
public class Test : GameEngine{
private PrimitiveBatch _primitivebatch;
private SpriteBatch _spritebatch;
private Surface _surface;
private Polygon2D _polygon;
public override bool Initialize(out Process<bool>[] asyncProcesses){
_spritebatch = new SpriteBatch(this);
_primitivebatch = new PrimitiveBatch(this);
_surface = LoadContent<Surface>("Example.back-air.gif"); //As embeded resource
_polygon = GeometricGeneratorFactory.CreateKochSnowflake(
new Vertex2D(400, 300), 200, 2, 0, new Color(255,0,0));
asyncProcesses = null;
FullScreen = true;
return true;
}
public override IComponent Update(TimeSpan gameTime){return this;}
public override void Render(TimeSpan gameTime, Camera camera){
Clear(Maths.Randomize<Color,Color>());
camera.Rotation += 0.05f;
camera.Zoom += 0.05f;
if (camera.Zoom == 5) camera.Zoom = 0;
_spritebatch.Begin(camera);
_spritebatch.Draw(_surface, Center);
_spritebatch.End();
_primitivebatch.Begin(camera);
_primitivebatch.FillPath(GeometricGeneratorFactory.CreateRandomHull(
new Vertex2D(400, 300),300,300,20));
_primitivebatch.FillPath(GeometricGeneratorFactory.CreateStar(
Center, 10, 50, 200, 0, Maths.Randomize<Color, Color>()));
_primitivebatch.End();
}
public static void Main(string[] args){
new Test();
}
}
}