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

Use ScreenCoordsXY on gfx_draw_string_right #11569

Open
tupaschoal opened this issue May 1, 2020 · 8 comments
Open

Use ScreenCoordsXY on gfx_draw_string_right #11569

tupaschoal opened this issue May 1, 2020 · 8 comments

Comments

@tupaschoal
Copy link
Contributor

@tupaschoal tupaschoal commented May 1, 2020

Create an overload of gfx_draw_string_right on \src\openrct2\drawing\Text.cpp with the same name, but that takes a const ScreenCoordsXY& object instead of an int32_t x and and an int32_t y and replace the calls to the {x ,y} pair by the one using ScreenCoordsXY.

Don't try to do all calls at once, unless it doesn't occur a lot, as this might lead to a huge PR. When we stop using the old function, we can drop it entirely in favour of the ScreenCoordsXY alternative.

@Aryaman73
Copy link
Contributor

@Aryaman73 Aryaman73 commented May 5, 2020

Hey! I'd like to take this issue on. It's my first time contributing to OpenRCT2, so I was wondering if there were any documents other than this one about contributing to this project. (I couldn't find any details about building the code and testing it, in particular).

Awesome project btw 😄

@tupaschoal
Copy link
Contributor Author

@tupaschoal tupaschoal commented May 5, 2020

There are some things about compiling in our main readme:
https://github.com/OpenRCT2/OpenRCT2/blob/develop/readme.md#32-compiling-and-running

There are also links on our wiki such as coding style and Commit messages

Aryaman73 added a commit to Aryaman73/OpenRCT2 that referenced this issue May 7, 2020
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
tupaschoal added a commit that referenced this issue May 8, 2020
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
@Aryaman73
Copy link
Contributor

@Aryaman73 Aryaman73 commented May 8, 2020

@tupaschoal Thanks for the merge, and helping me out! What else needs to be done for this? I can't find any other calls to this function,

@tupaschoal
Copy link
Contributor Author

@tupaschoal tupaschoal commented May 8, 2020

Really? If none is calling the old function anymore, just delete it and submit a pr. It should fail to compile if there are users still

@Aryaman73
Copy link
Contributor

@Aryaman73 Aryaman73 commented May 8, 2020

Sorry, not sure what I did wrong earlier but you're right, there are definitely other calls to the function. As for fixing the other calls, the change should pretty much just include changing:
gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->windowPos.x + w->width - 5, y );
to this:
gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, {w->windowPos.x + w->width - 5, y });

Or is there more to it?

@duncanspumpkin
Copy link
Contributor

@duncanspumpkin duncanspumpkin commented May 8, 2020

That's pretty much all you need to change. In some places you might have a ScreencoordsXY already so you obviously wouldn't need to create one for that.

@Aryaman73
Copy link
Contributor

@Aryaman73 Aryaman73 commented May 8, 2020

Cool. The issue mentions that we shouldn't make all of the changes in one PR. I think there are around a dozen files which will need to be refactored, so how should we PR it? Create a PR for each file?

@duncanspumpkin
Copy link
Contributor

@duncanspumpkin duncanspumpkin commented May 9, 2020

That is just in case its one of the string functions that is used absolutely everywhere. If its just a dozen files then do a single PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.