Java 2D World question
- by Munkybunky
I have a 2D world background made up of a Grid of graphics, which I display on screen with a viewport (800x600) and it all works.
My question is I have the following code to
convert the mouse co-ordinates to world co-ordinates
then
World co-ordinates to grid co-ordinates
then
grid co-ordinates to screen co-ordinates.
//Add camerax to mouse screen co-ords to convert to world co-ords.
int cursorx_world=(int)camerax+(int)GameInput.mousex;
int cursorx_grid=(int)cursorx_world/blocksize; // World Co-ords / gridsize give grid co-ords
int cursorx_screen=-(int)camerax+(cursorx_grid*blocksize);
So is there anyway I can convert straight from mouse screen co-ords to screen co-ordinates?