This project is read-only.
The XnaViewportBox is a very handy little control which is something like a "game in a box". The XnaViewportBox sets up a viewport for you and clears it with the back color. It has a Update and a Draw method similar to the methods in the game class for you.

This is very usefull for editor like applications that should run completly within a xna window.

There are some things you should not do:

1. Don't call GraphicsDevice.Clear in XNA 4.0 because it clears the whole screen. In XNA 3.1 on some graphics card this will only clear the viewport and on others it will have the same behaviour as with XNA 4.0. The viewport will be cleared automatically to the BackColor of the widget.
2. You should not change the Viewport of GraphicsDevice as this is already done by the widget.
3. You should not change the scissor settings of the graphics device as this is already done by the widget to prevent drawing outside of the DisplayRectangle. If you need to change the ScissorRectangle please store the actual one and restore it after you changed it. If you change it you are responsible yourself to limit it to the DisplayRectangle.

Last edited May 5, 2011 at 10:16 AM by Glatzemann, version 1


No comments yet.