Hi all, an open question:
I am trying to create a visual timer for a game. Basically, it displays an ever-shrinking colored bar to tell you how much time you have left. I would like the bar to constantly change color from green (plenty of time) to yellow to red (almost no time left) depending on the situation. I currently have my tick() method producing RGB values that properly express the time remaining.
But that way, I have to allocate a new Color each tick. I am currently just using g.setColor() and then g.drawRect() to update the appearance of the timer. Should I worry about this? (ie - are Color objects at all expensive?) And does anyone know of a better way? I assume there must be a reason why Color doesn’t have setR(), setG() and setB() methods…Thanks for any help.