Skip to content

HighScoreTrophyRenderer

Grisgram edited this page Oct 10, 2022 · 7 revisions

This is a more sophisticated renderer for a HighScoreTable, as it allows trophy sprites to be rendered and the top 3 are promoted way more than in the standard HighScoreTableRenderer.

You can place this object in a room and in the Room Start event (or the Create event of any controller object), you just need to invoke set_table(_table) on the HighScoreTrophyRenderer to make it render the highscores to the screen.

Surfaces

As rendering an entire table with an unknown number of rows and multiple formatted columns is expensive in CPU terms, the renderer objects do not draw the table to the screen directly.
Instead, they draw the table to a private Surface only once (in the set_table function) and later on, in the Draw event they just draw that pre-rendered surface to the screen, saving tons of CPU time.

To force an update of the surface, you can invoke the update() function of the HighScoreTrophyRenderer. This will re-create the surface with the latest data!

Variable Definitions

The HighScoreTrophyRenderer extends the Variable Definitions of the HighScoreTableRenderer by some values needed for the trophy sprites.

These are settings of the HighScoreTrophyRenderer of the demo room in the repository: image

New are the three _trophy_sprite variables that let you set the iconic sprites to be used as trophies. Optionally, you can apply the rank_*_color values as draw_color for the sprites, for instance, if you use the same sprite for all ranks and you just want to have them colored differently.

To activate this feature, set the apply_rank_color_to_sprites to true.


IMPORTANT! As the renderer pre-renders the table to a surface, the trophy sprites will not be animated. Only their first subimage is rendered to the surface!


All other variables behave identically to the HighScoreTableRenderer.

Clone this wiki locally