Example #1
0
void keypress(unsigned char key, int x, int y){

    // Test if user pressed ESCAPE (ascii 27)
    // If so, exit the program
    if(key==27){
        exitScene();
    }

    // 'W' key toggles wireframe mode on & off
    /*if(key == 'w' || key == 'W'){
        wireframe=!wireframe;
        if(wireframe){
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        }
        else glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    }*/

    // Other possible keypresses go here
    if(key == 'a'){   field.addBlackHoleMagnitude( -0.1 ) ;    }
    if(key == 'd'){   field.addBlackHoleMagnitude(  0.1 ) ;    }

    if(key == 's'){   field.addBlackHoleCentreY (-0.1 ) ;    }
    if(key == 'w'){   field.addBlackHoleCentreY ( 0.1 ) ;    }

}