Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualkd7tck

Posted 18 January 2013 - 05:24 PM

Why are you starting at 0, start where the camera starts and end where the camera ends. Just draw whatever the camera shows us regardless of what that is. Then get rid of the range check you don't need that, the range check was shrinking the view on you. To ensure that the camera doesn't draw anything out of range make certain the camera position can never stray beyond the defined range, 1000X1000 in your case.

 

edit: In the camera's case the range is (0,0) and (1000-width,1000-height).

 

    public class Camera
    {
      public void SetLoc(Point pt)
      {
        if(X_&&_Y_in_range)
        {
          this.X = pt.X;
          this.Y = pt.Y;
        }
        else if(X_is_too_small)
        {
          this.X = 0
          this.Y = pt.Y
        }
        ... Yada Yada Yada...
      }
     
    

#1kd7tck

Posted 18 January 2013 - 05:11 PM

Why are you starting at 0, start where the camera starts and end where the camera ends. Just draw whatever the camera shows us regardless of what that is. Then get rid of the range check you don't need that, the range check was shrinking the view on you. To ensure that the camera doesn't draw anything out of range make certain the camera position can never stray beyond the defined range, 1000X1000 in your case.

 

    public class Camera
    {
      public void SetLoc(Point pt)
      {
        if(X_&&_Y_in_range)
        {
          this.X = pt.X;
          this.Y = pt.Y;
        }
        else if(X_is_too_small)
        {
          this.X = 0
          this.Y = pt.Y
        }
        ... Yada Yada Yada...
      }
     
    

PARTNERS