This seems to be a simple problem to state, but I am unable to understand what the solution is. I have a screen class where the objects are basically x and y coordinates, font color, etc. All is working well, I can instantiate and use these objects.
Sometimes I need to change the color of the string that is being written to the screen. This is more of a "system call" that once done, sets all strings written after that. So each time I write to the screen, I am forced to first "set the text color". Or do I? I have a method, setValue:
objA->setValue("1234", RED);
When the method gets this call, it will set the color of the screen write. Let's say objA just set the color RED. If another object needs to write to the screen, and it's the same color, I don't want to write that to the screen again as to reduce the number of writes to the screen. So, based on the last object's color, I want to update the screen text color (or not) In C, this of course would be the most evil static global. How can I do something similar in C++?
Thanks...