aliens

Author Topic: New graphical option: Black bands to keep aspect ratio  (Read 39957 times)

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: New graphical option: Black bands to keep aspect ratio
« Reply #45 on: September 11, 2013, 07:03:30 pm »
I wish you guys would figure out which code is the better one before making a pull request, because it just makes me confused after looking at all these forum discussions, if I should actually merge stuff or not. :P

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New graphical option: Black bands to keep aspect ratio
« Reply #46 on: October 05, 2013, 01:02:30 pm »
Hello,

I don't understand. I received an automatic message from Github, and according to the link inside it somebody has merged my branch. But I thought you told me the way I was doing it was wrong. It was rather clear to me that you would refuse the branch...

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: New graphical option: Black bands to keep aspect ratio
« Reply #47 on: October 05, 2013, 04:58:45 pm »
From the discussions around here it seemed you had the better method, even if it wasn't perfect, so better have something than nothing. If someone comes up with a better way they can just submit a "fix".

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New graphical option: Black bands to keep aspect ratio
« Reply #48 on: October 05, 2013, 05:46:08 pm »
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
Code: [Select]
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?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: New graphical option: Black bands to keep aspect ratio
« Reply #49 on: October 05, 2013, 07:37:42 pm »
Sure, as long as something works in the end. :P You can easily perform "rollback commits" with Git.

Offline Tarvis

  • Colonel
  • ****
  • Posts: 111
    • View Profile
Re: New graphical option: Black bands to keep aspect ratio
« Reply #50 on: December 02, 2013, 05:08:07 pm »
Sorry for bump, but I wanted to ask about something

Will there be an option to clear the black bands every frame? If you've got the Steam overlay going then you get a HOM effect on the black bands where notification boxes persist


Otherwise, it works great! (except for the option not being in the in-game Advanced Options)

Offline Juju Dredd

  • Captain
  • ***
  • Posts: 68
    • View Profile
    • My gamer website (french)
Re: New graphical option: Black bands to keep aspect ratio
« Reply #51 on: December 02, 2013, 06:11:30 pm »
Sorry for bump, but I wanted to ask about something

Will there be an option to clear the black bands every frame? If you've got the Steam overlay going then you get a HOM effect on the black bands where notification boxes persist


Otherwise, it works great! (except for the option not being in the in-game Advanced Options)

It's me who is sorry, I have no time at the moment...
The way letterboxing is done will be completely redone.

Currently, it adds black bands after picture is enlarged. If you read the topic, another method has been given by redv, but I had no time to develop it so far because it requires some work. It consist in adding black bands before enlarging picture, it should solve your problem.