Advertisement

Help with offscreen buffers

Started by February 04, 2000 10:45 AM
0 comments, last by Dark Star 24 years, 8 months ago
Hi, For my game I am writing in DJGPP C++ I am using offscreen buffers which are just pointers to char type and have room for 64KB. One is the vga memory itself. I was just wondering if there was a way I could copy from one buffer to the other without having to address each position individually. The method I use is (Note:I am just a beginner) for (int x=0; x<320; x++) { for (int y=0; y<200; y++) vgaMemory[y*320+x]=offscreen[y*320+x]; } that is how I copy from my offscreen buffer to the screen. But I feel that this is too much of a slow method seeing as I need to this many times within the game and with other buffers. I just want to know if there is a faster way of doing this like in a flash or something ? Cos I feel my game would really suffer. Thanks in advance. Dark Star
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
Yeah, check out memcpy. It''s your friend.

memcpy (vgaMemory, offscreen, 320 * 200 * sizeof char);

(yes, that''s the same as 320 * 200 * 1, but I like including types, ok? back off!!! )

This topic is closed to new replies.

Advertisement