I am developing a game for android using LibGDX and i am using Fill viewport to handle different aspect ratios.
I would like to know how to get the cropped areas in pixels, since fill viewport crops part of the game.
I checked the libgdx API docs and only found the get gutter methods which work only for fit viewport.
Related
My team is developing an application that requires a few SVGs to be true scale regardless of screen size. We are now manually scaling the SVGs to true scale while we figure out a logic to maintain the scale automatically. When doing the changes manually, I found that only the Canvas of the SVG changes when the Height and Width of the SVG in the database are changed. When I increase the dimensions, the canvas expands, and the SVG just repositions itself to fit within the canvas; when I reduce the dimensions, the SVGs shrink to fit within the canvas. How do I resize the SVGs as well along with canvas?
I have an image similar to this one
And I'd like to insert a video in it and keep its ratio when reducing the size of my screen.
Only the width needs to be responsive as it'll be shown in portrait on mobile.
I have no idea how to do that using CSS. I tried using an absolute position and some percentages, but when resizing, the ratios are not really respected and the video becomes smaller
If you can use the open source HTML5 video player, videoJS, it support a 'Fluid' mode which will allow you set a chosen aspect ratio to be maintained when the video resizes.
They provide details including configuration here: https://docs.videojs.com/tutorial-layout.html
An example configuration:
var player = videojs('vid2');
//Set fluid mode
player.fluid(true);
//Set aspect ratio - 1:1 is square in this example
player.aspectRatio('1:1');
//Set UI to be responsive
player.responsive(true);
From what I have read, the resize method in LibGDX is meant to resize the viewport and center the camera if the window is resized. Since a mobile application cannot be resized, is it worth including it?
It is not, I have never used the resize method in mobile games.
To be honest I don't even use it on desktop games and they work just as intended when the window is resized.
Yes required even in mobile application too.
If your app is for both landscape and portrait mode then you need do your stuff like changing layout of your UI in resize() method.
resize() method of ApplicationListener is called after create(). Your viewport need to be scaled according to your device screen width/height and also what's the choice of your viewport.
I am new to libgdx and i was wondering if someone could help me with sprite size.
my screen is set to be 1280 x 720. for my desktop it looks great and the right size that i need it to be. but when i test it on my android, the sprite is way to small. How do you make screen size consistent?
to animate my sprite, i followed this. https://code.google.com/p/libgdx/wiki/SpriteAnimation
If anyone could help, that would be awesome. thanks in advance
If your app is not going to have zoom feature (which is mostly the case), you should not decide sprite sizes in terms of pixels.
Since you are going to tackle so many screen sizes and resolutions, I'd suggest a way to handle sizing of sprites in a screen size and pixel density independent way.
Assume some resolution (probably largest that you'd like to provide support for) with a suitable aspect ratio.
Size and place your sprites properly in that stage as you like.
While drawing, scale it to the actual screen resolution. (Keep in mind what to do if the aspect ratio is less or more than you had intended).
This way, you are essentially setting sizes of sprites in terms of fraction of screen size which is really convenient to understand and your sprites will look same relative sizes on all resolutions.
Hope this helps.
I'm working on the design for a windows 8 app, with a team of developers.We have finalized most of the screens for the app, the developer informed me to do the mockup of the entire app in photoshop to be presented to him and the screen size should be 480 x 800. ( right now sitting at 480 x 1800 due to scroll in page)
I have been informed to optimize the mockup for the other 2 remaining screen sizes 768 x 1280 and 720 x 1280 is this required? wouldnt this be covered in development stage.
From my present html5 and css knowledge building small static websites, width 100% in a container with width wouldnt fix this?
As the design is following the guidelines with grids i made from the guidlines pdf i had set it up for 480 x 800 now with two new screen size how can i go about this?
Can i change the canvas size in photoshop and resize all the elements?.
Please let me know if there is anyway possible to get hands on - SplashScreenImage.Screen-WXGA.jpg , SplashScreenImage.Screen-720p.jpg so i can overlay the jpg in photoshop and create grid i have windows 7 not able to install SDK to get these 2 images.
Mockups for other resolutions would be (almost) the same. There is automatic scaling. The only difference is that 720p resolution screens represent scaled 480x853 resolution, which is almost never any problem (if you have scrollable pages, like you described, the developer has to only make sure that the scrollable component is the one to be expandable in height).
See more here.
The only problems are images. The advice (of the above source) is to use the highest scale, that is for images of size 100x100 on 480x800 screen, use files of 160x160 size.