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

Simplify skin functions #210

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Simplify skin functions #210

wants to merge 2 commits into from

Conversation

robalni
Copy link
Contributor

@robalni robalni commented Sep 10, 2020

This change makes the code easier to read. It changes behaviour of drawskin slightly; now it stretches the image instead of repeating it but that should not be visible with default skin.

int w = max(x2-x1, 2), h = max(y2-y1, 2), tw = size ? size : t->w, th = size ? size : t->h;
float pw = tw*0.25f, ph = th*0.25f, qw = tw*0.5f, qh = th*0.5f, px = 0, py = 0, tx = 0, ty = 0;
if(w < qw)
int width = max(x2 - x1, 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

it'd be awesome if you could change max and min to std::max and std::min c:

if(w < qw)
int width = max(x2 - x1, 2);
int height = max(y2 - y1, 2);
int tw = size ? size : t->w;
Copy link
Contributor

Choose a reason for hiding this comment

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

please write size != 0 ? ... instead of just size ? ...

@MoonPadUSer
Copy link
Contributor

Isn't the drawskin() function supposed to use some kind of 9-split and repeat it based on that? Instead of just plain stretching/repeating

@robalni
Copy link
Contributor Author

robalni commented Sep 11, 2020

Yes, it still splits it in 9. It's just the center piece that is stretched now instead of repeated.

@MoonPadUSer
Copy link
Contributor

I think that's not how you're supposed to do that, ideally it repeats it so it can give ideal results

@robalni
Copy link
Contributor Author

robalni commented Sep 11, 2020

Doesn't that just depend on what skin you have? Some skins look better stretched and some repeated.

@MoonPadUSer
Copy link
Contributor

yeah, but usually you design your skins in a way so they look the best when repeated, e.g. if you have a low-res skin, stretched will make it look very pixelated

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.

2 participants