twopointzero / TJAPlayer3

TJAPlayer3 is a rhythm game application for Windows (and compatible environments). It provides a style of gameplay very similar to that of Taiko no Tatsujin and similar rhythm games, and supports .tja files compatible with a number of other similar rhythm game applications. Download the latest release here: https://github.com/twopointzero/TJAPlayer3/releases
MIT License
158 stars 153 forks source link

Fix song loading subtitle positioning bug (by de-duplicating left/center/right-aligned drawing code that was using "reference points") #49

Closed twopointzero closed 4 years ago

twopointzero commented 4 years ago

TJAPlayer3 contains much duplicate code related to left/center/right-aligned drawing. Some of that code has skin-controlled alignment using a "reference point" enumeration type, and when this alignment was added it was done via a pile of copy/paste code. (This particular pattern of code was spotted during the recent batch of texture resource management improvements.)

One specific instance of this affected subtitle positioning logic, and was an obvious visible copy/pasta issue as noted in #47.

While much centering code still appears in various places, the code using these "reference point" enumerations has been gathered into CTexture and delegated to a single set of implementing code there. Future PRs will perform further de-duplication of similar left/center/right aligned drawing.

This fixes #47 as written, though further de-duplication should be performed as noted above.