Okay. I compare what I have done with Redv's proposition:
Juju Dredd, I looked your code. I think simplest way to do what you want, just add ten strings to screen.cpp:
https://github.com/SupSuper/OpenXcom/blob/master/src/Engine/Screen.cpp#L277
void Screen::setResolution(int width, int height)
{
makeVideoFlags();
if (Options::getBool("keepAspect"))
{
if (!_fullscreen && width * 200 / height < 320)
width = 320 * height / 200;
BASE_WIDTH = BASE_HEIGHT * width / height;
if (BASE_WIDTH & 1)
++BASE_WIDTH; https:// shouldn't be odd
}
...
This code does exactly what you need.
The way I was doing it is changing the scaling so it uses only part of the window. It was rather simple but it has two drawbacks:
- it is impossible to draw the mouse cursor in the black bands. Or cursor should be drawn after scaling the picture. This would be wrong because cursor would not be scaled, as a purist I would hate that.
- not-opengl scaling should be reworked, because I am currently doing it using a supplementary buffer for adding the black band which is obviously not efficient. The problem is it seems to me unnecessarily complex to update not-opengl scaling.
The way Redv propose to do it is rather different, it is adding black bands before scaling the picture. Mouse cursor is then automatically drawn in black bands and not-opengl scaling doesn't need any update. The problem is it has other impacts I have mentioned
there.
After examining Redv's proposition, I started to think using it as a base was a lot simpler than trying to improve mine.
So what I plan to do is doing another branch which rollbacks my previous one and then implement Redv's proposition. Do you agree with this?