Quantcast
Channel: Question and Answer » programming
Viewing all articles
Browse latest Browse all 103

Confused about this Timer function C++

$
0
0

I am confused about the argument “m” of this function.

I also need to know how to make this work. I am working on a simple 2d game and I am really new to programming.
I don’t know how to make things work in this Timer() function. I want to animate an object in a specific direction. I know the coordinates of the direction but after a lot of hit and trial, my object moves in a random direction. I have used sin and cos for the movement. But my real problem is about the functionality of this Timer() function. Can anyone here help me about it? Any help will be appreciated.

float dt = 0, lastframe = 0;

void Timer(int m) {
    dt = (m - lastframe) / 1000.0;
    lastframe = m;

    glutPostRedisplay();
    glutTimerFunc(1000.0 / FPS, Timer, m + 1);
}

Viewing all articles
Browse latest Browse all 103

Trending Articles