Mandelbrot: make increasing/decreasing iterations on X5/M5 actually usable (the buttoncombo was not possible before) and add necessary _PRE definitions to the defines and the button loop to prevent repeating the event accidentally (on some targets there was no control about how many steps one actually zoomed out on one button 'press'). Update the menu accordingly and fill out the blanks...

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15153 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marianne Arnold 2007-10-16 20:44:17 +00:00
parent d9b1f40655
commit 4bd1aacbc4
2 changed files with 115 additions and 85 deletions

View file

@ -95,30 +95,34 @@ PLUGIN_HEADER
#define MANDELBROT_RESET (BUTTON_SELECT | BUTTON_PLAY)
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define MANDELBROT_QUIT BUTTON_POWER
#define MANDELBROT_UP BUTTON_UP
#define MANDELBROT_DOWN BUTTON_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC (BUTTON_PLAY | BUTTON_RIGHT)
#define MANDELBROT_MAXITER_DEC (BUTTON_PLAY | BUTTON_LEFT)
#define MANDELBROT_RESET BUTTON_REC
#define MANDELBROT_QUIT BUTTON_POWER
#define MANDELBROT_UP BUTTON_UP
#define MANDELBROT_DOWN BUTTON_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC_PRE BUTTON_PLAY
#define MANDELBROT_MAXITER_INC (BUTTON_PLAY | BUTTON_REL)
#define MANDELBROT_MAXITER_DEC_PRE BUTTON_PLAY
#define MANDELBROT_MAXITER_DEC (BUTTON_PLAY | BUTTON_REPEAT)
#define MANDELBROT_RESET BUTTON_REC
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define MANDELBROT_QUIT BUTTON_POWER
#define MANDELBROT_UP BUTTON_UP
#define MANDELBROT_DOWN BUTTON_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC BUTTON_VOL_UP
#define MANDELBROT_MAXITER_DEC BUTTON_VOL_DOWN
#define MANDELBROT_RESET BUTTON_A
#define MANDELBROT_QUIT BUTTON_POWER
#define MANDELBROT_UP BUTTON_UP
#define MANDELBROT_DOWN BUTTON_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC BUTTON_VOL_UP
#define MANDELBROT_MAXITER_DEC BUTTON_VOL_DOWN
#define MANDELBROT_RESET BUTTON_A
#elif CONFIG_KEYPAD == SANSA_E200_PAD
#define MANDELBROT_QUIT BUTTON_POWER
@ -145,30 +149,32 @@ PLUGIN_HEADER
#define MANDELBROT_RESET BUTTON_REC
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
#define MANDELBROT_QUIT BUTTON_POWER
#define MANDELBROT_UP BUTTON_SCROLL_UP
#define MANDELBROT_DOWN BUTTON_SCROLL_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_PLAY
#define MANDELBROT_ZOOM_IN (BUTTON_PLAY | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT (BUTTON_PLAY | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC BUTTON_FF
#define MANDELBROT_MAXITER_DEC BUTTON_REW
#define MANDELBROT_RESET (BUTTON_PLAY | BUTTON_REW)
#define MANDELBROT_QUIT BUTTON_POWER
#define MANDELBROT_UP BUTTON_SCROLL_UP
#define MANDELBROT_DOWN BUTTON_SCROLL_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_PLAY
#define MANDELBROT_ZOOM_IN (BUTTON_PLAY | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT_PRE BUTTON_PLAY
#define MANDELBROT_ZOOM_OUT (BUTTON_PLAY | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC BUTTON_FF
#define MANDELBROT_MAXITER_DEC BUTTON_REW
#define MANDELBROT_RESET (BUTTON_PLAY | BUTTON_REW)
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
#define MANDELBROT_QUIT BUTTON_EQ
#define MANDELBROT_UP BUTTON_UP
#define MANDELBROT_DOWN BUTTON_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC (BUTTON_PLAY | BUTTON_RIGHT)
#define MANDELBROT_MAXITER_DEC (BUTTON_PLAY | BUTTON_LEFT)
#define MANDELBROT_RESET BUTTON_MODE
#define MANDELBROT_QUIT BUTTON_EQ
#define MANDELBROT_UP BUTTON_UP
#define MANDELBROT_DOWN BUTTON_DOWN
#define MANDELBROT_LEFT BUTTON_LEFT
#define MANDELBROT_RIGHT BUTTON_RIGHT
#define MANDELBROT_ZOOM_IN_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
#define MANDELBROT_ZOOM_OUT_PRE BUTTON_SELECT
#define MANDELBROT_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
#define MANDELBROT_MAXITER_INC (BUTTON_PLAY | BUTTON_RIGHT)
#define MANDELBROT_MAXITER_DEC (BUTTON_PLAY | BUTTON_LEFT)
#define MANDELBROT_RESET BUTTON_MODE
#endif
@ -628,6 +634,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
return PLUGIN_OK;
case MANDELBROT_ZOOM_OUT:
#ifdef MANDELBROT_ZOOM_OUT_PRE
if (lastbutton != MANDELBROT_ZOOM_OUT_PRE)
break;
#endif
x_min -= x_delta;
x_max += x_delta;
y_min -= y_delta;
@ -690,6 +700,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
break;
case MANDELBROT_MAXITER_DEC:
#ifdef MANDELBROT_MAXITER_DEC_PRE
if (lastbutton != MANDELBROT_MAXITER_DEC_PRE)
break;
#endif
if (max_iter >= 15) {
max_iter -= max_iter / 3;
redraw = REDRAW_FULL;
@ -697,6 +711,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
break;
case MANDELBROT_MAXITER_INC:
#ifdef MANDELBROT_MAXITER_INC_PRE
if (lastbutton != MANDELBROT_MAXITER_INC_PRE)
break;
#endif
max_iter += max_iter / 2;
redraw = REDRAW_FULL;
break;

View file

@ -3,45 +3,57 @@
This demonstration draws fractal images from the Mandelbrot set
\opt{archos,h1xx}{using the greyscale engine}.
\begin{table}
\begin{btnmap}{}{}
Direction keys & Move about the image\\
\opt{RECORDER_PAD,IRIVER_H10_PAD}{\ButtonPlay}
\opt{ONDIO_PAD}{\ButtonMenu\ / \ButtonMenu+\ButtonUp}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD}{\ButtonSelect}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollFwd}
\opt{SANSA_E200_PAD}{\ButtonScrollDown}
& Zoom in\\
\opt{RECORDER_PAD}{\ButtonOn}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonDown}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonMode}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollBack}
\opt{IAUDIO_X5_PAD}{Long \ButtonSelect}
\opt{IRIVER_H10_PAD}{Long \ButtonPlay}
\opt{SANSA_E200_PAD}{\ButtonScrollUp}
& Zoom out\\
\opt{RECORDER_PAD}{\ButtonFOne}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonLeft}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOn+\ButtonLeft}
\opt{IPOD_4G_PAD,IPOD_3G_PAD,SANSA_E200_PAD}{\ButtonSelect+\ButtonLeft}
\opt{IAUDIO_X5_PAD}{\ButtonPlay+\ButtonLeft}
\opt{IRIVER_H10_PAD}{\ButtonRew}
& Decrease iteration depth (less detail)\\
\opt{RECORDER_PAD}{\ButtonFTwo}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonRight}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOn+\ButtonRight}
\opt{IPOD_4G_PAD,IPOD_3G_PAD,SANSA_E200_PAD}{\ButtonSelect+\ButtonRight}
\opt{IAUDIO_X5_PAD}{\ButtonPlay+\ButtonRight}
\opt{IRIVER_H10_PAD}{\ButtonFF}
& Increase iteration depth (more detail)\\
\opt{RECORDER_PAD}{\ButtonFThree}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonOff}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,SANSA_E200_PAD}{\ButtonRec}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonPlay}
\opt{IRIVER_H10_PAD}{\ButtonPlay + \ButtonRew}
& Reset and return to the default image\\
\opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOff}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonMenu}
\opt{IAUDIO_X5_PAD,IRIVER_H10_PAD,SANSA_E200_PAD}{\ButtonPower}
& Quit\\
\end{btnmap}
\begin{btnmap}{}{}
Direction keys
& Move about the image\\
%
\opt{RECORDER_PAD,IRIVER_H10_PAD}{\ButtonPlay}
\opt{ONDIO_PAD}{\ButtonMenu\ / \ButtonMenu+\ButtonUp}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,GIGABEAT_PAD}{\ButtonSelect}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollFwd}
\opt{SANSA_E200_PAD}{\ButtonScrollDown}
\opt{SANSA_C200_PAD}{\ButtonVolUp}
& Zoom in\\
%
\opt{RECORDER_PAD}{\ButtonOn}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonDown}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonMode}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollBack}
\opt{IAUDIO_X5_PAD,GIGABEAT_PAD}{Long \ButtonSelect}
\opt{IRIVER_H10_PAD}{Long \ButtonPlay}
\opt{SANSA_E200_PAD}{\ButtonScrollUp}
\opt{SANSA_C200_PAD}{\ButtonVolDown}
& Zoom out\\
%
\opt{RECORDER_PAD}{\ButtonFOne}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonLeft}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOn+\ButtonLeft}
\opt{IPOD_4G_PAD,IPOD_3G_PAD,SANSA_E200_PAD,SANSA_C200_PAD}{\ButtonSelect+\ButtonLeft}
\opt{IAUDIO_X5_PAD}{Long \ButtonPlay}
\opt{IRIVER_H10_PAD}{\ButtonRew}
\opt{GIGABEAT_PAD}{\ButtonVolDown}
& Decrease iteration depth (less detail)\\
%
\opt{RECORDER_PAD}{\ButtonFTwo}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonRight}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOn+\ButtonRight}
\opt{IPOD_4G_PAD,IPOD_3G_PAD,SANSA_E200_PAD,SANSA_C200_PAD}{\ButtonSelect+\ButtonRight}
\opt{IAUDIO_X5_PAD}{\ButtonPlay}
\opt{IRIVER_H10_PAD}{\ButtonFF}
\opt{GIGABEAT_PAD}{\ButtonVolUp}
& Increase iteration depth (more detail)\\
%
\opt{RECORDER_PAD}{\ButtonFThree}
\opt{ONDIO_PAD}{\ButtonMenu+\ButtonOff}
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,SANSA_E200_PAD,SANSA_C200_PAD}{\ButtonRec}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonPlay}
\opt{IRIVER_H10_PAD}{\ButtonPlay + \ButtonRew}
\opt{GIGABEAT_PAD}{\ButtonA}
& Reset and return to the default image\\
%
\opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOff}
\opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonSelect+\ButtonMenu}
\opt{IAUDIO_X5_PAD,IRIVER_H10_PAD,SANSA_E200_PAD,SANSA_C200_PAD,GIGABEAT_PAD}{\ButtonPower}
& Quit\\
\end{btnmap}
\end{table}