123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #include <tice.h>
- #include <graphx.h>
- #include <keypadc.h>
- #include "gfx/main_gfx.h"
- gfx_sprite_t* sprite;
- float scale = 3;
- int max_width = LCD_WIDTH;
- int max_height = LCD_HEIGHT;
- 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){
- 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 > 5){
- frame = 0;
- }
- }while (arrows != sk_Enter);
- gfx_End();
- return 0;
- }
|