Re: [AD] set_display_mode and screen update handling |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Elias Pschernig wrote:
Plain text document attachment (modefuncs.c)
/* The bitmaps we'll be drawing to */
static BITMAP *page[3];
I don't know, in my implementations of this function (I guess everyone
uses a wrapper around set_gfx_mode :), I use this:
BITMAP *front_buffer, *back_buffer, *middle_buffer;
And swap those variables around. No need for a current_page variable,
and the code gets cleaner IMO.
I don't really like the idea of swapping pointer values like that when
all you have to do is update an int variable. Also the names seem a
little ambiguous.
If you request: TRIPLE_BUFFER | PAGE_FLIP, should it do page flipping if
triple buffering isn't possible?
That's what my code currently does, yeah.
I think, the bpp could be defines as well.
Then the question comes in, as to what should have priority?
Windowed/fullscreen or bitdepth? If the bitdepth and screen mode combo
isn't available, should the screen mode switch first or bitdepth?
I guess the vs should be not a parameter here, but specified in the call
to set_display_mode. After all, it has no meaning for anything but
double buffer.
Hmm.. perhaps it should be another function altogether? I don't like the
idea of having to reset the gfx mode just to toggle vsync.
Very often, you also need the front buffer. E.g. when doing page
flipping, but then you use the GUI file selector. screen could be the
back page in that case. With my method, there'd be 3 global variables to
get up to 3 pages (or just a wrapper get_front_page would do as well).
Again, these names are a little ambiguous. If you're doing something
like Allegro's GUI (dirty rectangles), then I'd think you'd either use
no buffering, or double buffering (making sure to blit the buffer
whenever it changes), or to blit the current screen to the current
buffer (which would be fast since it'd likely be vram->vram
accelerated), modify that, and then show the new buffer.
- Kitty Cat