public virtual bool IsOnScreen
() { FloatRect rect1
= new FloatRect
(Sprite
.Position.X - Sprite
.Origin.X, Sprite
.Position.Y - Sprite
.Origin.Y, Sprite
.Width, Sprite
.Height); FloatRect rect2
= new FloatRect
(Program
.Camera.Center.X - Program
.Camera.Viewport.Width / 2, Program
.Camera.Center.Y - Program
.Camera.Viewport.Height / 2, Program
.Camera.Viewport.Width, Program
.Camera.Viewport.Height); if (rect1
.Intersects (rect2
)) { return true; } else { return false; } }
I get that this is not the best or simplest way to do it, I've tried
return Sprite.SubRect.Intersects(Program.Camera.Viewport);
Yet that does not work (even if I convert the Sprite IntRect to a FloatRect).
Switching to the RC now (how could you tell I wasn't using it?). Anyhow, Program is the main class, and Camera is a global variabe pointing to a Camera, basically my extension of a View.
EDIT: Wow, using this code I get 0 FPS.
return Program.Camera.Viewport.Intersects (Sprite.GetGlobalBounds ());
What is wrong?