the update pacman function is my problem. I need a way to make a "timer" that knows how much time has passed since it was last called, so i can make something like pacman->x += elapsedtime*pacman->speed, or something
maybe it was a bit confusing, but I'm hopping you can help me, I'm really stuck
I already tried, but I dont know why, its incredibly slow to react. when i press a key, it takes about 0.5 seconds to move, and when i release, it takes the same time to stop moving.
And, the least i draw from the board (i.e., if i dont draw the balls, for example), the performance lowers. If i draw the balls twice (it's stupid, it was just to try), the performance increases..
I really dont get it
i believe it's because if the ball arent drawn, the idleFunc is called too many times and the timer doesn't have time to update properly and the pacman freezes, or something
I guess I would use SDL/SMFL to manage my keyboard inputs in accordance with the OS I was running on. I don't know how glut implements it. In SDL/SMFL you can mange the 3d objects a little more cleanly and I can control how fast or slow I draw the objects at depth, which I am assuming glut may be chewing time up to do managing all the objects loaded at once. You only need to deal with the objects in a reasonable field of view. This also cuts down on processor time, either in the gpu or the cpu.