it just is so ugly to add game coordinate checks to JOGL screen rendering loops and if the computer is slow the game runs slow , i should get better game run with timer based coordinate changes !!
No you won't. You'll just shift the problem. You have to use polling:
- Create 4 boolean fields in your class: left,up,right,down
- Implement a KeyListener with keyPressed() and keyReleased()
- set the corresponding boolean flag to true
, if a cursor key is pressed
- set the corresponding boolean flag to false
, if a cursor key is released
- in your _render() method set the apropriate scrollspeed for x/y based on the direction flags
- multiply the result with the System.nanoTime()-difference between two _render()-calls
This way you should get a stable scrollspeed regardless of CPU-Speed and rendering load.
( nice English, heh )
but I am german, so it doesn't matter, since we are the only country to have an own locale for our english: de_EN
(i've really seen that as locale setting for english pages in one of our customers CMS!!!)