Unstable 1.2.4.0
This commit is contained in:
@@ -6,7 +6,7 @@ using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
class Camera : IDisposable
|
||||
class Camera
|
||||
{
|
||||
public static bool FollowSub = true;
|
||||
|
||||
@@ -147,21 +147,10 @@ namespace Barotrauma
|
||||
position = Vector2.Zero;
|
||||
|
||||
CreateMatrices();
|
||||
// TODO: this has the potential to cause a resource leak
|
||||
// by sneakily creating a reference to cameras that we might
|
||||
// fail to release.
|
||||
GameMain.Instance.ResolutionChanged += CreateMatrices;
|
||||
|
||||
UpdateTransform(false);
|
||||
}
|
||||
|
||||
private bool disposed = false;
|
||||
public void Dispose()
|
||||
{
|
||||
if (!disposed) { GameMain.Instance.ResolutionChanged -= CreateMatrices; }
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
public Vector2 TargetPos { get; set; }
|
||||
|
||||
public Vector2 GetPosition()
|
||||
@@ -207,6 +196,12 @@ namespace Barotrauma
|
||||
|
||||
public void UpdateTransform(bool interpolate = true, bool updateListener = true)
|
||||
{
|
||||
if (GameMain.GraphicsWidth != Resolution.X ||
|
||||
GameMain.GraphicsHeight != Resolution.Y)
|
||||
{
|
||||
CreateMatrices();
|
||||
}
|
||||
|
||||
Vector2 interpolatedPosition = interpolate ? Timing.Interpolate(prevPosition, position) : position;
|
||||
|
||||
float interpolatedZoom = interpolate ? Timing.Interpolate(prevZoom, zoom) : zoom;
|
||||
|
||||
Reference in New Issue
Block a user