1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-04 03:30:40 +00:00

Added working lazynes scroll.c

This commit is contained in:
jespergravgaard 2020-07-08 09:01:28 +02:00
parent 64db016dc2
commit 858c5de57a

View File

@ -10,22 +10,17 @@
#include "lazynes.h" #include "lazynes.h"
int lnMain() { int lnMain() {
static const ubyte bgColors[]={45,33,2}; static const ubyte bgColors[]={45,33,2};
static const ubyte bubblesPal[]={ 0, 37,22,5, 0, 42,26,10, 0, 33,18,3 };
ubyte i; ubyte i;
uword hScroll=0; uword hScroll=0;
sbyte hVel=0, hDir=1; sbyte hVel=0, hDir=1;
lnSync(lfBlank); // blank screen to enable lnPush() usage lnSync(lfBlank); // blank screen to enable lnPush() usage
lnPush(lnBackCol,3,bgColors); // set background colors lnPush(lnBackCol,3,bgColors); // set background colors
// draw some backgrounds // draw some backgrounds
{ // { //
static const ubyte g1[]={1}, g2[]={2,3,4,5}, g3[]={6,7,8,9}; static const ubyte g1[]={1}, g2[]={2,3,4,5}, g3[]={6,7,8,9};
ubyte x; ubyte x;
// draw a line: Sprite #0 will be placed ontop later to trigger the split // draw a line
i=2; for (x=0;x<32;x+=1) lnPush(lnNameTab0+((uword)i<<5)+x,1,g1); i=2; for (x=0;x<32;x+=1) lnPush(lnNameTab0+((uword)i<<5)+x,1,g1);
// draw some diamond shapes // draw some diamond shapes
for (i=8;i<=24;i+=4) for (x=0;x<4;x+=1) { for (i=8;i<=24;i+=4) for (x=0;x<4;x+=1) {
@ -33,14 +28,11 @@ int lnMain() {
lnPush(lnNameTab0+32+((uword)i<<5)+12+x*4,4,g3); lnPush(lnNameTab0+32+((uword)i<<5)+12+x*4,4,g3);
} }
} }
lnSync(0);
for(;;) { for(;;) {
lnScroll(hScroll>>6,0); // set scrolling offsets of area below split lnScroll(hScroll>>6,0); // set scrolling offsets
hVel+=hDir; if (hVel>64 || hVel<-64) hDir=-hDir; hVel+=hDir; if (hVel>64 || hVel<-64) hDir=-hDir;
hScroll+=hVel; hScroll+=hVel;
lnSync(0); lnSync(0);
} }
return 0; return 0;
} }