Advertisement
duel_05

Custom Camera - SFML.NET

May 19th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1.  public class Camera
  2.     {
  3.        
  4.         internal int ParentScene;
  5.  
  6.         public Vector2f SizeTop = new Vector2f(0, 0);
  7.         public Vector2f SizeBottom = new Vector2f(0, 0);
  8.         public Vector2f Offset = new Vector2f(0, 0);
  9.  
  10.         public bool Enabled = true;
  11.  
  12.         public Camera()
  13.         {
  14.             ParentScene = Game.Instance.CurrentScene;
  15.         }
  16.  
  17.         public void Move(float x, float y)
  18.         {
  19.             Offset.X += x;
  20.             Offset.Y += y;
  21.         }
  22.        
  23.         internal bool IsIn(Vector2f sef)
  24.         {
  25.             if (mathf.TestRange(sef.X, SizeBottom.X, SizeTop.X) &&
  26.                 mathf.TestRange(sef.Y, SizeTop.Y, SizeBottom.Y))
  27.             {
  28.                 return true;
  29.             }
  30.             return false;
  31.         }
  32.  
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement