#include #include #include #include "gfx/main_gfx.h" float scale = 3.0; int frameskip = 10; gfx_sprite_t* sprite; kb_key_t arrows; int x = 0; int y = 0; int frame = 0; void draw_sprite(){ gfx_FillScreen(0); gfx_ScaledSprite_NoClip(sprite, x, y, scale, scale); gfx_BlitBuffer(); } int main(void){ int max_width = LCD_WIDTH; int max_height = LCD_HEIGHT; if(bm3->height > bm5->height){ max_height -= bm3->height * scale; }else{ max_height -= bm5->height * scale; } if(bm11->width > bm13->width){ max_width -= bm11->width * scale; }else{ max_width -= bm13->width * scale; } gfx_Begin(); gfx_SetPalette(main_palette, sizeof_main_palette, 0); gfx_SetDrawBuffer(); draw_sprite(); do{ sprite = bm1; kb_Scan(); arrows = kb_Data[7]; if(arrows & kb_Down){ if(y < max_height){ y++; if(frame > 2){ sprite = bm3; }else{ sprite = bm5; } } }else if(arrows & kb_Up){ if(y > 0){ y--; if(frame > 2){ sprite = bm15; }else{ sprite = bm17; } } } if(arrows & kb_Right){ if(x < max_width){ x++; if(frame > 2){ sprite = bm11; }else{ sprite = bm13; } } }else if(arrows & kb_Left){ if(x > 0){ x--; if(frame > 2){ sprite = bm7; }else{ sprite = bm9; } } } draw_sprite(); frame++; if(frame > frameskip){ frame = 0; } }while (arrows != sk_Enter); gfx_End(); return 0; }