コード例 #1
0
ファイル: base.cpp プロジェクト: alepharchives/Sablotron
Str getMillisecsDiff(double originalTime)
{
    char buf[20];
    // getMillisecs() is in platform.cpp
    sprintf(buf, "%.3f", getMillisecs() - originalTime);
    return Str(buf);
}
コード例 #2
0
ファイル: main.cpp プロジェクト: AndreEnc/Gorillaz_CG
void onTimer(int lastMillisecs)
{
	int currentMillisecs = getMillisecs();
	int deltaMullisecs = currentMillisecs - lastMillisecs;
	float seconds = deltaMullisecs / 1000.0;

	square.angle += square.rotationSpeedPerSeconds * seconds;

	glutTimerFunc(getFpsMilisecs(), onTimer, currentMillisecs);	// set animation callback to execute at fps rate
	glutPostRedisplay();
}
コード例 #3
0
ファイル: tree.cpp プロジェクト: alepharchives/Sablotron
eFlag Tree::parse(Sit S, DataLine *d)
{
    Log1(S, L1_PARSING, getURI());
    double time_was = getMillisecs();
    TreeConstructer tc(S);
    eFlag retval = tc.parseDataLineUsingExpat(S, this, d);
    if (!retval)
    {
        Log1(S, L1_PARSE_DONE, getMillisecsDiff(time_was));
    }
    return retval;
}
コード例 #4
0
ファイル: main.cpp プロジェクト: AndreEnc/Gorillaz_CG
/*  
    Declare initial window size, position, and display mode (single buffer and RGBA). 
    Open window with “Hello GLUT“ in its title bar. 
    Call initialization routines. 
    Register callback function to display graphics. 
    Enter main loop and process events. 
*/
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(250, 250);
    glutInitWindowPosition(400, 100);
    glutCreateWindow("OpenGL Square");

    init();							// initialize application (openGL)
    glutDisplayFunc(onDisplay);		// set display callback function
	glutSpecialFunc(onSpecialKey);	// set key up callback function (for special keys LEFT, ...)
	glutKeyboardFunc(onKeyboardKey);
	
	glutTimerFunc(getFpsMilisecs(), onTimer, getMillisecs());	// set animation callback to execute at fps rate

	// HELP (minimalist)
	printf("================================================================\n");
	printf("HELP\n");
	printf("----------------------------------------------------------------\n");
	printf("  Q: increase frame-rate\n");
	printf("  A: decrease frame-rate\n");
	printf("\n");
	printf("  W: increase rotation speed\n");
	printf("  S: decrease rotation speed\n");
	printf("\n");
	printf("  LEFT:  move square position to the left\n");
	printf("  RIGHT: move square position to the right\n");
	printf("  UP:    move square position to the up\n");
	printf("  DOWN:  move square position to the down\n");
	printf("================================================================\n");


	glutMainLoop();					// application loop

	return 0;
}