Skip to content

Widget refactorings, turned draw functions into normal member functions.#1012

Merged
AaronVanGeffen merged 10 commits intoOpenLoco:masterfrom
Truenya:master
Jun 26, 2021
Merged

Widget refactorings, turned draw functions into normal member functions.#1012
AaronVanGeffen merged 10 commits intoOpenLoco:masterfrom
Truenya:master

Conversation

@Truenya
Copy link
Copy Markdown
Contributor

@Truenya Truenya commented Jun 21, 2021

No description provided.

@duncanspumpkin
Copy link
Copy Markdown
Contributor

There are a few variables i think that you will have to rename due to hiding of member variables

if (window->flags & WindowFlags::flag_11)
{
image = 0x20000000 | 2322 | ((colour & 0x7F) << 19);
frame = 0x20000000 | 2322 | ((colour & 0x7F) << 19);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a function that could be used for this instead to clear it up.
imageId = Gfx::recolour(2322, Colour::opaque(colour))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Image 2322 is the frame's background image (800px wide). Please add a constant to Graphics/ImageIds.h for it. (Note that the file is ordered sequentially.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added constant, named frame_background_image in right order.

@AaronVanGeffen AaronVanGeffen linked an issue Jun 22, 2021 that may be closed by this pull request
@AaronVanGeffen
Copy link
Copy Markdown
Member

Could you address the formatting issues with this PR? See the clang-format CI.

There's not much use in merging master into this branch when there are no conflicts, by the way. We prefer to avoid nested merge commits, anyway.

// TODO: Remove image addition
uint32_t image = widget->image + 2;
// TODO: Remove added_image addition
uint32_t added_image = image + 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you apply all the comments I had to the whole set of your changes not just the first ones.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am verry sorry, forgot some variables.
Now it shoud be fine.

@duncanspumpkin
Copy link
Copy Markdown
Contributor

Correct those minor 3 comments and I think this is good to merge.

Co-authored-by: Aaron van Geffen <aaron@aaronweb.net>
@AaronVanGeffen AaronVanGeffen merged commit 641898d into OpenLoco:master Jun 26, 2021
@AaronVanGeffen AaronVanGeffen added this to the v21.05+ milestone Jul 4, 2021
tomasharkema added a commit to tomasharkema/OpenLoco that referenced this pull request Jul 13, 2021
…ature/mac-docker

* 'master' of https://github.com/OpenLoco/OpenLoco: (536 commits)
  Mention code style in readme (OpenLoco#1047)
  Remove redundant rotate function (OpenLoco#1046)
  Link up implemented function (OpenLoco#1043)
  Fix use of constants for coord limits (OpenLoco#1037)
  validCoords: remove template parameter and name type (OpenLoco#1033)
  Add coordinate validation to tile loops with offsets (OpenLoco#1031)
  Implement ChangeCompanyColour game command (OpenLoco#1029)
  Implement colour picker dropdowns (OpenLoco#1028)
  Implement StationManager::generateNewStationName (OpenLoco#1020)
  Station rename command (OpenLoco#984)
  Fix access to embedded object name (OpenLoco#1022)
  Reduce inclusion of StringIds.h in header files (OpenLoco#985)
  Implement the station name background paint (OpenLoco#1023)
  Force alignment on TileManager::createAnimation hook
  Merge duplicated flags and use accessors (OpenLoco#1025)
  Remove use of global stringformatbuffer where not required (OpenLoco#1024)
  Refactor calls to tryCreateInitialMovementSound (OpenLoco#1018)
  Turn widget draw functions into Widget struct member functions (OpenLoco#1012)
  Allow filtering the vehicle list by station or cargo (OpenLoco#997)
  Restore game command table alignment
  ...
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.

Refactor Widget draw member functions

3 participants