/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id: etchasketch.c,v 1.0 2004/07/14 00:00:00 zeekoe Exp $ * * Copyright (C) 2004 Ronald Teune * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ /* used code from: helloworld.c, snake.c, keyboard.c, and lImbus on IRC, * as examples during the completion of this masterpiece */ #include "plugin.h" static struct plugin_api* rb; static short x,y,running=1; /* declare the variables */ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { TEST_PLUGIN_API(api); (void)parameter; rb = api; x=20; /* without assigning a value it really doesn't work */ y=20; while(running) { /* while running==1 keep going */ switch (rb->button_get(false)) { /* some code to increase and decrease x and y values */ case BUTTON_UP: case BUTTON_UP | BUTTON_REPEAT: x--; break; case BUTTON_RIGHT: case BUTTON_RIGHT | BUTTON_REPEAT: y++; break; case BUTTON_DOWN: case BUTTON_DOWN | BUTTON_REPEAT: x++; break; case BUTTON_LEFT: case BUTTON_LEFT | BUTTON_REPEAT: y--; break; case BUTTON_OFF: running=0; /* quit the loop */ break; } rb->lcd_drawpixel(y,x); /* draw the pixel */ rb->lcd_update_rect(y,x,1,1); /* make rockbox show it */ } return PLUGIN_OK; }