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

Refactor shields with common shapes #480

Merged
merged 4 commits into from
Jul 9, 2022
Merged

Conversation

claysmalley
Copy link
Member

@claysmalley claysmalley commented Jul 9, 2022

A much-needed refactor to give common shield shapes a consistent naming scheme.

A new shield definition parameter is introduced, verticalReflect, which draws a shield upside-down when set to true.

This was sort of a prerequisite to #458, since it introduces another convex triangle shield that's just a vertically flipped version of an existing shield. In the future, we may be able to further reduce the size of the sprite sheet by drawing some of these shapes directly with code.

Basic shapes include:

  • tri_rounded
  • tri_convex
  • diamond
  • trapezoid
  • trapezoid_rounded
  • pent
  • home
  • hex_horz
  • hex_vert
  • oct
  • badge

In each case, a white shield with a black border is treated as the default color scheme. This black border can be recolored with colorLighten. Other color variants are specified by appending the background color first, then the border color. If no second color is specified for the border, white is assumed, except when the background is yellow, in which case a black border is assumed.

Additionally, the dimensions of the Malaysian route shield are adjusted to enlarge text and match other shields with similar shapes:

Screenshot from 2022-07-09 10-08-48

@ZeLonewolf
Copy link
Member

I would suggest dropping the 40 from the filenames also.

@ZeLonewolf
Copy link
Member

Seems to be working for me. What are examples of shields using the new verticalReflect parameter?

@claysmalley
Copy link
Member Author

@claysmalley
Copy link
Member Author

I forgot to multiply the pixel ratio by 2 - now it should look the same as before.

Copy link
Member

@ZeLonewolf ZeLonewolf left a comment

Choose a reason for hiding this comment

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

Seems to be working here. Ubuntu 22.04/Chrome

@claysmalley claysmalley merged commit 4c1c724 into main Jul 9, 2022
@claysmalley claysmalley deleted the clay-shields-refactor branch July 9, 2022 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants