RoanH / KeysPerSecond

A keys-per-second meter & counter. Written for osu! but should work for other rhythm games too.
https://osu.ppy.sh/forum/t/552405/
GNU General Public License v3.0
346 stars 28 forks source link

Refactor BasePanel & make KeyPanel extend BasePanel #13

Closed freakode closed 7 years ago

freakode commented 7 years ago

BasePanel and KeyPanel share most of their rendering code since KeyPanel is essentially just a BasePanel with the ability to toggle the color of the panel if its key is pressed. This functionality was added to BasePanel, along with general refactoring to make its intent clearer, and KeyPanel was refactored to subclass BasePanel.

freakode commented 7 years ago

Note that this PR makes the Horizontal Value - Title Panels all have the same behavior as KeyPanels previously had.

RoanH commented 7 years ago

Hey, I really liked the idea of merging the rendering code for all the panels. I noticed a lot of switch statements on the rendering mode in your implementation though. So I moved all the logic specific to a rendering mode to the corresponding mode. This will also make adding possible future modes easier.

I did some testing to verify that none of the rendering bugs I encountered before occurred and everything seems fine.

If you're okay with the changes I made I'll merge this. Or if you have any corrections/suggestions we can discuss those.

freakode commented 7 years ago

Yeah I like those changes! It definitely makes the code even cleaner. I'm fine with merging this.

RoanH commented 7 years ago

Thanks again ^^. There's still some things I'd like to refactor myself, but I'll probably release a new version soon.