Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H3INTRO: Use INTRORIM and preserve aspect ratio #3041

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

Alexander-Wilms
Copy link
Contributor

Also fix glitches while resizing by using SDL_RenderClear()

introRim.mp4

@Alexander-Wilms Alexander-Wilms force-pushed the intro-frame branch 5 times, most recently from ec524ee to 8f07ca1 Compare October 11, 2023 10:42
@IvanSavenko
Copy link
Member

Will it work for resolutions that are not 3x4, e.g HD/FullHD?

@Alexander-Wilms
Copy link
Contributor Author

Not yet

@Alexander-Wilms
Copy link
Contributor Author

Now all intro videos always have the correct aspect ratio.

@Alexander-Wilms
Copy link
Contributor Author

When one has selected a widescreen resolution and resizes the window to have a narrower aspect ratio, black bars appear in both axes:

image

I'll try to address that as well.

@Alexander-Wilms Alexander-Wilms marked this pull request as draft October 11, 2023 18:12
@Alexander-Wilms
Copy link
Contributor Author

Done

@Alexander-Wilms Alexander-Wilms marked this pull request as ready for review October 11, 2023 19:14
@Laserlicht
Copy link
Contributor

Tested, looks good with keeping aspect ratio and rim. :)

@Alexander-Wilms
Copy link
Contributor Author

Alexander-Wilms commented Oct 11, 2023

I noticed it still breaks with a VCMI resolution of 1920x1080:

image

@Alexander-Wilms
Copy link
Contributor Author

Alexander-Wilms commented Nov 10, 2023

I tested it some more and noticed that it breaks when one changes the window size by dragging it to the left or right or top, not when one manually changes the window size.

Also, I can already reproduce a similar issue with the latest develop build (439ce11).

It seems like SDL doesn't get a usual resize event when one maximizes the window or sets it to half of the screen via the window manager.

This is all the same VCMI instance after resizing it by dragging it to the screen edges:

image

image

image

image

Maybe this issue combined with my code to use the actual window size instead of the resolution selected in the launcher results in the completely broken videos.

@Alexander-Wilms
Copy link
Contributor Author

Alexander-Wilms commented Nov 14, 2023

When I keep resizing the window using latest develop (1192dbf) I get the following:

[swscaler @ 0x55a4a3881fc0] Warning: data is not aligned! This can lead to a speed loss
Unable to create screen texture
Texture dimensions are limited to 16384x16384
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to create screen texture
Abgebrochen (Speicherabzug geschrieben)

I started VCMi in windowed mode, reduced the window's height, dragged it to the top of the screen to maximize it, dragged it back and further reduced the window height. I repeated this a few times.

So it seems for the given intro video height of 600 px, a texture with a huge width is created that matches the ratio of the window. When it crashes the ratio is even higher than this:

image

@Alexander-Wilms Alexander-Wilms marked this pull request as draft February 7, 2024 05:44
@Alexander-Wilms
Copy link
Contributor Author

I'll still need to add interface scaling for the intros.

@Alexander-Wilms
Copy link
Contributor Author

Alexander-Wilms commented Jun 16, 2024

Tested it with various resolutions, aspect ratios and interface scaling factors and it seems to work as expected.

Before merging, I'd remove the debug output, but keep it for now in case the MR still has to be adapted.

@Alexander-Wilms Alexander-Wilms force-pushed the intro-frame branch 4 times, most recently from 9f9494a to 3fb819d Compare June 17, 2024 00:35
@Alexander-Wilms
Copy link
Contributor Author

There are still issues on Android:

Screenshot_20240618-035140.png

@Alexander-Wilms
Copy link
Contributor Author

Now the intros work fine on desktop and Android:

Screenshot_20240618-111317.png

Screenshot_20240618-111336.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants