faster sc0lling

This commit is contained in:
roy rocket 2011-08-06 03:48:52 +02:00
parent e9927488d1
commit 413e1dbdc2
1 changed files with 11 additions and 14 deletions

View File

@ -25,17 +25,18 @@ void ram(void) {
static int nickoff=10; static int nickoff=10;
static char delay=10; static char delay=10;
static char speedmode=0; static char speedmode=0;
static char movx=1;
static char LCDSHIFTX_EVERY_N=2; static char LCDSHIFTX_EVERY_N=2;
static char LCDSHIFTY_EVERY_N=2; static char LCDSHIFTY_EVERY_N=2;
lcdClear(); lcdClear();
setExtFont(GLOBAL(nickfont)); setExtFont(GLOBAL(nickfont));
nicky=1;
nickwidth=DoString(nickx,nicky,GLOBAL(nickname));
if(nickwidth<50)nickoff=30;
nickheight=getFontHeight(); nickheight=getFontHeight();
nicky=(RESY-getFontHeight())/2; nicky=(RESY-getFontHeight())/2;
nickwidth=DoString(nickx,nicky,GLOBAL(nickname));
if(nickwidth<50)nickoff=30;
char stepmode=0; char stepmode=0;
while (1) { while (1) {
@ -46,7 +47,7 @@ void ram(void) {
// Old shift code. Can't handle longer Nicks... // Old shift code. Can't handle longer Nicks...
// if(iter%LCDSHIFT_EVERY_N==0) lcdShift(1,-2,1); // if(iter%LCDSHIFT_EVERY_N==0) lcdShift(1,-2,1);
// if(iter%LCDSHIFT_EVERY_N==0) { nickx=(nickx+1)%100-nickwidth; nicky=(nicky+1)%50;} // if(iter%LCDSHIFT_EVERY_N==0) { nickx=(nickx+1)%100-nickwidth; nicky=(nicky+1)%50;}
if(iter%LCDSHIFTX_EVERY_N==0) { nickx--; if(iter%LCDSHIFTX_EVERY_N==0) { nickx-=movx;
if(nickx<(-1*nickwidth-nickoff))nickx=0; } if(nickx<(-1*nickwidth-nickoff))nickx=0; }
// if(iter%LCDSHIFTY_EVERY_N==0) { nicky+=movy; // if(iter%LCDSHIFTY_EVERY_N==0) { nicky+=movy;
// if(nicky<1 || nicky>RESY-nickheight) movy*=-1; } // if(nicky<1 || nicky>RESY-nickheight) movy*=-1; }
@ -60,23 +61,19 @@ void ram(void) {
return; return;
case BTN_RIGHT: case BTN_RIGHT:
getInputWaitRelease(); getInputWaitRelease();
speedmode=(speedmode+1)%4; speedmode=(speedmode+1)%6;
delay=15; delay=15;
switch(speedmode) { switch(speedmode) {
case 0: case 0:
LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break; movx=1; LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break;
case 1: case 1:
LCDSHIFTX_EVERY_N=2; LCDSHIFTY_EVERY_N=2; break; movx=1; LCDSHIFTX_EVERY_N=2; LCDSHIFTY_EVERY_N=2; break;
case 2: case 2:
LCDSHIFTX_EVERY_N=3; LCDSHIFTY_EVERY_N=4; break; movx=1; LCDSHIFTX_EVERY_N=3; LCDSHIFTY_EVERY_N=4; break;
case 3:
LCDSHIFTX_EVERY_N=4; LCDSHIFTY_EVERY_N=1; break;
case 4: case 4:
LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break; movx=2; LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break;
case 5: case 5:
LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break; movx=3; LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break;
case 6:
delay=5; LCDSHIFTX_EVERY_N=1; LCDSHIFTY_EVERY_N=1; break;
} }
break; break;
case BTN_DOWN: case BTN_DOWN: