/// <summary> /// OnPaint /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlPreviewControl_Paint(object sender, PaintEventArgs e) { // GlPreviewControl.MakeCurrent(); Display.ClearBuffers(); SpriteBatch.Begin(); // Background texture Rectangle dst = new Rectangle(Point.Empty, GlPreviewControl.Size); SpriteBatch.Draw(CheckerBoard, dst, dst, Color.White); Animation.Draw(SpriteBatch, AnimOffset); /* * Tile tile = Animation.CurrentTile; * if (tile == null) * { * GlPreviewControl.SwapBuffers(); * return; * } * Rectangle rect = new Rectangle(AnimOffset, tile.Size); * * Animation.TileSet.Draw(Animation.CurrentFrame, AnimOffset); */ SpriteBatch.End(); GlPreviewControl.SwapBuffers(); }
/// <summary> /// Draw Timer tick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DrawTimer_Tick(object sender, EventArgs e) { // If not floating panel and the panel is active and AutoRefresh is OK if (this.DockAreas != DockAreas.Float && DockPanel.ActiveDocument == this) { int elapsed = Environment.TickCount - Time; Time = Environment.TickCount; // Stop the drawtimer DrawTimer.Stop(); //Animation.Update(TimeSpan.FromMilliseconds(elapsed)); Animation.Update(new GameTime(TimeSpan.Zero, TimeSpan.Zero, TimeSpan.Zero, TimeSpan.FromMilliseconds(elapsed))); GlFramesControl.Invalidate(); GlTilesControl.Invalidate(); GlPreviewControl.Invalidate(); // Restart the draw timer DrawTimer.Start(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlPreviewControl_Paint(object sender, PaintEventArgs e) { if (SpriteBatch == null) { return; } GlPreviewControl.MakeCurrent(); Display.ClearBuffers(); if (Maze == null) { GlPreviewControl.SwapBuffers(); return; } SpriteBatch.Begin(); Maze.Draw(SpriteBatch, PreviewLoc); SpriteBatch.End(); GlPreviewControl.SwapBuffers(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AnimationForm_Load(object sender, EventArgs e) { GlTilesControl.MakeCurrent(); Display.Init(); GlFramesControl.MakeCurrent(); Display.Init(); GlPreviewControl.MakeCurrent(); Display.Init(); SpriteBatch = new SpriteBatch(); // Preload background texture resource CheckerBoard = new Texture2D(ResourceManager.GetInternalResource("ArcEngine.Resources.checkerboard.png")); CheckerBoard.HorizontalWrap = TextureWrapFilter.Repeat; CheckerBoard.VerticalWrap = TextureWrapFilter.Repeat; BuildInterface(); // Draw timer DrawTimer.Start(); }
/// <summary> /// OnResize /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlPreviewControl_Resize(object sender, EventArgs e) { GlPreviewControl.MakeCurrent(); Display.ViewPort = new Rectangle(new Point(), GlPreviewControl.Size); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlPreviewControl_Load(object sender, EventArgs e) { GlPreviewControl.MakeCurrent(); Display.Init(); }