-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add return to main menu and play map buttons to the editor #9512
base: master
Are you sure you want to change the base?
Conversation
WIP. Need correct placing of button and design of new dialog
There was a problem hiding this 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)
Looks nice. But would it look better if Load Map and Save Map where next to each other in the same row or column? Not that it really matters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @zenseii, I left several suggestions. Could you please take a look when you have time?
fheroes2::Sprite mainMenuReleased; | ||
fheroes2::Sprite mainMenuPressed; | ||
fheroes2::getTextAdaptedButton( mainMenuReleased, mainMenuPressed, gettext_noop( "MAIN\nMENU" ), | ||
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON, isEvilInterface ? ICN::STONEBAK_EVIL : ICN::STONEBAK ); | ||
fheroes2::Sprite playMapReleased; | ||
fheroes2::Sprite playMapPressed; | ||
fheroes2::getTextAdaptedButton( playMapReleased, playMapPressed, gettext_noop( "PLAY\nMAP" ), isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON, | ||
isEvilInterface ? ICN::STONEBAK_EVIL : ICN::STONEBAK ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we generate these button's images in agg_file.cpp
like it is done for the other buttons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to avoid polluting agg_file.cpp
file as it became too big to maintain. Having a function to do the work without increasing the number of ICN entries is a better solution.
@zenseii , I believe fheroes2::getTextAdaptedButton()
function should be renamed into fheroes2::getTextAdaptedButtonSprites()
function as it doesn't generate a button but only creates Sprites.
Going forward, we can create fheroes2::getTextAdaptedButton()
function which will return fheroes2::ButtonSprite
object so we can use it here. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So then it should be better to remove all other buttons from agg_image.cpp
used in this dialog and generate them here to have the same code and to avoid questions like "Why this button image is made this way and that button - the other way?" ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ihhub and @Districh-ru. I will pause this PR and make a new one that makes these changes so that we can tidy up the button code and avoid confusion moving forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Districh-ru , not all buttons from agg_file.cpp
file can be removed easily. Some of them have logic for button generation, others support original resources.
} | ||
} | ||
else { | ||
fheroes2::showStandardTextMessage( _( "Invalid Map" ), _( "This map is not valid. Try to save the latest changes." ), Dialog::OK ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we say about the need of 1 or more players on the map?
In example: "This map is not valid. The map should have at least one human player and be saved on your storage."
if ( le.MouseClickLeft( buttonPlayMap.area() ) ) { | ||
// The map either hasn't been saved to a file or there aren't any human-playable colors. | ||
if ( !conf.getCurrentMapInfo().name.empty() && conf.getCurrentMapInfo().colorsAvailableForHumans > 0 ) { | ||
if ( fheroes2::showStandardTextMessage( _( "Play Map" ), _( "Do you wish to leave the editor and play the current map?" ), Dialog::YES | Dialog::NO ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention that all unsaved changes will be lost or allow to open the Save Map dialog?
else if ( le.isMouseRightButtonPressedInArea( buttonMainMenu.area() ) ) { | ||
fheroes2::showStandardTextMessage( _( "Main Menu" ), _( "Return to the game's Main Menu." ), Dialog::ZERO ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we add such dialog for the PLAY MAP button :)
Hi, @Mr-Bajs. I wanted to mimic as much as possible how the original buttons were placed but I'm really impartial to it. I guess Main Menu should be where it is and quit should be lower right, the rest is the same for me. |
Swapping places save map and play map might look better. But since also the same menu ingame would also benefit with a Main Menu button. You layout keeps the menus more similar to each other maybe thats better, atleast until or if the in game menu gets an update with a main menu button. |
fheroes2::Sprite mainMenuReleased; | ||
fheroes2::Sprite mainMenuPressed; | ||
fheroes2::getTextAdaptedButton( mainMenuReleased, mainMenuPressed, gettext_noop( "MAIN\nMENU" ), | ||
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON, isEvilInterface ? ICN::STONEBAK_EVIL : ICN::STONEBAK ); | ||
fheroes2::Sprite playMapReleased; | ||
fheroes2::Sprite playMapPressed; | ||
fheroes2::getTextAdaptedButton( playMapReleased, playMapPressed, gettext_noop( "PLAY\nMAP" ), isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON, | ||
isEvilInterface ? ICN::STONEBAK_EVIL : ICN::STONEBAK ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to avoid polluting agg_file.cpp
file as it became too big to maintain. Having a function to do the work without increasing the number of ICN entries is a better solution.
@zenseii , I believe fheroes2::getTextAdaptedButton()
function should be renamed into fheroes2::getTextAdaptedButtonSprites()
function as it doesn't generate a button but only creates Sprites.
Going forward, we can create fheroes2::getTextAdaptedButton()
function which will return fheroes2::ButtonSprite
object so we can use it here. What do you think?
if ( le.MouseClickLeft( buttonPlayMap.area() ) ) { | ||
// The map either hasn't been saved to a file or there aren't any human-playable colors. | ||
if ( !conf.getCurrentMapInfo().name.empty() && conf.getCurrentMapInfo().colorsAvailableForHumans > 0 ) { | ||
if ( fheroes2::showStandardTextMessage( _( "Play Map" ), _( "Do you wish to leave the editor and play the current map?" ), Dialog::YES | Dialog::NO ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should Editor
start from a capital letter?
@Districh-ru. I noticed that when the Play Map button is used and you arrive at the scenario info dialog, if you then press cancel the screen will flash as if a fadeout was triggered. Are fade out's somehow cued? I'm not entirely sure where to look to solve this. |
@zenseii, I've fixed this issue - added a check when rendering the Select Scenario dialog that also resets the need of fade effect. |
I'd also prefer to swap PLAY MAP and SAVE MAP so there the upper row will be for the map manipulations (new/load/save) and the lower row for the quit from Editor (to new game/main menu/OS). |
I had to add an extra button to keep symmetry of the dialog. The button can easily be changed to "test map" or similar.
Fix #8720