mandel buxfix

This commit is contained in:
iggy 2011-08-05 12:12:36 +02:00
parent 9dae0c8638
commit 2285fae1a1
1 changed files with 49 additions and 49 deletions

View File

@ -26,10 +26,9 @@ void ram(void) {
lcdDisplay();
mandelMove();
mandelUpdate();
// Exit on enter+direction
// Exit on enter+left
key=getInputRaw();
if(key&BTN_ENTER && key>BTN_ENTER)
if(key== BTN_ENTER + BTN_LEFT)
return;
}
return;
@ -51,10 +50,10 @@ void mandelInit() {
mandel.imin = fixpt(-2);
mandel.imax = fixpt(2);
mandel.presscount = 0;
mandel.presslimitzin = 40;
mandel.presslimitzout = 30;
mandel.presslimitzin = 15;
mandel.presslimitzout = 5;
mandel.zoomlevel = 0;
mandel.maxzoomin = 65;
mandel.maxzoomin = 42;
mandel.maxzoomout = -12;
mandel.dirty = true;
@ -72,7 +71,7 @@ void mandelMove() {
long rs =(mandel.rmax-mandel.rmin)/RESY;
long is =(mandel.imax-mandel.imin)/RESX;
char key = getInputRaw();
char key = getInputWaitTimeout(10);
if (key == BTN_LEFT) {
mandel.imax -=is;
@ -95,6 +94,7 @@ void mandelMove() {
mandel.presscount = mandel.presscount + 1;
}
} else if (key == BTN_NONE) {
//delayms_queue(15);
if(mandel.presscount > 0 ) {
mandel.presscount = mandel.presscount - 1;
mandel.clickmark = true;
@ -104,19 +104,19 @@ void mandelMove() {
}
}
if (mandel.presscount > mandel.presslimitzout && mandel.clickmark && key == BTN_ENTER && mandel.zoomlevel >= mandel.maxzoomout) {
mandel.imin = mandel.imin - (mandel.imax-mandel.imin)/10;
mandel.imax = mandel.imax + (mandel.imax-mandel.imin)/10;
mandel.rmin = mandel.rmin -(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax +(mandel.rmax-mandel.rmin)/10;
mandel.imin = mandel.imin - (mandel.imax-mandel.imin)/8;
mandel.imax = mandel.imax + (mandel.imax-mandel.imin)/8;
mandel.rmin = mandel.rmin -(mandel.rmax-mandel.rmin)/8;
mandel.rmax = mandel.rmax +(mandel.rmax-mandel.rmin)/8;
mandel.dirty = true;
delayms(10);
mandel.zoomlevel = mandel.zoomlevel - 1 ;
}
else if (mandel.presscount == mandel.presslimitzin && key == BTN_ENTER && mandel.zoomlevel <= mandel.maxzoomin ) {
mandel.imin = mandel.imin + (mandel.imax-mandel.imin)/10;
mandel.imax = mandel.imax - (mandel.imax-mandel.imin)/10;
mandel.rmin = mandel.rmin +(mandel.rmax-mandel.rmin)/10;
mandel.rmax = mandel.rmax -(mandel.rmax-mandel.rmin)/10;
mandel.imin = mandel.imin + (mandel.imax-mandel.imin)/8;
mandel.imax = mandel.imax - (mandel.imax-mandel.imin)/8;
mandel.rmin = mandel.rmin +(mandel.rmax-mandel.rmin)/8;
mandel.rmax = mandel.rmax -(mandel.rmax-mandel.rmin)/8;
mandel.dirty = true;
delayms(10);
mandel.zoomlevel = mandel.zoomlevel + 1 ;