Example #1
0
File: main.cpp Project: geha/GriS
int main (int argc, char** argv) {

    // Initialize Inventor and Win
    HWND myWindow = SoWin::init(argv[0]);
    if (myWindow == NULL) exit(1);

    // Knoten zum Selektieren der angehÃĪngten Objekte
    rootSelection = new SoSelection;
    rootSelection->ref();
    rootSelection->addSelectionCallback(selectionCallback, NULL);
    rootSelection->addDeselectionCallback(deselectionCallback, NULL);

    SoSeparator *root = new SoSeparator;
    rootSelection->addChild(root);

    // This function contains our code fragment.
    root->addChild(make_brett());

    SoWrapperKit *myWrapperKit = new SoWrapperKit;

    // Figur mit Wrapper verbinden
    root->addChild(myWrapperKit);
    myWrapperKit->setPart("contents", (make_brett()));
    myWrapperKit->set((char *)"transform { translation 0 0 0 }");

    // create the manipulators
    SoHandleBoxManip *myHandleBox = new SoHandleBoxManip;
    myHandleBox->ref();
    SoTranslate2Dragger *myTranslater = new SoTranslate2Dragger;

    // Get the draggers and add callbacks to them. Note
    // that you don't put callbacks on manipulators. You put
    // them on the draggers which handle events for them. 
    SoDragger *myDragger;
    myDragger = myHandleBox->getDragger();
    myDragger->addStartCallback(dragStartCallback);
    myDragger->addFinishCallback(dragFinishCallback);

    SoWinExaminerViewer *myViewer = new SoWinExaminerViewer(myWindow);
    myViewer->setSceneGraph(rootSelection);
    myViewer->setGLRenderAction(new SoBoxHighlightRenderAction);
    myViewer->setTitle("Schachbrett");
    myViewer->show();
    myViewer->viewAll();

    SoWin::show(myWindow);
    SoWin::mainLoop();

    return 0;
}