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

Fix pressed buttons background #4748

Merged
merged 16 commits into from
Dec 20, 2021

Conversation

a1exsh
Copy link
Contributor

@a1exsh a1exsh commented Dec 4, 2021

  1. Accept / Decline buttons.
  2. Position of pressed OKAY button in Extended Settings and System Options dialogs.
  3. Fix X-offset of buttons with a shadow. Overlooked that shadow correction was missing.
  4. Fix ICNs used for OKAY and CANCEL buttons in some dialogs:
    • Battle Only
    • Gift Resources
    • Town Portal spell
  5. Fix too dark background on TRADE, EXIT and GIFT evil buttons

1. Accept / Decline buttons.
2. Position of pressed OKAY button in Extended Settings and System Options dialogs.
3. Fix X-offset of buttons with a shadow. Overlooked that shadow correction was missing.
4. Fix ICNs used for OKAY and CANCEL buttons in some dialogs:
   - Battle Only
   - Gift Resources
   - Town Portal spell
5. Fix too dark background on TRADE, EXIT and GIFT evil buttons
@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 4, 2021

This is a follow-up on pressed button issues found in the course of #4350
/cc @Branikolog

@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement ui UI/GUI related stuff labels Dec 4, 2021
@oleg-derevenetz oleg-derevenetz added this to the 0.9.10 milestone Dec 4, 2021
Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @a1exsh , I left multiple code optimization comments. Would you mind to take a look at them?

@ihhub
Copy link
Owner

ihhub commented Dec 5, 2021

Hi @Branikolog , can you please test these changes?

@a1exsh a1exsh requested a review from ihhub December 5, 2021 09:07
@Branikolog
Copy link
Collaborator

Branikolog commented Dec 5, 2021

Hello, @a1exsh !
Nice work!
I've found some issues, but as usual I'm not sure, they're related to current topic.
So I'll post them, to be sure, you're aware of the problem. ;)

Disabled OKAY button in hiring dialog:
image

Right part of CONFIG button's shadow looks like straight vertical. Or is it just merged with background here?
image

Left part of OKAY button in experimental settings has some dark places (looks like a shadow near both upper and bottom corners) in it's pressed state:
image
image
Seems like not pressed button is missing this dark line there...

Shadow for scrollbar is missing:
image

No shadows for buttons in this window:
image

Pressed OKAY button in battle options window is rendered wrong:
Letters are shifted only in vertical dimension and we can also watch double left button side (The same to bottom part of disabled "Dismiss hero" button):
image
image
image

Dismiss button also doesn't have horizontal shifting of letters, while EXIT button works well:
image
image

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 5, 2021

@Branikolog thank you for having a look :)

Disabled OKAY button in hiring dialog: image

I have to guess what you see as a problem here — please be more specific :)

Do you mean the corners that seem darker than the background?
image

Right part of CONFIG button's shadow looks like straight vertical. Or is it just merged with background here? image

Oh, man, it all started with this button and after all the changes it's still not right 🤦
image

Left part of OKAY button in experimental settings has some dark places (looks like a shadow near both upper and bottom corners) in it's pressed state: image image Seems like not pressed button is missing this dark line there...

Yep, the released button sprite in the original resources is missing that line present on the pressed state. We can actually fix it if we like.

Shadow for scrollbar is missing: image

That's a known issue. Also the same scrollbar is not changing in evil interface mode: we most likely even have an issue about that already. ;)

No shadows for buttons in this window: image

Ah, this dialog I've never seen before: my installation only supports English. How do you enable it in the first place? Do you need a special version of OG for that?

Pressed OKAY button in battle options window is rendered wrong: Letters are shifted only in vertical dimension and we can also watch double left button side (The same to bottom part of disabled "Dismiss hero" button): image

Cool find — I will check that!

image image

Dismiss button also doesn't have horizontal shifting of letters, while EXIT button works well: image image

I will have a look at Dismiss button as well (we have an issue about it, I think this one: #4537).

@Branikolog
Copy link
Collaborator

@a1exsh

Oh, man, it all started with this button and after all the changes it's still not right

The game changed much with you help! OG has a tons of UI problems, which are already not the case for fheroes2. There're only "a few" issues left to become flawless. ;)

I have to guess what you see as a problem here — please be more specific :)

Do you mean the corners that seem darker than the background?

Sorry for being not clear enough. :)
Yes. 3 of 4 corners have darker background nearby.

Yep, the released button sprite in the original resources is missing that line present on the pressed state. We can actually fix it if we like.

I believe all buttons and their shadows should have same visuals within the whole game. :)

I will have a look at Dismiss button as well (we have an issue about it, I think this one: #4537).

True. But the issue is about disabled button's bottom line.

Today I found out, that letters are shifted here in wrong manner, comparing to other buttons in game.
Actually, I've noticed that Russian version of game has even more drastic flaw here: letters for pressed and released buttons are seem to be messed and while clicking the button the word shifts in upper right direction. :)

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 5, 2021

I have to guess what you see as a problem here — please be more specific :)
Do you mean the corners that seem darker than the background?

Sorry for being not clear enough. :) Yes. 3 of 4 corners have darker background nearby.

No worries: it was almost obvious after zooming in. ;) Fixed.

Yep, the released button sprite in the original resources is missing that line present on the pressed state. We can actually fix it if we like.

I believe all buttons and their shadows should have same visuals within the whole game. :)

Fixed by adding the missing parts of these buttons.

I will have a look at Dismiss button as well (we have an issue about it, I think this one: #4537).

True. But the issue is about disabled button's bottom line.

I will have a closer look on this now.

@Branikolog
Copy link
Collaborator

Ah, this dialog I've never seen before: my installation only supports English. How do you enable it in the first place? Do you need a special version of OG for that?

You can visit language selection dialog using any version of the game. Fheroes2 is going to support any language we like, generating all letters from the OG resources soon.

Can we also add shadows for that radio buttons?

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 5, 2021

Ah, this dialog I've never seen before: my installation only supports English. How do you enable it in the first place? Do you need a special version of OG for that?

You can visit language selection dialog using any version of the game. Fheroes2 is going to support any language we like, generating all letters from the OG resources soon.

In my case I'm always getting "Your version of Heroes of Might and Magic II does not support any languages except English.", but I've just changed the condition locally to test.

Can we also add shadows for that radio buttons?

Do we already have it some other dialog I can have a look at as example?

@zenseii
Copy link
Collaborator

zenseii commented Dec 5, 2021

@a1exsh

Ah, this dialog I've never seen before: my installation only supports English. How do you enable it in the first place? Do you need a special version of OG for that?

Right now the only thing you need to get that menu to show is by having a .mo translation file of either one or more of the languages German, French or Polish in your files/lang folder of your build. You can either compile them yourself with make or just grab them from the public release files/lang folder.

Edit:
Note that the button there also should be changed to allow for the evil Okay button, which I imagine is the case for other buttons too.

@Branikolog
Copy link
Collaborator

@a1exsh

In my case I'm always getting "Your version of Heroes of Might and Magic II does not support any languages except English.", but I've just changed the condition locally to test.

I've downloaded compiled version of current PR. It already contains languages.
I think, you can experience lacking of language selection due to using debug mode.

Do we already have it some other dialog I can have a look at as example?

image

Edit:
Note that the button there also should be changed to allow for the evil Okay button, which I imagine is the case for other buttons too.

Oh my, I completely forgot to test evil interface. :)

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 5, 2021

@Branikolog

image

Nah, these are very different radio-buttons. Let's not touch this for now: it's out of scope of the PR anyway.

Oh my, I completely forgot to test evil interface. :)

Please do: I always try to test both, but I cannot spot all issues :)

I've also made an improvement for the Dismiss hero button. Turns out the original resources are inconsistent here: the pressed state is not shifted to the left as it should be.

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 5, 2021

@Branikolog all comments addressed. Also found that the EXIT button on the High Scores dialog didn't hold the pressed state properly due to handling the monster animations — fixed that too.

@ihhub ihhub modified the milestones: 0.9.10, 0.9.11 Dec 5, 2021
@Branikolog
Copy link
Collaborator

@a1exsh
I'll take a look a bit later.

EXIT button on the High Scores dialog didn't hold the pressed state properly due to handling the monster animations

Noticed that too, but thought it was not related to the issue. :)

@ihhub
Copy link
Owner

ihhub commented Dec 5, 2021

Hi @a1exsh , unrelated to this issue but previous one: if I change resolution of the game OKAY button has incorrect rendering:
image

Do you observe such in your build?

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 5, 2021

@ihhub yeah, I can also see it: some artifacts appear on the button after changing the resolution. Do you have ideas why would that happen and how to fix it?

@ihhub
Copy link
Owner

ihhub commented Dec 5, 2021

@ihhub yeah, I can also see it: some artifacts appear on the button after changing the resolution. Do you have ideas why would that happen and how to fix it?

No ideas yet. I'll check what's wrong.

@ihhub
Copy link
Owner

ihhub commented Dec 7, 2021

Hi @a1exsh , I think it happens because we use display as a background image. If we do we mustn't do this as display can be changed in a separate thread.

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 7, 2021

Hi @a1exsh , I think it happens because we use display as a background image. If we do we mustn't do this as display can be changed in a separate thread.

Wow, really? I thought it's single-threaded...

@ihhub
Copy link
Owner

ihhub commented Dec 7, 2021

Hi @a1exsh , I think it happens because we use display as a background image. If we do we mustn't do this as display can be changed in a separate thread.

Wow, really? I thought it's single-threaded...

No, it's not. Please add assert( &background != &fheroes2::Display::instance() ); for both functions to catch all possible cases. We should pass the image which is the real background.

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 7, 2021

display can be changed in a separate thread.

But wouldn't that mean that we should not modify display image unless we coordinate with other threads potentially doing the same? And yet I haven't seen us doing it, and all worked fine.

There must be something special to the code changing the resolution that breaks it, not related to threads, IMO.

@Branikolog
Copy link
Collaborator

Hi, @a1exsh ! Could you, please, look at some problems I've found?

I like, how you managed to handle text shifting in DISMISS button! Really nice!

But the background is not ok near top left corner, being too bright.
image

Also, while being inactive we have doubled left side of the button:
image
The same to fixed bottom line of this button right before last changes.

Also, I've noticed the same double edges (left and bottom edges) of inactive MAX button in hiring dialog.
image

Pressed "Exit Puzzle" button also have a tiny background flaw near upper left corner.
image

Similar case for Exit button from "View World" mode.
image
But, actually, original shadows near both this "EXIT" buttons look not good... I'm not sure, we should fix the issues above right now, since in future we will ( I hope :) ) fix the whole button.

Also it seems to me, that shadows of buttons in scenario info have a small pieces missing. Am I right? Or it's just my eyes tired of pixel-hunting?
Btn Shadow

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 8, 2021

Do you observe such in your build?

@ihhub I've opened a separate issue to track this: #4762

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 8, 2021

Hi, @a1exsh ! Could you, please, look at some problems I've found?

Will do :)

I like, how you managed to handle text shifting in DISMISS button! Really nice!

But the background is not ok near top left corner, being too bright. image

Yeah, I need to invent some new way to mess the original resources — looks like all the magic we have so far is insufficient 😂

Also, while being inactive we have doubled left side of the button: image The same to fixed bottom line of this button right before last changes.

I've noticed it as well: need to check what happens in the disabled button code.

Also, I've noticed the same double edges (left and bottom edges) of inactive MAX button in hiring dialog. image

Yay, it's actually the same code as for the Dismiss button. Will check it as well.

Pressed "Exit Puzzle" button also have a tiny background flaw near upper left corner. image

Similar case for Exit button from "View World" mode. image But, actually, original shadows near both this "EXIT" buttons look not good... I'm not sure, we should fix the issues above right now, since in future we will ( I hope :) ) fix the whole button.

Nice catch! There are entirely too many buttons in this game, that drives me crazy %)

Also it seems to me, that shadows of buttons in scenario info have a small pieces missing. Am I right? Or it's just my eyes tired of pixel-hunting? Btn Shadow

I continue to be amazed by your pixel-hunting skills, @Branikolog ! :) In this case it's a defect of the OG button resource: one pixel of the darkest shade is missing.

@Branikolog
Copy link
Collaborator

@a1exsh

Talking about pixel-hunting...

I've found out a small flaws near "OKAY" button in experimental settings... :D
ezgif com-gif-maker (30)

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 8, 2021

Talking about pixel-hunting...

I've found out a small flaws near "OKAY" button in experimental settings... :D ezgif com-gif-maker (30)

Part of original resource as well... :(

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 10, 2021

@Branikolog I've fixed the background corners around the Dismiss button — please have a look again :)

Regarding the disabled state of Dismiss and Max buttons: there is no easy solution for that, unfortunately, as these buttons are not provided separately from the background in OG resources, and our algorithm cannot tell the difference between background and parts of the button. We might invent something new one day, but for now let's leave them like they are right now. Also, the PR topic is pressed buttons ;)

We might want to do something about the View Puzzle / World buttons at some point, but I'd like to wrap this changeset first.

@Branikolog
Copy link
Collaborator

Branikolog commented Dec 10, 2021

Hi, @a1exsh !
One more pixel found at scenario adjustment window! :)
ezgif com-gif-maker (31)
For both "OKAY" and "CANCEL" buttons.

Edit:
Forgot to point right bottom corner of the button too.

Edit x2:
Right upper corner also has a little flaw too.

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 10, 2021

One more pixel found at scenario adjustment window! :)

Eagle-Eye! :)

It should be fixed now.

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 13, 2021

@ihhub I think this is now ready for the code review, as all found pixels flaws are addressed. ;)

Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @a1exsh , I left few comments in this pull request. Could you please check them?

@a1exsh
Copy link
Contributor Author

a1exsh commented Dec 20, 2021

@ihhub thanks for having a look: I've pushed an update.

@ihhub ihhub merged commit dc3fa30 into ihhub:master Dec 20, 2021
@ihhub
Copy link
Owner

ihhub commented Dec 20, 2021

@a1exsh , thank you so much for these changes!

Also there are some extra performance improvement we could have done but let's skip them for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement ui UI/GUI related stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants