Archived

This topic is now archived and is closed to further replies.

nanoware

My games look like crap

Recommended Posts

When I use graphics in my Turbo C++, they look really nasty, and they flicker. I know that I am supposed to use a back surface or something, but I don''t know how to do it. I also need to know how to use bitmaps or some other graphics. Thanks

Share this post


Link to post
Share on other sites
Look up ''double buffering''. Basically, the idea is that you have an area of memory, identical in size and type to your screen memory. You draw to that buffer, and then copy it all to the main screen memory in one go. Doing it in one go reduces the chance of flickering, with the only disadvantage being that you need extra memory to do it this way. However, nearly all games use some variation of this technique.

Share this post


Link to post
Share on other sites
Hi,
If you are using BGI, it will be slow, use mode13. If you are using mode13 then you have to wait for a vertical blanking, i.e the reposition of beam of crt to next y value with the initial x value and also copy everything to memory before copying onto the surface - look up memcpy.

Share this post


Link to post
Share on other sites
In order to wait for the vertical retrace in mode 13h you use the following code:

  
void vsync(void)
{
// wait for verticle retrace to avoid flicker

while (inportb(0x3da) & 0x08);
/* vga is in retrace */
while (!(inportb(0x3da) & 0x08));
/* wait for start of retrace */

}


Probably even faster if you can _inline it. This code was cut directly out of Vaelek''s ''Fire How To'' article here on GDNet

-Chris Bennett of Dwarfsoft - The future of RPGs Thanks to all the goblins in the GDCorner niche

Share this post


Link to post
Share on other sites