News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Arnaud

[CPCTelera] Scrolling a part of screen

Started by Arnaud, 20:52, 08 May 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Hello,
i'm coding a scrolling (mode 0) and i have performance issues.

Here what i'm coding :
[attach=2]

Only the green parts are scrolling (80x12 pixels), the gray center of picture is the CPC screen, and blue circles are static sprites.

- I handled the sprite clipping with a C function to draw the visible part of the sprites. But i have to draw the sprite line per line and it's really slow.

- I tried Easytilemaps, i have divided my border sprites into smaller 2x4 Bytes.

       
  • I have no more clipping problem but it's always slow, because CPCTelera has to draw 160 small sprites individualy
- I also tried Easytilemaps with hard scrolling based on the example of CPCTelera.

       
  • But i have to generate tilemap and it takes memory
  • All my circles have to be redraw at each scroll position because they are static
  • And mostly i didn't succed to make the example working with a full screen  :doh:
Well, what is the good solution ?  :D

Thanks,
Arnaud

ronaldo

Hi @Arnaud,

   Most of the time, solutions for specific problems are a combination of features and some creativity :). If you are scrolling only some lines of the screen, like in this example, the easiest way to do it is copying bytes. You have an example that does what you need:
   The idea is to use cpct_memcpy to copy at each byte the next one, effectively moving all data 1 byte left, scrolling 2 pixels. Then, after scrolling the lines, you need to draw the rightmost column of bytes, that corresponds to the 2 new pixels that enter from the right side. This is the easiest way to do what you want to do.

   The example does it a little bit different, because it draws complete characters after every 8 scrolled pixels. However, it is a good starting point to test your own idea.

Hope this helps :).

Powered by SMFPacks Menu Editor Mod