I need a formula for my 2D game that calculates whether or not a game object/entity should be rendered.
This means, if an entity is not visible on the screen(the translated view), skip the rendering it.
- The entity stores its position in X and Y(which is the top-left corner of its image). It also stores its width and height.
- The size of the game window/screen is 800x600. The total size of the stage is stageWidth and stageHeight.
- The translation is set not to film areas outside the stage's boundaries.