Fixes and minor enhancements for sub editor

- Zoom now works relative to the mouse's position rather than the center of the screen, much like Valve's Hammer Editor (or pulsegun's map editor shameless plug ;) )
- Rectangles now have line widths dependent on the camera zoom, not perfect but it's better than having lines disappear
- Fixed background resizing
- Fixed editor being completely broken because of no vsync, might still have a few bugs here and there
- Fixed selection rectangle not rendering at all when dragging from bottom right to top left
- Newline change in Item.cs
This commit is contained in:
juanjp600
2016-10-06 21:15:01 -03:00
parent 16ee20aaaa
commit 94895edbdb
12 changed files with 2116 additions and 1963 deletions

View File

@@ -38,7 +38,7 @@ namespace Barotrauma
private Tutorials.EditorTutorial tutorial;
public Camera Cam
public override Camera Cam
{
get { return cam; }
}
@@ -887,6 +887,43 @@ namespace Barotrauma
GUItabs[selectedTab].Update((float)deltaTime);
if (PlayerInput.RightButtonClicked()) selectedTab = -1;
}
if (!characterMode && !wiringMode)
{
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(cam);
}
if ((characterMode || wiringMode) && dummyCharacter != null)
{
foreach (MapEntity me in MapEntity.mapEntityList)
{
me.IsHighlighted = false;
}
dummyCharacter.AnimController.FindHull(dummyCharacter.CursorWorldPosition, false);
foreach (Item item in dummyCharacter.SelectedItems)
{
if (item == null) continue;
item.SetTransform(dummyCharacter.SimPosition, 0.0f);
item.Update(cam, (float)deltaTime);
}
if (dummyCharacter.SelectedConstruction != null)
{
if (dummyCharacter.SelectedConstruction != null)
{
dummyCharacter.SelectedConstruction.UpdateHUD(dummyCharacter);
}
if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.ClosestItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null;
}
CharacterHUD.Update((float)deltaTime, dummyCharacter);
}
GUI.Update((float)deltaTime);
}
/// <summary>
@@ -913,7 +950,7 @@ namespace Barotrauma
if (!characterMode && !wiringMode)
{
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(spriteBatch, cam);
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.DrawPlacing(spriteBatch,cam);
MapEntity.DrawSelecting(spriteBatch, cam);
}
@@ -932,28 +969,11 @@ namespace Barotrauma
if ((characterMode || wiringMode) && dummyCharacter != null)
{
foreach (MapEntity me in MapEntity.mapEntityList)
{
me.IsHighlighted = false;
}
dummyCharacter.AnimController.FindHull(dummyCharacter.CursorWorldPosition, false);
foreach (Item item in dummyCharacter.SelectedItems)
{
if (item == null) continue;
item.SetTransform(dummyCharacter.SimPosition, 0.0f);
item.Update(cam, (float)deltaTime);
}
if (dummyCharacter.SelectedConstruction != null)
{
dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, dummyCharacter);
if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.ClosestItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null;
}
dummyCharacter.DrawHUD(spriteBatch, cam);
if (wiringMode) wiringToolPanel.Draw(spriteBatch);