示例#1
0
文件: main.cpp 项目: Distrotech/qt3d
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QSurfaceFormat format;
    format.setSamples(16);

    QWindow root;
    root.resize(640 * 2, 480);

    QQuickView viewL(&root);
    viewL.setFormat(format);
    viewL.setSource(QUrl("qrc:///qml/tst_qrc.qml"));
    viewL.setGeometry(0, 0, 640, 480);

    QQuickView viewR(&root);
    viewR.setFormat(format);
    viewR.setSource(QUrl("Qrc:///qml/tst_qrc.qml"));
    viewR.setGeometry(640, 0, 640, 480);

    root.show();

    return app.exec();
}
示例#2
0
main(){
       int i, j, opt, opt2, opt3, nRuang, nLantai=3;

       for(i=0; i<nLantai; i++){

           addL(i+1);
           if(i==0)
               nRuang=5;
           else if(i==1)
               nRuang=2;
           else
               nRuang=3;
           
           for(j=0; j<nRuang; j++)
               addR(i+1);
       }

       while(true){
           printf("Menu:\n1. tambah ruang\n2. hapus ruang\n3. pinjam ruang\n4. kembalikan ruang\n5. lihat ruang\n6. lihat ruang yang dipinjam\n7. tambah lantai\n8. hapus lantai\n9. exit\noption : ");
           scanf("%d",&opt);

           if(opt==1)
           {
               printf("tambah ke lantai : ");
               scanf("%d",&opt2);

               nRuang++;
               addR(opt2);
               viewL(true);
           }
           else if(opt==2){
               printf("delete ruang terakhir pada lantai : ");
               scanf("%d",&opt2);
               delR(opt2);
               viewL(true);
           }
           else if(opt==3 || opt==4){
               printf("Pilih lantai : ");
               scanf("%d",&opt2);

               printf("Pilih ruang : ");
               scanf("%d",&opt3);

               if(opt==3)
                   status(opt2, opt3, 1);
               else
                   status(opt2, opt3, 0);

               viewL(false);
           }
           else if(opt==5)
               viewL(true);
           else if(opt==6)
               viewL(false);
           else if(opt==7){
               nLantai++;
               addL(nLantai);
               viewL(true);
           }
           else if(opt==8){
               nLantai--;
               delL();
               viewL(true);
           }
           else
               break;

       }
       
       getch();
}