public void Setup() { this.engine = new ValorEngine(); this.form = new ValorForm(); this.form.Engine = this.engine; this.context = new GraphicsBindingContext(this.form, Ri, Pi); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); f = new ValorForm {Engine = new ValorEngine()}; var ticker = new GraphicsBindingContext(f); ticker.Start(); Application.Run(f); }
public GraphicsBindingContext(ValorForm form, double RenderInterval = 0, double PhysicsInterval = 0) { if (form == null) { throw new ArgumentNullException("The Form supplied was null. BindingContext must reference either an Image or a Form."); } if (RenderInterval <= 0) { RenderInterval = 1000 / ValorEngine.Vfps; } if (PhysicsInterval <= 0) { PhysicsInterval = 1000 / ValorEngine.Cfps; } this.Form = form; this._GraphicsTimer = new Timer { Interval = RenderInterval }; this._GraphicsTimer.Elapsed += _GraphicsTimer_Tick; this._PhysicsTimer = new Timer() { Interval = PhysicsInterval }; this._PhysicsTimer.Elapsed += _PhysicsTimer_Tick; }