java - libgdx optimal Height and Width -



java - libgdx optimal Height and Width -

does matter height , width utilize game? in game have few polygons, connected images have painted, when have width , height 800x480 have paint images small, causes them blurry. also, don't understand how behaves on different sized phone screens.., images have painted streched, or remain small, on big tablets? question optimal width , height have on libgdx game?

this part of code, maybe help understand mean

width = gdx.graphics.getwidth(); height = gdx.graphics.getheight(); photographic camera = new orthographiccamera(); camera.settoortho(false, 800, 480 );

what happen if alter these values? best alter them to?

i reading on tutorial of sorts, didn't talk part.

do have complicated painted images decent on devices?

edit:

this how implement cloud game:

public class anotherscreen implements screen{ polygon cloudpoly; texture cloud; @override public void render(float delta) { batch.setprojectionmatrix(camera.combined); batch.begin(); renderbackground(); batch.draw(cloud,cloudpoly.getx(),cloudpoly.gety()); batch.end(); } @override public void show() { cloud = new texture(gdx.files.internal("assets/textures/cloud.png")); cloudpoly = new polygon(); cloudpoly.setposition(mathutils.random(350,600),mathutils.random(380,440)); // theses vertices little square atm float[] cloudvertices = new float[] { 0,0, 0,20, 20,20, 20,0 }; cloudpoly.setvertices(cloudvertices); }

}

the cloud image has width 256p , height 128p, when set 'camera.settoortho(false, 800, 480 );' won't cloud remain in proportion?

i sorry if unclear, new programmer , english language better, love doh staying me!

does images have painted streched, or remain small, on big tablets?

one of greatest features of libgdx lets things want them. so, choice. snippet

width = gdx.graphics.getwidth(); height = gdx.graphics.getheight(); photographic camera = new orthographiccamera(); camera.settoortho(false, width, height);

you have different viewport size in every different screen size. images remain small.

in other hand, if utilize predefined values viewport like:

width = 800; height = 480; photographic camera = new orthographiccamera(); camera.settoortho(false, width, height);

you same viewport every screen , images stretch occupy same space in each axis. won't same each axis. perfect square image in 1 screen may rectangle in screen different x-y ratio.

there 3rd option, can prepare 1 side , allow other calculated, maintain ratio of images (a square stays square). must decide fixed side. game super mario bros recommend prepare height , calculate width:

height = 480; width = (gdx.graphics.getwidth()/gdx.graphics.getheight())*height; photographic camera = new orthographiccamera(); camera.settoortho(false, width, height);

every screen see same height in game world. screens see more in width others. if thats problem (you want them see same ammount of world maintain ratio too), adding black bars each side option.

so question optimal width , height have on libgdx game?

the optimal solution having different set of images several resolutions. , choosing whats appropiate @ runtime. increases game size lot.

another dirty way having 1 big set , allow images shrink in lower resolutions. looks improve inverse. people think dirty :p (not me, recommend it).

java android libgdx

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -