/// <summary> /// /// </summary> void RenderScene() { VisualBox.MakeCurrent(); Display.ClearBuffers(); Batch.Begin(); // Background Batch.DrawTile(Maze.WallTileset, 0, Point.Empty); // Draw decoration if (DecorationSet != null) { DecorationSet.Draw(Batch, PressurePlate.DecorationPrimary, ViewFieldPosition.L); } Batch.End(); VisualBox.SwapBuffers(); }
/// <summary> /// Render the scene /// </summary> void RenderScene() { OpenGLBox.MakeCurrent(); Display.ClearBuffers(); Batch.Begin(); // Background Batch.DrawTile(BgTileSet, 0, Point.Empty); // Render the walls if (DisplayWallBox.Checked) { foreach (TileDrawing tmp in DisplayCoordinates.GetWalls(ViewPositionBox.Position)) { Batch.DrawTile(BgTileSet, tmp.ID, tmp.Location, Color.White, 0.0f, tmp.Effect, 0.0f); } } #region Draw the decoration if (Decoration != null && DecorationSet.Tileset != null) { DecorationSet.Draw(Batch, (int)DecorationIdBox.Value, ViewPositionBox.Position); Tile tile = DecorationSet.Tileset.GetTile(Decoration.GetTileId(ViewPositionBox.Position)); if (tile != null) { Point start = Decoration.GetLocation(ViewPositionBox.Position); Rectangle rect = new Rectangle(start, tile.Size); // Red rectangle around tile if (rect.Contains(OpenGLBox.PointToClient(Control.MousePosition)) && !ItemsModeSelected) { Batch.DrawRectangle(rect, Color.Red); } } TileLocationBox.Text = Decoration.GetLocation(ViewPositionBox.Position).ToString(); } else { TileLocationBox.Text = ""; } #endregion #region Display item if (ItemsModeSelected && ItemTileset != null && (ViewPositionBox.Position == ViewFieldPosition.L || ViewPositionBox.Position == ViewFieldPosition.H || ViewPositionBox.Position == ViewFieldPosition.C)) { // Offset the item locations according to the distance Vector2 vect = DisplayCoordinates.GetMonsterScaleFactor(ViewPositionBox.Position); Point loc = Decoration.PrepareLocation(ViewPositionBox.Position); loc.Offset((int)(Decoration.ItemLocation.X * vect.X), (int)(Decoration.ItemLocation.Y * vect.Y)); Batch.DrawTile(ItemTileset, (int)ItemIdBox.Value, loc, DisplayCoordinates.GetDistantColor(ViewPositionBox.Position), 0.0f, DisplayCoordinates.GetItemScaleFactor(ViewPositionBox.Position), SpriteEffects.None, 0.0f); ItemPositionBox.Text = Decoration.ItemLocation.ToString(); } #endregion Batch.End(); OpenGLBox.SwapBuffers(); }