Virtual resolutions with borders??
BlitzMax Forums/BlitzMax Programming/Virtual resolutions with borders??
| ||
Is there any way of using native virtual resolution functions to create a screen with borders when a different aspect ratio to the game window is used? I was sure it was done ages ago but can't seem to work it out, so either I'm having a massive brainfart today, or I completely imagined it. In the meantime I'm using Oddball's aspect module which is doing the job nicely. Anybody know of any problems with that? |
| ||
My Odd2D module does a better job than the AspectMod, but comes with some extra baggage you might not need/want. I haven't had anyone report any problems with the AspectMod, but you might have some problems with more advanced graphics functions such as GrabImage. As Odd2D is fully integrated into the driver it shouldn't have any issues. |
| ||
Have a look at VirtualGfx |
| ||
Already did, but I honestly prefer the native or modular approach! By the way - you have duplicate identifiers in there (pixels:float, and half_scale:float), so the code didn't run right off. ;) |
| ||
I don't think this was every a standard feature of Blitz... the virtual resolution thing is more to do with a mismatch between pixels-per-inch. The way Unity does it they lock a given range of coordinates to the Y axis and let the X axis be the one that scales. So say you set up a virtual res of 768 pixels height, then using a simple bit of math you can calculate what the horizontal pixel amount should be based on the aspect ratio of the screen resolution .... and you pretty much have to assume that you're working with square pixels. |
| ||
@Gfk: That's weird, just copied and pasted and it builds fine here on 1.48/Windows! What did you mean by native, though? It uses the native Max SetVirtualResolution, VirtualMouseX, etc, commands. There's also this and Aspect correction for SetVirtualResolution(). |
| ||
Gfk, I wrote something based on Swift's code awhile back. It does exactly what you're talking about. Here's the link: http://blitzbasic.com/codearcs/codearcs.php?code=2796 |
| ||
Maybe I can ask a related question here. In some of these algorithms the functions DesktopWidth() and DesktopHeight() are used, but when I try those, the compiler says they are not recognized. Can anyone tell me where these are defined? |
| ||
They're part of BRL.System. Are you up to date? |
| ||
I am not up to date, so that's probably it! Thanks. :) |