Advertisement

My games look like crap

Started by June 28, 2001 07:56 PM
3 comments, last by nanoware 23 years, 5 months ago
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
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.
Advertisement
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.
Hello from my world
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
Thanks for your help guys, I will get into it right now!

This topic is closed to new replies.

Advertisement