![]() |
ScrollLeft function scrolling more than 1 pixels left - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: ScrollLeft function scrolling more than 1 pixels left (/showthread.php?tid=2545) |
ScrollLeft function scrolling more than 1 pixels left - rbiondi - 03-01-2024 Hello, I'm trying to use the ScrollLeft function to create a scrolling chart and the ScrollLeft function seems to be scrolling more than 1 pixel left. The screening area on the left also seems to be not to be pixel acurate. Sample program: Code: #include <scroll.bas> Thank you very much! RE: SrollLeft function scrolling more than 1 pixels left - boriel - 03-03-2024 Yes, thatś right. For horizontal scroll, it's very difficult to do a pixel precise frame scroll. It does it in 8 pixels wide blocks. Doing it pixel perfect, due to ZX Spectrum architecture, would be really slow. I still can provide you a scroll routine that does exactly that, but be aware that it will be REALLY slow. For vertical scroll this does not happen and it's pixel perfect. A simple solution is to place your rectangle in an aligned zone. You can draw the box frame out of the inner part that will be scrolled: Code: square(7, 15, 80, 60, 6) One more thing: Float is REALLY slow and expensive. Consider using Fixed instead of Float and only if necessary. Most of the time you will need just Uinteger or Ubyte values. RE: ScrollLeft function scrolling more than 1 pixels left - rbiondi - 03-07-2024 Thank you very much for your reply and clarification about the Fixed type. I'll fix that to save as much resources as possible. Since my program is a simulation and not an action/arcade game, I bet would not have a great problem doing the fine horizontal scroll because the chart will not be refreshed intensively (it will receive an update each 3/4 seconds). If you could provide that function, I would really appreciate it ![]() Thank you very much Rogerio |