Author Topic: [CPCTelera] Scrolling a part of screen  (Read 1090 times)

0 Members and 1 Guest are viewing this topic.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
[CPCTelera] Scrolling a part of screen
« on: 22:52, 08 May 16 »
Hello,
i'm coding a scrolling (mode 0) and i have performance issues.

Here what i'm coding :
 [ You are not allowed to view attachments ]

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
« Last Edit: 22:58, 08 May 16 by Arnaud »

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 650
  • Country: es
    • Profesor Retroman
  • Liked: 952
  • Likes Given: 836
Re: [CPCTelera] Scrolling a part of screen
« Reply #1 on: 23:21, 08 May 16 »
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 :).