Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
draw.h
- Committer:
- dujardin
- Date:
- 2016-05-31
- Revision:
- 4:6a1fff2aa293
- Parent:
- 3:25e9386596c1
- Child:
- 5:10349dda4f42
File content as of revision 4:6a1fff2aa293:
// lieu de vos variables
// NOM commençant par un 'a' comme atiti
int atiti = 5;
int ar ; int ab ; int av ;
// lieu de vos fonctions ..appelées plus bas
void circle(int px , int py , int r )
{
int rx = 0; int ry = 0 ;
for ( rx = r ; ry <= rx ; rx-- )
{
while((rx*rx+ry*ry)<(r*r))
{
pix ( px+rx , py+ry , ar , av , ab );
pix ( px+rx , py-ry , ar , av , ab );
pix ( px-rx , py+ry , ar , av , ab );
pix ( px-rx , py-ry , ar , av , ab );
pix ( px+ry , py+rx , ar , av , ab );
pix ( px-ry , py+rx , ar , av , ab );
pix ( px+ry , py-rx , ar , av , ab );
pix ( px-ry , py-rx , ar , av , ab );
ry++;
}
}
pix ( px , py , ar , av , ab );
}
void draw() // exemple d'une chose a faire ( pas de delai dans cette boucle)
{
pix(15+accx,15+accy,0,0,7); // pixel bleu en x = 5+4 et y = 1
ar = 5 ; av = 0 ; ab = 0;
accx = abs(accx);
circle ( 15 , 15 , accx );
}
// voici les 3 fonctions utilisables
// pix ( x , y , r , v , b ) dessine un pixel de couleur en xy
// x et y position du pixel à dessiner ( 0 à 31 )
// r v b quantité de 0 à 7 du r v b .. 7 c'est lumineux
// ptnum(x, y , nombre ) écrit un nombre a la position x y
// x et y position ou ecrire ( 0 a 31)
// nombre ou variable .. un entier compris entre 0 et 99
// accx accy int de -15 à +15 acceleration xy
// à tester pix(15+accx,15+accy,0,0,5); ( il faut l'extension