Stubbjax
Member
I have a view and window size of 200x150, as well as a background image that is 400x300. The background is drawn at 50% size so that it fits within the view.
If I double the window size to 400x300, everything looks fine because the background is scaled up using its original size of 400x300. So even though the background is drawn at a scale of 50% in the code, the 200% window size results in the background being drawn at a crisp 100%.
Now on to the problem...
If I use a 200x150 surface to draw the background image on, the background will scale based on its drawn size of 50%, rather than its original size (the surface does not know about the larger image). So if the window size is 400x300, the background is drawn at 400x300 as well, but it is as if the original size of the background is 200x150. This results in pixelation and bilinear filtering, which is obviously not desirable.
The entire surface-drawing process simply sets visibility of the affected objects to false and then manually calls their draw events when the render target is changed to the surface. The view size does not scale.
Is there any easy solution to this that would not result in me having to rewrite everything? I do not think I can even afford to do that because it would not only be considerably time-consuming, but it would interfere with game logic if objects were different sizes and positions based on the window size. Hopefully there's a simple trick or workaround that I am missing. Maybe I have been doing things the wrong way the entire time and should be scaling/positioning everything based on the window size? Help would be appreciated, thanks.
If I double the window size to 400x300, everything looks fine because the background is scaled up using its original size of 400x300. So even though the background is drawn at a scale of 50% in the code, the 200% window size results in the background being drawn at a crisp 100%.
Now on to the problem...
If I use a 200x150 surface to draw the background image on, the background will scale based on its drawn size of 50%, rather than its original size (the surface does not know about the larger image). So if the window size is 400x300, the background is drawn at 400x300 as well, but it is as if the original size of the background is 200x150. This results in pixelation and bilinear filtering, which is obviously not desirable.
The entire surface-drawing process simply sets visibility of the affected objects to false and then manually calls their draw events when the render target is changed to the surface. The view size does not scale.
Is there any easy solution to this that would not result in me having to rewrite everything? I do not think I can even afford to do that because it would not only be considerably time-consuming, but it would interfere with game logic if objects were different sizes and positions based on the window size. Hopefully there's a simple trick or workaround that I am missing. Maybe I have been doing things the wrong way the entire time and should be scaling/positioning everything based on the window size? Help would be appreciated, thanks.
I have whipped up a quick example that demonstrates the exact problem I am experiencing which can be found here (Surface.gmk - 33.9 KB). You can change the window size via the first room's creation code. At 200x150, pressing SPACE appears to make no difference. But with a window size of 400x300, you can suddenly see the problems caused by switching between default rendering and surface rendering. Hope that helps!
Last edited: