Kivy : How to manage different viewports - python-3.x

I am trying to build a game on Kivy that will be working on desktop and on mobile. I am really confused by how i should manage different window sizes, if i set a fixed size on my widgets.
How would someone go to design a game so that every element is "responsive" to screen size, with a similar rendering on all of the devices?
Can you point me to some Kivy api reference, or give me some code samples to learn from?
Thanks!

Related

How to do composite sprite on godot

I'm currently working on a 2 dimensional top down role playing game and i want to implement a equipment system wherein the way you look changes depending on the gear you have equipped and my idea is to do this by attaching the armor and weapons sprites onto the base sprite/composite sprite. I've been looking for tutorials on how i could implement this in Godot unfortunately the ones i see are only for unity so is this not possible on Godot? though if it is please tell me where i can learn it.

PyQt - Adjusting for Different Screen Resolution [duplicate]

This question already has answers here:
PyQt GUI size on high resolution screens
(3 answers)
Closed 3 years ago.
I've developed an application using PyQt on a computer that has a resolution of 3840x2160. I used QtDesigner to create almost all of my UI needs, then added the few other things I needed manually in python. Once I went to deploy the application, I realized that the target computer had a resolution of 1920x1080. Some widgets in the application (generally those that just had text/buttons) are fine, but once I start to get in to more complex layouts things don't appear as clearly. Specifically, QLabels and other QItems overlap each other, images are scaled disproportionately along their horizontal axis, and spacing between objects decreases. The following are a couple of images that illustrate the problem.
3480x2160 Screen (250% Scaling according to Windows Scale and Layout)
Note: This is what I see when I am developing.
3480x2160 Screen (100% Scaling according to Windows Scale and Layout)
1920x1080 Screen (100% Scaling according to Windows Scale and Layout)
I also noticed that Qt Designer itself has a similar problem when transitioning to a different screen resolution (see images attached).
High Resolution Screen - QtDesigner
Lower Resolution Screen - QtDesigner
What is the proper way to go about dealing with multiple screen resolutions in PyQt if I want to leverage QtDesigner? I know that I can retrieve the screen resolution with QDesktopWidget.screenGeometry, but is there any way to scale every parameter at once rather than manually changing each item? Will avoiding a particular "Size Policy" help at all with this?
If the issues is more with different dpi than resolution, you can tell Qt to use high dpi scaling/pixmaps by adding the following lines to your application before you create your QApplication (or any other Qt classes):
# Handle high resolution displays:
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
I have found that this makes my applications behave the same (or at least more similar) when switching between my laptop (high dpi, high resolution) and desktop (normal dpi, 1920x1080).
I don't use QtDesigner, so I have no idea how this suggestion plays with QtDesigner.

Webplayer GUI Rndering issue pixelated

I made a game in unity3d, Its graphics looking perfect in unity engine. but when i built it and played in web-player its graphics become pixelated and blurry.
So how can i make it pixel perfect game for web-player?
This also happened to me once. But i got the answer after some searching on unity.
this is what you need to do.
Select the texture which becomes pixelated.
-From import settings
Texture type=texture
Filter mode=Trilinear
Slect web as a platform and check yes on override for web
Max size=max
Format=truecolor
and click apply this should and definetly help me.
Source
Try to change you image size in photoshop i think you save it in small size.
And always make you graphics in vector so it become pixel free and you always have achance to make a new image from vector.

xml layout in android that supports different screen sizes

how should we set the xml layout in android that supports different screen sizes.
I tried using wrap content and match parent but its not working properly. Please guide me for this.
Thanks in advance.
The comment about, Supporting Multiple Screens is defiantly a good starting place! By default your xml does support different screen sizes.
Although the system performs scaling and resizing to make your application work on different screens, you should make the effort to optimize your application for different screen sizes and densities. In doing so, you maximize the user experience for all devices and your users believe that your application was actually designed for their devices—rather than simply stretched to fit the screen on their devices.
However, like it says you need to optimize it. This refers to images or a completely different xml per screen size/orientation. Does this help any?
If you need something a little more specific to your situation you'll need to provide more information.

Supporting multiple screen sizes/resolutions/aspect ratios using MonoGame

What is the recommended way of supporting multiple screen resolutions/aspect ratios across devices like iPad, iPhone, Windows Phones, and Android phones/tablets? Should I simply #if/#else specific code for each device? I don't know how well this would work. Especially for Android phones/tablets which come in all different sizes. Any pointers would be greatly appreciated.
Here is what we are doing for our game:
All menu or ui elements are positioned based on the screen size (we implement Horizontal and Vertical alignment)
All levels scroll, so on some devices you just see less of level of the level at a time
Our levels also zoom in on smaller devices where needed
Design fixed levels (ones that don't scroll) so that a bit of unused space is on the edges of the screen. This way it can get cropped on some devices no problem.
Make 3 sizes of images: small (3GS), medium (iPhone 4, Android, WP7, iPad), large iPad3
Position sprites/ui elements based on an images size
Take advantage of the #2x naming scheme for images
We made an iPhone-only and iPad-only version of the app, this helps in only having to put 2 sets of images in each app
Using the screen size for positioning is your best bet. Being able to center or dock to the bottom or right of the screen is also very helpful in general.
I could tell more, but I can't reveal specifics about our game yet.

Resources