Currently, I have a JFrame for my game to render in, and I'm using Graphics2D for drawing (The games graphics are fairly simple 2D sprites). However, my delta variable is a double, and all of the Graphics 2D methods (And Grpahics) use int. I tried to type cast the delta to an int, but it just rounds down to 0. So my question is, how can I render graphics using Graphics2D in Java with coordinates that are doubles. Can I convert it to work with Graphics2D if there is no built in way? Or, is there a graphics library that can support doubles for coordinates?
Graphics class uses integer coordinates for all operations, but Graphics2D provides API with float and double accuracy. You can use Graphics2D.draw(Shape) and Graphics2D.fill(Shape) to get sub-pixel accuracy in rendering. You should also probably enable antialiasing for the Graphics2D object.
Alternatively you can scale, rotate and translate Graphics2D object or manipulate the AffineTransform directly. This might be needed if you want to draw images to double coordinates.