RasmusD / StoryTime

A Choose-Your-Own-Adventure Story Interpreter
The Unlicense
0 stars 0 forks source link

Only draw graphics when changes occur. #1

Closed mplooster closed 5 years ago

mplooster commented 5 years ago

Added checks to only draw in the render window if something in the graphics have changed. Otherwise, it was always redrawing the same scene as fast as it could (but below the maximum frame rate). This change greatly improves responsiveness, and helps save some CPU time because it is no longer constantly drawing.

RasmusD commented 5 years ago

I was thinking something along the same lines of having a new base class but didn't want ot bring it up in the review. Happy for the change. We can finish up this PR and put it on the TODO list. I don't mind the name, GraphicsBase is good - or perhaps Drawable? I think the drawComplete should be moved into the draw functions themselves. requestDraw -> redraw is good with me. Or perhaps even requestRedraw. I just want it explicit that it is a redrawing and not just drawing once. I dunno, just makes more sense to me.