TestLabelsOnly

From CDOT Wiki
Jump to: navigation, search
void testLabelOnly() {
    bool i       = true;

    // background
    for(int k = 2; k < console.getRows(); k += 2) {
        for(int m = 0; m < console.getCols() - 10; m += 10) {
            console.setPosition(k, m);
            i=!i;
            console << (i ? "OOP344" : "BTP300");
        }
    }
    CFrame frame;
    CFrame outer(5, 10, 50, 15, true, "+-+|+-+|", &frame); // (5,10)
   
    CLabel  label("<This is a label>", 10, 20); // (10,20)
    CLabel  label2("Email address:", 12, 20);   // (12,20)
    CLabel  label3("Phone number:", 14, 20);    // (14,20)
    CLabel  label4("First Name:", 16, 20);
    CLabel  label5("Last Name:", 18, 20);
   
    outer.draw(); //where is the cursor position?
    label.draw(); //where is the cursor position
    label2.draw();
    label3.draw();
    label4.draw();
   
    console.setPosition(0, 0);
    console << "Press any key: exit";
   
    //user input keystrokes
        int key;
        console >> key;
           
    outer.hide();
    label.hide();
    label2.hide();
    label3.hide();
    label4.hide();
    console.clear();
} //testLabelOnly