java - String is fixed to screen when using libgdx -


i've been having trouble libgdx , code , wanted know how can make text stop moving camera. wanted label corridnates of 2d array created when text moves camera.

here's wrote:

    batch.begin();     for(int x = 0; x < world.getwidth(); x+=size){         for(int y = 0; y < world.getheight(); y +=size){             room r = (room)dcreator.getrooms(x/size,y/size);             font.draw(batch, x+", "+y, r.getx(), r.gety());         }     }     batch.end(); 

any or questions appreciated!

you need create new camera, won't move other. common have more cameras in game, 1 rendering game , second 1 gui.

orthographiccamera gamecam = new orthographiccamera(); orthographiccamera guicam = new orthographiccamera(); guicam.settoortho(false, screen_width, screen_height); gamecam.settoortho(false, game_width, game_height); 

and in code:

batch.setprojectionmatrix(gamecam.combined); batch.begin(); //render game stuff batch.end();  batch.setprojectionmatrix(guicam.combined); batch.begin(); //draw gui, text, etc.. batch.end(); 

and remember move gamecam, not guicam.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -