Esempio n. 1
0
void drawVerticalSegment(int midx, int midy, int width, int height)
{
    if (height <= 0)
        drawFilledBox(midx-width/2, midy-2, midx+width/2, midy+2);
    else {
        drawFilledBox(midx-width/2, (int)(midy-height*1.5), midx+width/2, (int)(midy+height*1.5));
        drawFilledTriangle(midx, midy+height*2, midx-width/2, (int)(midy+height*1.5), 
                           midx+width/2, (int)(midy+height*1.5));        
        drawFilledTriangle(midx, midy-height*2, midx-width/2, (int)(midy-height*1.5), 
                           midx+width/2, (int)(midy-height*1.5));        
    }
}
void DMDFrame::scrollX(int scrollBy) {
    if(abs(scrollBy) >= width) { // scrolling over the whole display!
        // scrolling will erase everything
        drawFilledBox(0, 0, width-1, height-1, GRAPHICS_OFF);
    }
    else if(scrollBy < 0) { // Scroll left
        movePixels(-scrollBy, 0, 0, 0, width + scrollBy, height);
        drawFilledBox(width+scrollBy, 0, width, height, GRAPHICS_OFF);
    }
    else { // Scroll right
        movePixels(0, 0, scrollBy, 0, width - scrollBy, height);
        drawFilledBox(0, 0, scrollBy, height, GRAPHICS_OFF);
    }
}
void DMDFrame::scrollY(int scrollBy) {
    if(abs(scrollBy) >= height) { // scrolling over the whole display
        // scrolling will erase everything
        drawFilledBox(0, 0, width-1, height-1, GRAPHICS_OFF);
    }
    else if(scrollBy < 0) { // Scroll up
        movePixels(0, -scrollBy, 0, 0, width, height + scrollBy);
        drawFilledBox(0, height+scrollBy, width, height, GRAPHICS_OFF);
    }
    else if(scrollBy > 0) { // Scroll down
        movePixels(0, 0, 0, scrollBy, width, height - scrollBy);
        drawFilledBox(0, 0, width, scrollBy, GRAPHICS_OFF);
    }
}
Esempio n. 4
0
void drawHorizontalSegment(int midx, int midy, int width, int height)
{
    if (width <= 0)
        drawFilledBox(midx-2, midy-height/2, midx+2, midy+width/2);
    else
    {
        drawFilledBox((int)(midx-width*1.5), (int)(midy-height/2), 
                      (int)(midx+width*1.5), (int)(midy+height/2));
        drawFilledTriangle((int)(midx-width*2), midy, (int)(midx-width*1.5), 
                           midy-height/2, (int)(midx-width*1.5), midy+height/2);        
        drawFilledTriangle((int)(midx+width*2), midy, (int)(midx+width*1.5), 
                            midy-height/2, (int)(midx+width*1.5), midy+height/2);
    }
}
Esempio n. 5
0
void PongGame::drawNet() {
    int y = 0;
    setColor(WHITE);
    for (int i=0; i<=10; i++) {
        drawFilledBox(netX-netSegWidth/2, (int)(y - netSegHeight * 0.4), 
                      netX + netSegWidth/2, (int)(y + netSegHeight * 0.4));
        y += netSegHeight;
    }
}
Esempio n. 6
0
void viewHeartBeat(void){
    clearLCD();

    // display the signal strenght ICONS
    
    do{
        if(pulse == 0){
            clearLCD();
            
            //p1 = (44, 22)
            //p2 = (44, 42)
            //p3 = (84, 22)
            //p4 = (82, 42)
            
            
            // p1-------------p3
            //  |              |
            //  |   NO FILL    |
            //  |              |
            //  |              |
            // p2-------------p4
            
            //draw the above box
            drawBox(44, 22, 82, 42, 0);
        }else if( pulse == 0){
            clearLCD();
            
            //p1 = (44, 22)
            //p2 = (44, 42)
            //p3 = (84, 22)
            //p4 = (82, 42)
            
            
            // p1-------------p3
            //  |              |
            //  |    FILL      |
            //  |              |
            //  |              |
            // p2-------------p4
            
            // draw the above filled box
            drawFilledBox(44, 22, 82, 42, 0xFF); 
        }
        
        if(LEFT_BUTTON_PRESSED){
            break;
        }
        
        #ifdef ConnectedUSB
        // Echo data from the VDIP back to the host if conected to a PC
        processVdipBuffer();
        #endif
        
        // test buttons
        test_buttons();
        
        sendSensorValues();
        
        #ifdef EnableLogging
        FillUSBBuffers();
        
        if(BuffersFull == 1){
            printUSBBUffer();  
        }   
        #endif
    }while(1);
}
Esempio n. 7
0
void PongPaddle::draw() {
    setColor(WHITE);
    drawFilledBox(xpos-halfWidth, (int)(ypos-halfHeight), xpos+halfWidth, (int)(ypos+halfHeight));
}