Is it possible to get the radius a screen corner of an Android device has?
Phone screens don't have sharp edges, but I don't know how to adapt to the different edge types of different android phones...
Would be great if someone knows a c# .net solution!
Related
I'm writing a cross-platform application in .Net MAUI. When the application is running on a Windows desktop computer it should show a canvas which stretches across multiple monitors. To be able to draw on the correct pixel positions on this canvas I need the resolutions and positions of all connected monitors.
In Windows Forms it is possible to get information for multiple monitors using System.Windows.Forms.Screen.AllScreens. From this I can then get the positions and resolutions of all connected monitors.
So far, in MAUI I've only been able to find DeviceDisplay to get resolution for a single screen.
How do I get positions and resolutions for multiple monitors in .Net MAUI?
Is it possible to do from within the framework, or do I need to go through the Win32 API?
I was just testing my android app tonight when I found out that the app doesn't match the phone size.
I made the app specifically for my Android Phone ( SAMSUNG S8 ), with a resolution of 1440 x 2960, and yet when loading the app on the phone, it looks way bigger.
Any fixes to this?
set the Ui Scale Mode as Scale With Screen Size.
also, install the phone Devices simulator package to see the phone preview on Unity, It does not have to export your project just to see the preview
check this out
https://docs.unity3d.com/Packages/com.unity.device-simulator#2.2/manual/index.html
You could try to set the screen ratio. When I had this issue it was due to a ratio issue.
In the Player Settings (Ctrl+Shift+B), set the screen width and Height you needs.
In the Supported Aspect Ratio section, I chose Others.
From the upper-left corner of the game preview window.
I am using unity for develope to my android phone. I am trying to develope a 2D game. When I put new image(sprite) in my game i can see it fully in unity but when I uploaded the game to my phone, parts of the image are missing from the sides. How can I fit the images sizes on all phones?
I saw the answer for this question but for eclipes java and not unity C#.
In Unity 4.6 version, you can make you UI size adaptive:
Select the canvas where your UI resides
In the inspector, add a component called Canvas Scaler (in 4.6 beta, this is called Reference Resolution component)
Set the reference resolution to the native (or original size) of your sprite/background image
Make sure you choose the right "Screen Match Mode" if the phone's resolution is different.
That is it.
Now no matter how you resize the game view, your sprite can make best fit with it: either fit with the width or height, depending on the phone orientations and aspect ratios. In either case, however, you are guaranteed to see full image, rather than portion of it in your case. See the gif below:
Screen.width and Screen.height are the only unity specific methods you need.
Pass in height, width, and position information to your objects based on your screen size.
The harder part learning the gui.
If you need more help with syntax, take a look at unit's gui documentation and tutorials.
Use Screen.width and Screen.height to get the screen size of current device, then check your target phones screen aspect ratio:
For Window Phone, it's 5:3 and 16:9
iPhone: iPhone 3, 4 is 3:2, iPhone 5, 6, 6+ is 16:9
Android phone has many types.
After you get the that, make sure your sprites are designed in exact ratio for your target phones, and it'll be matched with screen.
I've made an unity game for iOS devices. It has a game object(sphere) which moves by the force applied to it. But I want to limit the sphere within the screen bounds.
I've seen the unity reference to Bounds, but i don't know how apply it according to the iOS device screens. Please Help.
ThankYou.
Use Mathf.clamp to keep your movement within the screen size. This will be more efficient than using colliders on the edges of your screen. Just play around with your object until you get the right numbers to keep it on your screen. Of course if you plan to use iOS tablets etc you will need to be able to account for the change in your clamping area.
Here is a link to the Unity Documentation which actually includes an example of what you are trying to do.
http://docs.unity3d.com/Documentation/ScriptReference/Mathf.Clamp.html
I'm trying to find a way to detect the radius of the themed window corner (pls, see the picture attached). E.g. for Aero theme when DWM is on all corners have radius 8, when DWM is off only top corners are curvy and have radius 6. Right now I'm hardcoding settings for different themes, and my questions is there more intelligent way of detecting these settings?
So far I looked to the windows visual styles api (UxTheme.dll) and can't find how to get the correct radius, it always the same for Aero no matter if DWM is on or off.
TIA
Not sure on this one. You might try using SystemParametersInfo with SPI_GETNONCLIENTMETRICS and looking at the resultant NONCLIENTMETRICS struct's iBorderWidth and iPaddedBorderWidth to see if you can find a correlation?