How to you assign a png to a variable and then draw it on a specific x and y? Please no OpenGL bindings and such.
Asked
Active
Viewed 246 times
1
-
This link answers most of your question. Drawing on it should be done, I assume, by overriding the paintComponent method as in a panel, but I'm not positive: http://stackoverflow.com/questions/299495/java-swing-how-to-add-an-image-to-a-jpanel – Kon Jul 14 '13 at 07:03
-
Will this work with Slick2D though? – Davidobot Jul 14 '13 at 07:09
1 Answers
1
You can save the image in a org.newdawn.slick.Image
with
Image img = new Image("/path/to/img");
Then draw it in the render
function with
img.draw(x, y);

pascalhein
- 5,700
- 4
- 31
- 44