/// <summary> /// OnPaint /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GlControl_Paint(object sender, PaintEventArgs e) { DrawTimer.Stop(); GlControl.MakeCurrent(); Display.ClearBuffers(); Batch.Begin(); // Background texture Rectangle dst = new Rectangle(Point.Empty, GlControl.Size); Batch.Draw(CheckerBoard, dst, dst, Color.White);; Batch.DrawString(CurrentFont, Point.Empty, Color.White, PreviewTextBox.Text); Batch.End(); DrawTimer.Start(); GlControl.SwapBuffers(); }
/// <summary> /// Render the monster visual /// </summary> void Draw() { try { GlControl.MakeCurrent(); Display.ClearBuffers(); if (SpriteBatch != null) { SpriteBatch.Begin(); // Background texture Rectangle dst = new Rectangle(Point.Empty, GlControl.Size); SpriteBatch.Draw(CheckerBoard, dst, dst, Color.White); if (Monster != null && TileSet != null) { Tile tile = TileSet.GetTile(Monster.Tile); if (tile != null) { Point pos = new Point((GlControl.Width - tile.Size.Width) / 2, (GlControl.Height - tile.Size.Height) / 2); pos.Offset(tile.Pivot); SpriteBatch.DrawTile(TileSet, Monster.Tile, pos); } } SpriteBatch.End(); } GlControl.SwapBuffers(); } catch (Exception e) { } }