| View previous topic :: View next topic |
| Author |
Message |
020200
Joined: 09 Apr 2006 Posts: 2
|
Posted: Sun Apr 09, 2006 7:25 am Post subject: The magic gate to double buffering |
|
|
I am really having some troubles with the double buffering.
Is there a way to *directly* print on screen, or to emulate that behaviour?
When I want to clear the screen I do it once. But when the screen:flip() is inside the loop everything goes flashy. I surely need the flip to get the actual changes. Is there a way to clear both buffers at the same time or to copy the contents into both buffers at once? (I want to avoid a for-loop for this purpose). What's the best way to do it?
This could maybe working by making a copy of the *buffered* screen? But how can I do that? |
|
| Back to top |
|
 |
KcDan
Joined: 24 Jan 2006 Posts: 13 Location: Delaware
|
Posted: Sun Apr 09, 2006 12:33 pm Post subject: |
|
|
Ok, lets say that right now Screen 1 is in view. You want to edit to it so flip it so that your able to edit it right now, then when your done with it flip it again.
| Code: |
while TRUE do
screen.flip()--Put your screen into the editing one..e.e;
--Do your editing here
screen.flip()--Put your screen back
screen.waitVblankStart()--Wait for it to refresh
end |
|
|
| Back to top |
|
 |
DiabloTerrorGF
Joined: 15 Jul 2005 Posts: 64
|
Posted: Sun Apr 09, 2006 2:55 pm Post subject: |
|
|
| Wouldn't that make the screen flash? |
|
| Back to top |
|
 |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Sun Apr 09, 2006 7:55 pm Post subject: |
|
|
the code should actually be
| Code: | while TRUE do
screen.flip()--Put your screen into the editing one..e.e;
--Do your editing here
screen.waitVblankStart()--Wait for it to refresh
screen.flip()--Put your screen back
end |
but if changing the image alot like as in a paint aplication you tend to get some flickers |
|
| Back to top |
|
 |
KcDan
Joined: 24 Jan 2006 Posts: 13 Location: Delaware
|
Posted: Mon Apr 10, 2006 1:56 am Post subject: |
|
|
| ... |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Mon Apr 10, 2006 7:50 am Post subject: |
|
|
You are aware that you can save your screen to an image, (and screen.blit it to the buffer image so when you screen.flip for the first time.. it takes you to a non flicker state.
you should use it that way, it slows down the processing a bit though.
Or you could always learn to limit your FPS so it doesnt flicker. |
|
| Back to top |
|
 |
DiabloTerrorGF
Joined: 15 Jul 2005 Posts: 64
|
Posted: Mon Apr 10, 2006 7:53 am Post subject: |
|
|
| I really don't see a reason to not use the double buffer unless I am missing something... it shouldn't have any bade effects by using it... |
|
| Back to top |
|
 |
|