Hi,
how can i control the game loop ? tried to some sleep(), but caused flickering.
any tips?
Regards
Control the game loop
Control the game loop
..::Game Developer::..
-
- Site Admin
- Posts: 1986
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Control the game loop
What is it you mean by "control the game loop"?
Try to describe your problem in as much detail as you can. You mentioned sleep. Are you trying to make objects move slower?
Try to describe your problem in as much detail as you can. You mentioned sleep. Are you trying to make objects move slower?
Re: Control the game loop
The actions inside fe game loop is being executed very fast. game loop like this https://github.com/devkitPro/gamecube-e ... late.c#L19WinterMute wrote: ↑Sat Jun 26, 2021 12:30 am What is it you mean by "control the game loop"?
Try to describe your problem in as much detail as you can. You mentioned sleep. Are you trying to make objects move slower?
Yes, i want to move the objects slower.
Regards
..::Game Developer::..
-
- Site Admin
- Posts: 1986
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Control the game loop
Rather than trying to adjust the speed of the game loop you should adjust the speed of your objects. Normally a game loop will run at a constant speed (normally the screen refresh rate) .
The gxSprites example uses fixed point numbers to represent postions & velocities. See https://github.com/devkitPro/wii-exampl ... /gxSprites. The co-ordinates and velocities there use 24 bits for integer part & 8 bits for fractional parts - that means the numbers are multiplied by 256 when being set and the co-ordinates are divided by 256 when used as screen co-ordinates. The wikipedia article is OK if you want to know more about that https://en.wikipedia.org/wiki/Fixed-point_arithmetic
You could just use floats for this though if you're more comfortable.
The gxSprites example uses fixed point numbers to represent postions & velocities. See https://github.com/devkitPro/wii-exampl ... /gxSprites. The co-ordinates and velocities there use 24 bits for integer part & 8 bits for fractional parts - that means the numbers are multiplied by 256 when being set and the co-ordinates are divided by 256 when used as screen co-ordinates. The wikipedia article is OK if you want to know more about that https://en.wikipedia.org/wiki/Fixed-point_arithmetic
You could just use floats for this though if you're more comfortable.
Who is online
Users browsing this forum: No registered users and 1 guest