Closed eliasreid closed 4 years ago
http://lazyfoo.net/tutorials/SDL/16_true_type_fonts/index.php
Tutorial doesn't seem to cover how to update text dynamically. See this answer on stack overflow https://stackoverflow.com/a/31652567.
Optimally, would be rendering text form a pre-created texture containing all text. But in this small case, probably ok to render whole thing each cycle. In the case of health text, only update when there is actually a change.
Maybe better off moving to openGL eventually: https://stackoverflow.com/a/41362410
Am I managing resources (destroying texture) properly in TextBox? should be freeing texture in destructor. Should TextBox inherit from GameObject?
Score UI only one left. Going to go for composition over inheritance in this case.
Create a class that has a textbox.
Extend this to healthui and refactorif makes more sense
Should give text box a second constructor. one that takes a screen position enum instead of explicit x and y coordinates.