|
small_counter
int small_counter
(int x, int y, byte count_number, boolean i, int r, int g, int b)
// Счетчик 2х разрядных чисел 4х7 px.
{ // При вызове функции i=0
byte a,c; // r,g,b цвет цифр счетчика
// x, y - начальные координаты счетчика
a = count_number % 10 ; // Единицы счетчика.
c = (count_number /10) % 10 ; // Десятки счетчик
myGLCD.setColor(VGA_BLACK); // Выбираем черный (цвет фона)
myGLCD.fillRect(x,y-1,x+4,y+9); // Закрашиваем место будующей цифры,
// с запасом по 1 px сверху и снизу.
myGLCD.setColor(r,g,b); // Выбираем цвет цифры.
{
if (a == 1)
{
myGLCD.drawVLine (x+3,y+1,6);
myGLCD.drawPixel (x+2, y+2);
myGLCD.drawPixel (x+1, y+3);
}
if (a == 2)
{
myGLCD.drawVLine (x+4,y+2,2);
myGLCD.drawHLine (x+2,y+1,1);
myGLCD.drawHLine (x+2,y+5,1);
myGLCD.drawHLine (x+1,y+7,3);
myGLCD.drawPixel (x+1, y+2);
myGLCD.drawPixel (x+1, y+6);
}
if (a == 3)
{
myGLCD.drawVLine (x+4,y+2,1);
myGLCD.drawVLine (x+4,y+5,1);
myGLCD.drawHLine (x+2,y+1,1);
myGLCD.drawHLine (x+2,y+7,1);
myGLCD.drawPixel (x+1, y+2);
myGLCD.drawPixel (x+3, y+4);
myGLCD.drawPixel (x+1, y+6);
}
if (a == 4)
{
myGLCD.drawVLine (x+3,y+1,6);
myGLCD.drawVLine (x+2,y+2,1);
myGLCD.drawHLine (x+1,y+5,3);
myGLCD.drawPixel (x+1, y+4);
}
if (a == 5)
{
myGLCD.drawVLine (x+4,y+4,2);
myGLCD.drawHLine (x+1,y+1,3);
myGLCD.drawHLine (x+1,y+3,2);
myGLCD.drawHLine (x+2,y+7,1);
myGLCD.drawPixel (x+1, y+6);
myGLCD.drawPixel (x+1, y+2);
}
if (a == 6)
{
myGLCD.drawVLine (x+1,y+2,4);
myGLCD.drawVLine (x+4,y+5,1);
myGLCD.drawHLine (x+2,y+1,1);
myGLCD.drawHLine (x+2,y+4,1);
myGLCD.drawHLine (x+2,y+7,1);
myGLCD.drawPixel (x+4, y+2);
}
if (a == 7)
{
myGLCD.drawVLine (x+4,y+2,1);
myGLCD.drawVLine (x+3,y+3,2);
myGLCD.drawVLine (x+2,y+5,2);
myGLCD.drawHLine (x+1,y+1,3);
}
if (a == 8)
{
myGLCD.drawVLine (x+1,y+2,1);
myGLCD.drawVLine (x+4,y+2,1);
myGLCD.drawVLine (x+1,y+5,1);
myGLCD.drawVLine (x+4,y+5,1);
myGLCD.drawHLine (x+2,y+1,1);
myGLCD.drawHLine (x+2,y+4,1);
myGLCD.drawHLine (x+2,y+7,1);
}
if (a == 9)
{
myGLCD.drawVLine (x+4,y+2,4);
myGLCD.drawVLine (x+1,y+2,1);
myGLCD.drawHLine (x+2,y+1,1);
myGLCD.drawHLine (x+2,y+4,1);
myGLCD.drawHLine (x+2,y+7,1);
myGLCD.drawPixel (x+1, y+6);
}
if (a == 0)
{
myGLCD.drawVLine (x+1,y+2,4);
myGLCD.drawVLine (x+4,y+2,4);
myGLCD.drawHLine (x+2,y+1,1);
myGLCD.drawHLine (x+2,y+7,1);
}
if (i==1){return 0;};
if (c==0){return 0;};
}
small_counter (x-6, y, c+10, 1, r,g,b);
}
|
|