Hey,
I am sure I am just splitting another hair here, but is there a significant computational difference between looking at a class's public member vs calling one of its functions?
Basicly every class in my game has a
Then in the game I have a function Draw() where I have two options for checking to see if I should drawn an object... I wasn't sure if they were computationally equivalent so I figured I'd ask.Code:public: bool Active; void Draw(SpriteBatch SB);
first option
This turns into ALOT of iffs in my draw code and I was starting to get annoyed by it.Code:void Draw() { if(ThisObject.Active) ThisObject.Draw(spriteBatch); }
Second option is to put the check within the Object.Draw(SB) fuction and then in the game Draw() code only call.
So basicly which is taking more process power?Code:void Draw() { ThisObject.Draw(spriteBatch); ThatObject.Draw(spriteBatch); // ect }
ThisObject.Active || ThisObject.Draw#SB)



LinkBack URL
About LinkBacks



