adventuregamestudio/ags — pull request #190 by ivan-mogilko (2014-09-27 12:01:37+00:00)
Title: Free display resolutions

**Synopsis**
This allows AGS to display a game in any sensible resolution.

**Explanation of a problem**
In the original AGS the black borders (for letterbox/pillarbox modes) were part of the game drawing routine. The scaling performed by graphic filters included scaling of black borders as well. When game display size was calculated, borders were took into consideration too.
Besides the big inconvenience, this implementation also imposed restrictions on the range of display resolutions and the size of black borders.

Aside from that, some calculations used outright hard-coded resolution values and coordinates.

**Changes**
This modification removes boxing borders from game business logic and lets the graphic driver handle them instead. This lets to run games in any resolution supported by graphics driver, with game view positioned in any way inside game window, including stretching to whole window regardless of scaling factor, with or without keeping aspect ratio.
(There's are still few particular cases when the game will draw borders for itself, such as the backward-compatible `letterbox-by-design` mode, and when the room size is smaller than the game's.)

A number of resolution-related global variables were removed from the code, following new ones introduced instead:
* GameSetupStructBase::size - defines native game size;
* ScreenResolution (global variable atm) - defines actual display (window) resolution;
* GameState::viewport - defines room viewport, a size of playable area, which may not be larger than game size;
* GameState::native_size - defines game native size on low-res coordinates (for backwards-compatibility only).

Additionally, this provides program interfaces (IGfxDriverFactory) for enumerating available display modes and graphic filters, creating and destroying gfx renderers, which could later be extended for exporting to Script API and changing display settings at runtime.

**Configuration file**
With this modification there's also a change in game configuration file.
All resolution settings are now put under "[graphics]" section:
* Driver setting:
* graphics / driver - driver id (renamed from misc / gfxdriver);
* Display mode setting
* graphics / windowed (renamed from misc / windowed);
* graphics / screen_def - sets how game determines screen resolution:
may be "explicit", "scaling" (equal to scaled game) or "max" (equal to device/desktop size);
* graphics / screen_width;
* graphics / screen_height;
* graphics / match_device_ratio - forces game to find nearest resolution matching current device/desktop ratio (full screen only)
* Filter setting and scaling factors; may be defined in either uniform or distinct way:
* graphics / filter - filter id (renamed from misc / gfxfilter);
* graphics / filter_scaling - uniform scaling integer factor; positive values for upscale, negative for downscale, "max" for maximal available uniform integer scaling;
* graphics / filter_scaling_x - separate scaling for game width;
* graphics / filter_scaling_y - separate scaling for game height;
* Game frame placement;
* graphics / game_frame - defines how game frame is positioned inside screen (window) after being scaled with filter:
may be "offset", "center", "stretch" or "proportional".

**Command line**
The command line argument "gfxfilter" now has two parameters:
--gfxfilter < filter_name > [ < filter_scaling > ]
the second parameter being optional and defining uniform integer scaling.