Frequently Asked Questions
оглавление | demo party в ex-СССР | infused bytes e-mag | новости от ib/news | другие проекты | письмо | win koi lat

следующий фpагмент (2)
- Usenet echoes (21:200/1) ------------------------------ REC.GAMES.PROGRAMMER - Msg : 30 of 39 From : 2:5030/144.99 11 Aug 94 01:15:10 To : All 12 Aug 94 04:32:46 Subj : (1) Re: Fast Horizontal Scrolls -------------------------------------------------------------------------------- Steve ( wrote: : Hi all, I am working on a game which is somewhere between MK and SF and am : having some problems finding a *fast* scrolling algorithm... I plan to make the : screen about 640x200 and am using mode 13h... I have tried storing the : backgrounds vertically and horizontally without much luck and thought I would : see if anyone had any ideas/hints that might help me out... There are two fundamentally different approaches to this. One works with mode 13h, the other one works with mode X. First the mode 13h approach... First you need to store the background in memory. The best way (in mode 13h) would be to store it as two bitmaps: one for the top half of the screen and one for the bottom. That way each half can fit in a 64K segment. Then, once you have drawn your sprites on the background[s] (you might want to keep two copies of the backround in memory: one with and one without sprites), simply start at the offset of where the screen is in relation to the 640x200 (actually 640x100 because you divided the background in two halves) and copy 320 bytes. Then move to the next line (640 + scroll_offset) and copy another 320 bytes. After you've drawn the first 100 lines, switch to the "bottom" bitmap and repeat. If you want real speed, you'll want to use mode X. For simple sideways scrolling, simply set the logical with to 640. You can then adjust the visible start to scroll sideways. You can also scroll up and down, though that won't work with double buffering. For really good animation and scrolling, do something like this: First, store the background in main memory in 4 parts, each one corresponing to one of the four planes. Then draw to the hidden page (each page is 640x200 in size) and copy the background there (for even better speed, use dirty rectangles). Then draw the sprites. Switch visual page (adjusting for scrolling). Repeat. Mode X hardware scrolling has the disadvantage that you can only scroll by multiples of 4 pixels. -- +---------------------------------------------------------+ | "I don't work for HP, nor for anyone else, and if I did | | I still wouldn't speak for them." | | Rainer Deyke - | +---------------------------------------------------------+

Всего 1 фpагмент(а/ов) |пpедыдущий фpагмент (1)

Если вы хотите дополнить FAQ - пожалуйста пишите.

design/collection/some content by Frog,
DEMO DESIGN FAQ (C) Realm Of Illusion 1994-2000,
При перепечатке материалов этой страницы пожалуйста ссылайтесь на источник: "DEMO.DESIGN FAQ,".