When I run the application on desktop every texture is in right position right size, but when i run it on Andorid device
some of the textures wont show because they are out of bounds.
How can i fix the resolution that it would be the same on both devices
I want to add another question in top of that question if i may!
I have the same question than Zeta, plus, when i run on android or in another computer with another resolution, does that question of ZETA still applies?
i mean, Zeta, you use this as well :
public static void main(String[] args) {
// create the listener that will receive the application events
ApplicationListener listener = new MainView();
// define the window's title
String title = "Alpha Version";
// define the window's size
width = 800;
height = 600;
// whether to use OpenGL ES 2.0
boolean useOpenGLES2 = true;
// create the game
System.setProperty("user.name", "EnglishWords");
new LwjglApplication(listener, title, width, height, useOpenGLES2);
}
/**
* Returns the best Size to the Screen!
*/
public void getAvaiableScreenSize() {
}
Right?
So we will need to worry with textures too? Or we can just adjust the camera? I think we just need to adjust the camera Zeta! I think dermetfan already helped me to mess with @resize() method…
[quote]Right?
So we will need to worry with textures too? Or we can just adjust the camera? I think we just need to adjust the camera Zeta! I think dermetfan already helped me to mess with @resize() method…
[/quote]
I’ve tried to do everything with camera just cant get it to work. I hope someone has solution for this. Or is it just better to do Android and desktop versions separately?
To sum it up, by default, the viewport is a rectangle -1 to +1 on both x and y. When You render Your texture at (-0.5,-0.5) with a size of 0.5, then it will be in the middle of the screen regardless of the screen. However, depending on the screen size, it might be stretched or the opposite.
I think the second argument here should be getHeight() not getWidth(). Also You don’t need to set the bounds on every frame. It should be enough to set them in the create() method;
How can i use pixel density in libgdx that it will resize/ scale the textures in any phone.
all i could find was getPixelDensity();. Can i use this somehow or have i undestanded pixel density completely wrong?
Thank you. (didnt want to make o new topic since its relevant to this one).