game-programming-patterns icon indicating copy to clipboard operation
game-programming-patterns copied to clipboard

I can't understand Double Buffer the example of Actors

Open LoranceChen opened this issue 10 years ago • 0 comments

Graphic example is great! But I can't comprehend why this code would be "see a slap in the frame after it was actually slapped". void Stage::update() { for (int i = 0; i < NUM_ACTORS; i++) { actors_[i]->update(); }

for (int i = 0; i < NUM_ACTORS; i++) { actors_[i]->swap(); } } example: I have three actors a,b and c,and then,I put them into stage's array,just like: array.add(c,0); array.add(a,1); array.add(b,2); The update function also update slap action in seq frame rather then once. It's also depend on their order in the stage’s array.What's the matter?

LoranceChen avatar Jul 16 '15 06:07 LoranceChen