You probably should have an active render loop instead of an overloaded paint() method.
1 2 3 4 5 6
| public void render() { ...put all of your paint code here }
|
then just call it from your game loop
1 2 3 4 5 6 7 8 9
| while (!done) { render() gameLogic() try { sleep(fprs) } } |
If there is no animation then you dont really need a fast precisely timed game loop. To do your desired drag effect, you can do the following:
1 2 3 4 5
| render() { ..... Minimap.draw(x,y); } |
then during your game logic you check if the mouse was clicked in the in the minimap area by cheking if the MouseClicked() values are within the Minimap's x + width, y + length. The as the mouse is dragged you update the Minimap's x y coords according to the mouse's coords (you would ofcourse have to account for the position of the mouse vs the x,y edge of the minimap) Let me know if you wish me to clear anything up.