I'm fairly new to programming but I've managed to learn how to set up a basic game loop with left/right/up/down controls. The only problem is that when the camera moves there are graphical glitches (jittering back and forth). I've looked into double buffering but I'm thinking the problem is probably with how the positions are stored, yet I can't figure it out.
Video of jittering
Here is the project https://github.com/Im300/HexTest
Specifically, I think the issue is with the Hexagon class and the way it is stored and transformed by the
g2d.translate(cam.getX(), cam.getY());
function call by the GamePanel class. I've tried to fix it by changing the camera and hexagon class around (storing in double, rounding etc) but the glitches keep happening.
I used this implementation of a hex grid. (Algorithm to generate a hexagonal grid with coordinate system)
Many thanks