I know this may sound like an odd question but I just wanted to confirm which way it is.
Currently I am using XNA within Windows Forms (MDI) and I am just wondering about the viewport, as I have multiple forms with their own graphics device to draw with.
Now originally I just assumed the viewport was meant to be a basically a wrapper for the screen size (i.e., width and height), however I noticed it contains an X and Y. So then I was unsure if it was meant to directly represent the drawing region of the device.
Take for example the below scenario:
I have a forms with a panel which is docked within a group box, its relative position in the form is { X: 100, Y: 100, Width: 320, Height: 280 }
however its absolute position on the screen would be lets say { X: 400, Y: 320, Width: 320, Height: 280 }
. Then if I were to use it like I was originally assuming the panel itself which hosts the underlying handle for Xna to draw to it would be { X: 0, Y: 0, Width: 320, Height: 280 }
.
So if you imagine I then start dragging the window around a bit, the relative positions do not change, but obviously the absolute one would, as you could technically drag the panel off screen.
So basically the question is, do I need to use absolute positions for my viewport and update them every time the graphics device is about to be drawn, or do I use relative positions and only update when the area is resizing? and if so is it relative to the form, or is it always going to be 0,0 for the x/y in this scenario?