I have created an app that uses FitViewport. So it will keep the aspect ratio on any phone.
But how do I solve that for my fonts? My buttons etc are all scaled to look the same bu the fonts are not.
So I need some solutions with different font sizes for different screen resolutions.
What is the way to handle that in libgdx?
For dynamic font sizes, either you can use multiple BitmapFont files for each resolution or use Gdx-freetype and generate them on the fly.
Related
I am using max-width: 768px to change looks on my website. But there are many high resolution devices on market (4K Mobile phones etc). How can I detect them? should I use orientation portrait? Or can I specify a aspect ratio as a code? What is the best way to catch all devices for responsive web design?
You have multiple options for this problem:
Within your media query you can test for the device width, resolution (pixel density), orientation, aspect ratio, pointer option and many more. See https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries for a full list of options.
It is recommended to support your implementation by feature and not by environment. For example you can target dark/light mode or if a device supports hover events instead of checking for phone, tablet, desktop, tv, gaming console …
Also you can combine different CSS units like em, vmin, vh, vh, % to get relative measurements.
This in combination with CSS grid can already solve many problems without defining a media query.
Of course in the end you probably still end up with some media queries. For that I recommend to pick 2-4 common screen sizes even though this is no guarantee that it will cover all devices.
I can also recommend you these episodes from The CSS Podcast
#rules
Preference Media Queries
I'm developing an Android app using Cordova in which there are multiple font-icons used. I used media queries for different screen sizes to set the font-size for the "body" by percent. I also added queries based on orientation to try and make it responsive for orientation-change. But still the icons look oddly smaller or larger for different screens as there can be tablets as well as mid-sized phones that can have the same resolution. So my question is, is there a better way to make my font-icons responsive regardless of the screen size, DPI, resolution? I'm using Fontello font-icons.
I'm developing a mobile app using HTML5 and CSS3 using responsive design. Its quite difficult to find css resolution of mobile.
I'm using Samsugn galaxy Note2. my actual resolution is 1280 X 720. but css resolution is 640 X 360.
How can we calculate css resolution from actual resolution? and what is concept behind this?
Thanks in advance.
You can test for a certain aspect ratio using media queries, however you shouldn't be designing for specific devices or aspect ratios. Responsive design works best when you design for breakpoints as it relates to your content. This way, there's less to worry about, and your content almost always looks better on every device
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.
Im doing some simple styling between different mobile devices and was wondering whats the best way to change depending on the resolution.
As my application looks fine on low resolution devices, but on high the fonts to small and other things are to small as well.
I was thinking of one style sheet depending on resolution but was wondering if this was the best way or is there better ways to implemented this situations.
The devices are all blackberry from new to old hence the high and low resolution.
Is there anyway even just to scale content up if the screens bigger?
Thanks
You can use media queries to target different screen sizes in CSS.
Here's a list for Blackberry devices http://responsive.co.za/blackberry-specific-media-queries/
You can do all this using CSS3 media queries.
Here are some resources
http://brendanmckenzie.com/2012/06/there-is-no-mobile-framework
http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
http://html5boilerplate.com/mobile
You should create media queries like they said but if you are doing this for a large number of devices and/or your css file becomes very long, I would do it with if then statements so that each device doesn't have to download a huge css file that contains all of the media queries for every device.