5Fermer7
philip-lynxLe 02/12/2010 à 20:53
je sais maintenant comment faire un flip ou heu, retourner une image, ça me servira bien pour économiser de précieux octets.
Bouton A et B pour rotation, option1 reset et option2 pour bruitage voix
Il y aussi un bruitage .wav (voix féminine qui dit ola!), via émulateur "ça crache", je serais curieux d'entendre le résultat via la console... rygar, je compte sur toi. calin
tromb Fichier joint : elvirot.lnx

code source: /* Elvira 0.2 - LYNX - kit BLL (newcc65) Travail graphique : zoom et flip 02/12/2010 LYNX-image */ #include <stdlib.h> #include <lynx.h> #include <lynxlib.h> #include "ola.h" /* LYNX-specific #defines: */ #define JOY_RIGHT 0x10 #define JOY_LEFT 0x20 #define JOY_DOWN 0x40 #define JOY_UP 0x80 #define BUTTON_OPTION1 0x08 #define BUTTON_OPTION2 0x04 #define BUTTON_LEFT 0x02 #define BUTTON_RIGHT 0x01 #define BUTTON_PAUSE 0x01 #define BUFFER1 0x9000 char SCREEN[8160] at (MEMTOP-16320); char RENDER[8160] at (MEMTOP-8160); char pal[]={ 0x00,0x02,0x05,0x09,0x0C,0x0E,0x04,0x07,0x01,0x00,0x03,0x04,0x06,0x08,0x0A,0x0C, 0x00,0x22,0x66,0xAA,0xDD,0xEF,0x53,0x87,0x19,0x08,0x35,0x48,0x5B,0x7D,0x9F,0xBF}; // ------------------------------------ /***************************************************************************** ** Ci-dessous, le contenu du fichier batchfile pour l'image elvballp.bmp ** ** set image01=elvballp.bmp SPRPCK -t6 -S320204 -a188101 -p0 %image01% cmd ** Le point d'action de l'image elvballp est mis au centre de la ** ** bille (-a188101) ** *****************************************************************************/ extern uchar elvballp[]; // image elvballp char SCB[]; #asm _SCB dc.b $c0,$10,$20 dc.w 0,0 dc.w 0,0,$100,$100 dc.b $01,$23,$45,$67,$89,$ab,$cd,$ef #endasm // ------------------------------------ int posx,posy,scaelv,etape; int i,ihrotation,ivrotation,relachleft,relachright; char choix,tempa,tempb,tempc,tempd; // assembler vertical retrace syncronisation routine void Vsync() { #asm vretrace: lda $fd0a bne vretrace #endasm } /************************************************************************** ** ** ** ** **************************************************************************/ char main() { InitIRQ(); CLI; SetBuffers(SCREEN, RENDER ,0); /* set the palette */ SetRGB(pal); // Ceci sert à changer la palette de la Lynx. //DrawFBox(0,0,160,102,0); posx=160/2; posy=102/2; SCBX(SCB) = 160/2; SCBY(SCB) = 102/2; SCBDATA(SCB) = elvballp; scaelv=1024; // echelle de l'image elvballp (taille originelle = 256) // bruitage SetBuffers(BUFFER1,0,0); SmpInit(0,1); EnableIRQ(1); /************************************************************************** ** BOUCLE PRINCIPALE ** **************************************************************************/ for( ; ; ) { //DrawFBox(0,0,160,102,0); // affichage d'une boite couleur 0 (noire) if (joystick & BUTTON_OPTION1) // reset { scaelv=1024; posx=160/2;posy=102/2; etape=0; } if (joystick & JOY_RIGHT) { posx++; // direction Droite if (posx>158) posx=158; } if (joystick & JOY_LEFT) { posx--; // direction Gauche if (posx<2) posx=2; } if (joystick & JOY_UP) { posy--; // direction Haut if (posy<-2) posy=-2; } if (joystick & JOY_DOWN) { posy++; // direction Bas if (posy>100) posy=100; } if (etape==0) { if (scaelv>64) { scaelv=scaelv-2; if (scaelv<65) {scaelv=64;etape=1;} } } if (etape==1) { if (scaelv<256) { scaelv=scaelv+2; if (scaelv>255) {scaelv=256;etape=0;} } } if (relachleft==1) { if (!(joystick & BUTTON_LEFT)) {relachleft=0;} } if (relachleft==0) { if (joystick & BUTTON_LEFT) { ++ihrotation;relachleft=1; if (ihrotation==3) ihrotation=1; if (ihrotation==1) { SCB[0] = 0xd0; // Determine quadrant --> horizontal à l'envers } if (ihrotation==2) { SCB[0] = 0xc0; // Determine quadrant --> horizontal à l'endroit } } } if (relachright==1) { if (!(joystick & BUTTON_RIGHT)) {relachright=0;} } if (relachright==0) { if (joystick & BUTTON_RIGHT) { ++ivrotation;relachright=1; if (ivrotation==3) ivrotation=1; if (ivrotation==1) { SCB[0] = 0xe0; // Determine quadrant --> vertical à l'envers } if (ivrotation==2) { SCB[0] = 0xf0; // Determine quadrant --> vertical à l'endroit } } } SCBX(SCB) = posx;SCBY(SCB) = posy; SCBHS(SCB) = scaelv;SCBVS(SCB) = scaelv; // taille image originelle = 256 DrawSprite(SCB); Vsync(); if (tempa>0) --tempa; if (tempa==0) { if(joystick & BUTTON_OPTION2) { tempa=100; SmpStart(ola, 0); } } SwapBuffers(); } /************************************************************************** ** FIN de la BOUCLE PRINCIPALE ** **************************************************************************/ }

ps: Je fais mumuse avec SoundEditor, puis je convertis en wav avec Audacity :
http://audacity.sourceforge.net/