1

I want to know the difference between a blit() and a flip() function, some of the tutorials I follow uses either of the two I have yet to see any actually use both and explain the difference.

I know that blit() works on surface and flip() only works on display, but both seems to be doing the exact same thing, so I'm confused - in the documentation (correct me if I'm wrong) blit() seems to be putting another surface on top of the other and flip() just swapes the surface, if that's the case - wouldn't flip() be faster then blit() considering that blit() will just keep on stacking on top of the surface behind it and slowly building up memory?

EDIT: The question is not an exact duplicate of another, the link the user provided me where two completely different ones - but mentions the same function. It, did not however, answered my question at all. Please remove the duplicate tag from this post - Thanks

Blueboy90780
  • 145
  • 1
  • 12
  • Read https://stackoverflow.com/questions/17454257/a-bit-confused-with-blitting-pygame – saud Dec 11 '17 at 14:21
  • And https://stackoverflow.com/questions/29314987/difference-between-pygame-display-update-and-pygame-display-flip – saud Dec 11 '17 at 14:22
  • display.update() is not necessarily what I'm looking for, bu the first link was very useful - didn't know their was a duplicate question. Thanks – Blueboy90780 Dec 11 '17 at 14:28
  • @RottenCandy change of mind - I've read the answer to the first link and it did not answer my question whatsoever, it only helped to alleviate a bit of my confusion but not the question itself. Therefore the duplicate question is false, there are no duplicates - I've made sure to research beforehand – Blueboy90780 Dec 11 '17 at 14:39
  • 1
    I changed my answer in this link. I add info about `flip()` and `update()`. – furas Dec 11 '17 at 14:42
  • Still doesn't explain the two questions on the title - I only know what blitting and flip() does but still don't know which one is faster - and when I should use on or the other (as the question stated). All 3 links are invalid – Blueboy90780 Dec 11 '17 at 14:44
  • @furas is it possible if you can take another look at my question? – Blueboy90780 Dec 11 '17 at 14:48
  • they do different things - so you can compare them. `blit()` draw image in buffer, not directly on screen. `flip()` doesn't draw image - it sends data from buffer to video card. Read my answer again. – furas Dec 11 '17 at 14:48
  • in other words: first you put all elements in buffer using `blit()`, `draw.rect()`, `draw.circle()`, ect. and later you use `flit()` to send this buffer on screen. If you use only `blit()`, `draw.rect()`, `draw.circle()`, without `flip()` then you will see nothing on screen. – furas Dec 11 '17 at 14:53
  • I added image to answer in link. – furas Dec 11 '17 at 16:12
  • Unfortunately, your original question, "what's the difference between...", is also off-topic because it's _too broad_ or answers would be _primarily opinion based_. For some guidance, see [this relevant meta](https://meta.stackoverflow.com/questions/291052/should-framework-comparison-questions-be-deleted). (It's about _deleting_, not _closing_ comparison questions, btw.) – Mogsdad Dec 11 '17 at 19:36

0 Answers0