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
Code:
public:
bool Active;
void Draw(SpriteBatch SB);
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.
first option
Code:
void Draw()
{
if(ThisObject.Active)
ThisObject.Draw(spriteBatch);
}
This turns into ALOT of iffs in my draw code and I was starting to get annoyed by it.
Second option is to put the check within the Object.Draw(SB) fuction and then in the game Draw() code only call.
Code:
void Draw()
{
ThisObject.Draw(spriteBatch);
ThatObject.Draw(spriteBatch);
// ect
}
So basicly which is taking more process power?
ThisObject.Active || ThisObject.Draw#SB)