private void RenderMap() { GL.ClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL.Clear(ClearBufferMask.ColorBufferBit); if (myCurrentMap != null) { float minX = (myCurrentMap.Width <= 16 ? myCurrentMap.Width / 2 : 16 / MapRenderer.CameraScale); float minY = (myCurrentMap.Height <= 16 ? myCurrentMap.Height / 2 : 16 / MapRenderer.CameraScale); if (MapRenderer.CameraX < minX) { MapRenderer.CameraX = minX; } if (MapRenderer.CameraY < minY) { MapRenderer.CameraY = minY; } float maxX = (myCurrentMap.Width <= 16 ? myCurrentMap.Width / 2 : Math.Max(myCurrentMap.Width - 16 / MapRenderer.CameraScale, 16 / MapRenderer.CameraScale)); float maxY = (myCurrentMap.Height <= 16 ? myCurrentMap.Height / 2 : Math.Max(myCurrentMap.Height - 16 / MapRenderer.CameraScale, 16 / MapRenderer.CameraScale)); if (MapRenderer.CameraX > maxX) { MapRenderer.CameraX = maxX; } if (MapRenderer.CameraY > maxY) { MapRenderer.CameraY = maxY; } myCurrentMap.Render(lightingToolStripMenuItem.Checked, true); } if (myDrawing && TilePlaceRB.Checked && PlacementBoxRB.Checked) { int minX = Math.Min(myBoxOrigin.X, myBoxEnd.X); int minY = Math.Min(myBoxOrigin.Y, myBoxEnd.Y); int maxX = Math.Max(myBoxOrigin.X, myBoxEnd.X); int maxY = Math.Max(myBoxOrigin.Y, myBoxEnd.Y); int width = maxX - minX + 1; int height = maxY - minY + 1; myTileSprite.Size = new Vector2(width * 16.0f * MapRenderer.CameraScale, height * 16.0f * MapRenderer.CameraScale); myTileSprite.Position = new Vector2( (minX - MapRenderer.CameraX) * 16.0f * MapRenderer.CameraScale + 256, (minY - MapRenderer.CameraY) * 16.0f * MapRenderer.CameraScale + 256); } SpriteRenderer.Begin(); if (myCurrentMap != null && (TilePlaceRB.Checked || (EntityPlaceRB.Checked && SnapToTileCB.Checked))) { myTileSprite.Render(); } if (myConArrows != null) { foreach (List <ConnectorArrow> edge in myConArrows) { foreach (ConnectorArrow arr in edge) { arr.Render(); } } } if (myDragging) { myDragSprite.Render(); } SpriteRenderer.End(); ViewControl.SwapBuffers(); }